Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexer-service: Add /subgraphs/health/:deployment route #348

Merged
merged 2 commits into from
Jan 19, 2022

Conversation

Jannis
Copy link
Contributor

@Jannis Jannis commented Jan 10, 2022

This route handles only GET requests. It returns an HTTP 200 response if the deployment in question has not failed and is caught up to the chain head. Otherwise, a 500 is returned with different error messages depending on what is wrong.

This can be used to check the health of specific subgraph deployments in environments where the indexing status API is too complicated and simple, URL-based health checks are the only option (e.g. Cloudflare load balancers, k8s readiness probes, status pages).

This route handles only GET requests. It returns an HTTP 200 response if
the deployment in question has not failed and is caught up to the chain
head. Otherwise, a 500 is returned with different error messages
depending on what is wrong.

This can be used to check the health of specific subgraph deployments in
environments where the indexing status API is too complicated and
simple, URL-based health checks are the only option (e.g. Cloudflare
load balancers, k8s readiness probes, status pages).
@Jannis Jannis added enhancement New feature or request indexer-service labels Jan 10, 2022
@Jannis Jannis requested review from fordN, promaty and hopeyen January 10, 2022 14:49
@Jannis Jannis self-assigned this Jan 10, 2022
// Check whether the subgraph is caught up with the chain head
if (
latestBlock?.number === headBlock?.number &&
latestBlock?.hash === headBlock?.hash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be headBlock.number - latestBlock?.number < 5 or something because it doesn't execute instantly

Copy link
Contributor

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with promaty that a slight lag should still be healthy, otherwise looks pretty good!

This accounts for potential delay in processing blocks.
@Jannis
Copy link
Contributor Author

Jannis commented Jan 19, 2022

@promaty @hopeyen Comment addressed, this should be ready now.

@Jannis Jannis merged commit 29aa20f into main Jan 19, 2022
@Jannis Jannis deleted the jannis/subgraph-health-probe branch January 19, 2022 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request indexer-service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants