Skip to content

Monitor sync health

Check Subgraph indexed block metadata and indexing-error status with _meta.

Detect stale data before it reaches your users. Run a small _meta query on a schedule, or add _meta to important reads, to see which deployment served the request, how far it has indexed, and whether it reports indexing errors.

Prerequisites

  • A Subgraphs API key.
  • A query endpoint using a Deployment CID, Graph Network Subgraph ID, or Endpoint Alias.
  • A place to record health-check results, such as application logs or metrics.
  • For lag alerts, a reliable source of the chain head for the same network.

Request

This request reads _meta through an Endpoint Alias: the serving deployment, the indexed block, and the indexing-error flag.

Prerequisites

  1. Set GRAPHOPS_API_KEY to your GraphOps API key.

  2. Replace <ALIAS> with your Endpoint Alias.

# `_meta` reports the serving deployment, its latest indexed block, and any indexing errors.
curl --fail-with-body --silent --show-error "https://subgraphs.graphops.xyz/v1/alias/<ALIAS>" \
  -H "Authorization: Bearer ${GRAPHOPS_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{
    "query": "query SyncHealth { _meta { deployment block { number hash } hasIndexingErrors } }",
    "operationName": "SyncHealth"
  }'

Output

{  "data": {    "_meta": {      "deployment": "QmTZ8ejXJxRo7vDBS4uwqBeGoxLSWbhaA7oXa1RvxunLy7",The deployment that served this request      "block": {        "number": 26250897,Highest indexed block; track it over time        "hash": "0x7c2450505fd5a13e82ef63e3177dfb4521f50793653c7c60b85efca1acc25c2f"Include in support requests      },      "hasIndexingErrors": falseAlert when true    }  }}

Act on each signal

Run the same _meta query on a schedule and act on each signal. Check indexing errors first, then the serving deployment, then freshness.

Compare _meta.block.number with the chain head only when you have a reliable head source for the same network. If _meta.hasIndexingErrors is true, follow the checks in Troubleshooting.

Recent blocks can still be corrected by a chain reorganization. See Sync and reorgs before you treat a result as final.

Next steps