Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Health check endpoint #92

Closed
hasufell opened this issue Oct 15, 2020 · 9 comments
Closed

Health check endpoint #92

hasufell opened this issue Oct 15, 2020 · 9 comments

Comments

@hasufell
Copy link

For https://jira.iohk.io/browse/ADP-496 it would be interesting to have an inexpensive and unambiguous health check endpoint.

I couldn't find any in https://github.com/input-output-hk/smash/blob/master/src/Lib.hs

@ksaric
Copy link
Contributor

ksaric commented Oct 15, 2020

There is a health check endpoint using Prometheus - https://github.com/input-output-hk/smash/blob/master/src/Cardano/Metrics.hs
Called from -

(metrics, server) <- registerMetricsServer 8080

So by default, you have port 8080 as the health check port (http://localhost:8080/), not sure if it's exported through the HTTP proxy:

# TYPE action_queue_length_post gauge
action_queue_length_post  0.0
# TYPE action_queue_length_post_write gauge
action_queue_length_post_write  748.0
# TYPE action_queue_length_pre gauge
action_queue_length_pre  0.0
# TYPE db_block_height gauge
db_block_height  4820725.0
# TYPE remote_tip_height gauge
remote_tip_height  4822338.0

@hasufell
Copy link
Author

But does that tell me this is a an actual smash server and it understands my API calls?

@ksaric
Copy link
Contributor

ksaric commented Oct 15, 2020

But does that tell me this is a an actual smash server and it understands my API calls?

No, the SMASH server tells you it's a SMASH server by understanding your API calls 😄

What is that you want to check here?
A call which results in?

An example would do wonders here.

@hasufell
Copy link
Author

hasufell commented Oct 15, 2020

No, the SMASH server tells you it's a SMASH server by understanding your API calls smile

The wallet wants to have a health check when a user sets a SMASH server, knowing that it's a valid SMASH server without doing expensive API calls and validating this prior to any metadata syncing.

@ksaric
Copy link
Contributor

ksaric commented Oct 15, 2020

@hasufell Sure, propose the format of such health check.

@hasufell
Copy link
Author

paths:
  /status:
    get:
    summary: Get
    description:  Query status/health of the SMASH server
    responses:
      200:
        description: Ok
        content:
          application/json:
            schema:
              type: object
              required:
                - smash_status
                - smash_version
             properties:
               smash_status:
                 description: the status of the SMASH server
                 type: string
                 enum:
                   - ok
                   - booting
                 example: ok
               smash_version:
                 description: The "git describe" version of the SMASH server
                 type: string
                 example: 0.1.0-rc-99-gb7fa2fe
               smash_message:
                 description: A custom message set by the operator
                 type: string
                 example: I'm a SMASH server for cardano
  1. whether booting makes sense or not as a value, I don't know, it's optional I guess
  2. I'm avoiding generic status field, so we can identify from the object keys that it's a smash server

@ksaric
Copy link
Contributor

ksaric commented Oct 15, 2020

@hasufell That looks solid, will implement it in this sprint, and get back to you.

@ksaric
Copy link
Contributor

ksaric commented Oct 22, 2020

Implemented in #101

@ksaric ksaric closed this as completed Oct 22, 2020
@hasufell
Copy link
Author

many thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants