baking-bad/tzkt

Please add Prometheus metrics to services

Opened this issue · 1 comments

Prometheus is the leading open source metrics collection app and has countless popular integrations with other apps.

Currently i can only monitor the tzkt apps as part of my docker monitoring stack and only get very limited metrics from that. My request is if it would be possible to expose some or even basic Prometheus metrics that will give some idea about the health of the app (e.g. is the sync running, how far behind it is compared to latest block, time since latest block etc.)

Thanks

Hi! Yeah, that's a useful feature and we actually already have the task to collect metrics (with app-metrics) in our backlog, so stay tuned ;)

In the meantime, you can get basic info about indexer health (all that you mentioned) via the API endpoint /v1/head:

{
    "level": 2570145,                   // last indexed block
    "knownLevel": 2570145,              // node's head
    "lastSync": "2022-07-27T13:11:18Z", // time when the node head was last checked
    "synced": true,                     // level == knownLevel
    ...
}

If synced: false, then the indexer is stuck (or in process). If synced: true, but lastSync is old enough, then there are problems with the node. Otherwise, everything's good.