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

curl "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"
  }'

Response

{  "data": {    "_meta": {      "deployment": "Qm...",The deployment that served this request      "block": {        "number": 18000000,Highest indexed block; track it over time        "hash": "0x..."Include in support requests      },      "hasIndexingErrors": falseAlert when true    }  }}
An illustrative health check. Record all four values on each run so you can spot lag, an unexpected deployment, or indexing errors.

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