Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

create better "where are my relays?" endpoints #912

Open
karenetheridge opened this issue Oct 11, 2019 · 3 comments
Open

create better "where are my relays?" endpoints #912

karenetheridge opened this issue Oct 11, 2019 · 3 comments
Labels
api database involves database schema or config changes, or non-trivial query authoring enhancement extends current functionality maybe needs-shell needs accompanying changes in conch-shell needs-ui needs accompanying changes in conch-ui

Comments

@karenetheridge
Copy link
Contributor

karenetheridge commented Oct 11, 2019

Currently these endpoints exist:

  • GET /workspace/:workspace_id_or_name/relay - list all relays located in the indicated workspace (and sub-workspaces beneath it)
  • GET /workspace/:workspace_id_or_name/relay/:relay_id/device - returns all the devices that have been reported by the provided relay that are presently located within this workspace

The latter endpoint should be moved to be build-relative, as builds are much more important than workspaces going forward. However, the former endpoint is much more problematic: it depends on a device's current location being the same as the location it had when the relay attached to that device last submitted a report. The intent of this endpoint is "where are all my relays now?", but the way the query is written, we cannot provide that information accurately because we do not maintain a location history.

However, we can solve this problem by introducing a new join table, to link relays with rack locations (that is, a new relay_location table that has foreign keys relay_id, rack_id, rack_unit_start, much like device_location). Then, we can update the relay_location table whenever we receive a device report from that relay, with the currently-known location of that device. This gives us another datapoint for finding relays -- we can look in the location the relay last sent a report from, and also the current location of the device the relay was attached to (in case it got moved along with the device).

@karenetheridge karenetheridge added enhancement extends current functionality api maybe needs-shell needs accompanying changes in conch-shell needs-ui needs accompanying changes in conch-ui database involves database schema or config changes, or non-trivial query authoring labels Oct 11, 2019
@perigrin
Copy link
Contributor

perigrin commented Oct 11, 2019

I'd like some understanding (perhaps from @daleghent, @jemershaw, or @psteinbachs ) as to how the two endpoints were being used, especially the second one. It may be that we could simply drop the endpoints entirely in v3 world, because keeping track of the location of things is not our problem (anymore/currently).

@jemershaw
Copy link
Contributor

I can't recall ever using those endpoints. Most of the time we'd only need to know which relay is serving a particular device since we'd need to know which device to log into if we needed to troubleshoot.

@karenetheridge
Copy link
Contributor Author

with the deprecation of physical DRDs, this is probably moot now. We might even abandon the concept of the 'relay' entity entirely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api database involves database schema or config changes, or non-trivial query authoring enhancement extends current functionality maybe needs-shell needs accompanying changes in conch-shell needs-ui needs accompanying changes in conch-ui
Projects
None yet
Development

No branches or pull requests

3 participants