You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HTTP response status code is always 200 irrespective of the the overall health status. Hence, this means that applications who wish to include ld-relay’s status in their healthcheck or deploy it as a service will need to reimplement the custom logic themselves to report a non-200 response if one of the following scenarios occur:
If an environment status is not connected, or is currently disconnected for more than X seconds, etc.
If a datastore is being used, report a health status that the user may want to customize based on whether the previous condition is true or not.
One solution I am thinking that users can do is package the ld-relay (as explained here) and implement a /healthcheck (or similarly named) endpoint which returns a non-200 status as per the logic described above.
However, currently the structs for parsing the status response is an internal package and hence we cannot Unmarshal the data without copying the struct types.
This would of course only be useful to applications that are written in Go, but I don't see any reason we couldn't do it. We do already export other code (the top-level Relay component and the configuration structs) so that the Relay Proxy services can be hosted inside other code, so this is not that different.
However, I disagree that "we cannot unmarshal the data without copying the struct types". Go can unmarshal arbitrary JSON into a map[string]interface{} type; there is also the LaunchDarkly SDK JSON type ldvalue.Value for a more type-safe approach. I agree that that's not as convenient as a struct type, but I thought it was worth mentioning, since one of the main reasons to use JSON for status information like this is that applications don't need any special schema to decode and traverse it.
However, I disagree that "we cannot unmarshal the data without copying the struct types". Go can unmarshal arbitrary JSON into a map[string]interface{} type; there is also the LaunchDarkly SDK JSON type ldvalue.Value for a more type-safe approach. I agree that that's not as convenient as a struct type, but I thought it was worth mentioning, since one of the main reasons to use JSON for status information like this is that applications don't need any special schema to decode and traverse it.
Yes you are right, of course there are other ways.
Is your feature request related to a problem? Please describe.
Currently LaunchDarkly Relay exports a /status endpoint which returns a JSON body as follows:
The HTTP response status code is always 200 irrespective of the the overall health status. Hence, this means that applications who wish to include ld-relay’s status in their healthcheck or deploy it as a service will need to reimplement the custom logic themselves to report a non-200 response if one of the following scenarios occur:
One solution I am thinking that users can do is package the ld-relay (as explained here) and implement a
/healthcheck
(or similarly named) endpoint which returns a non-200 status as per the logic described above.However, currently the structs for parsing the status response is an internal package and hence we cannot Unmarshal the data without copying the struct types.
Describe the solution you'd like
Export the status related type definitions to be usable by third party applications.
The text was updated successfully, but these errors were encountered: