Skip to content

Export the StatusRep and related struct and make them consumable by third-party applications #146

Open
@asaha123

Description

@asaha123

Is your feature request related to a problem? Please describe.

Currently LaunchDarkly Relay exports a /status endpoint which returns a JSON body as follows:

{
  "environments": {
    "environment1": {
      "sdkKey": "sdk-********-****-****-****-*******99999",
      "envId": "999999999999999999999999",
      "mobileKey": "mob-********-****-****-****-*******99999",
      "status": "connected",
      "connectionStatus": {
        "state": "VALID",
        "stateSince": 10000000
      },
      "dataStoreStatus": {
        "state": "VALID",
        "stateSince": 10000000,
        "database": "redis",
        "dbServer": "redis://my-redis-host",
        "dbPrefix": "env1"
      }
    },    
  },
  "status": "healthy",
  "version": "5.11.1",
  "clientVersion": "4.17.2"
}

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.

Describe the solution you'd like

Export the status related type definitions to be usable by third party applications.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions