Skip to content

OpenMetrics/prometheus metrics for tezos-indexer

Operators of the tezos-indexer would benefit from having metrics instrumented into the tezos-indexer process directly.

By adding metrics to track such things as:

  • time to process a block
  • counters of operations in blocks by types (this is also in the DB, but probably convenient and cheap to have a metric for this)
  • time to query Tezos RPC
  • RPC error counters
  • postgresql connection status
  • postgresql query time (especially useful for insertions or stored procs that insert data)
  • postgresql error counts
  • build metric tezos_indexer_build_info{branch="master",opam="go1.6.2", revision="77f16da0d00d1cf43255afea0b0301aa0073196b",version="9.4.9"} 1 (see docs here for more explanation)

Operators and developers of tezos-indexer can get good visibility on how the indexer is working, and how it is performing over time and across versions or modes of operation. (token balances on/off).

Documentation on prometheus metrics and naming is available here:

https://prometheus.io/docs/instrumenting/writing_exporters/

The octez implementation is getting a metrics exporter "side-car" which can be found via MR tezos/tezos!2680 (closed) but for tezos-indexer it should be simpler and easier to maintain if the metrics are added to the tezos-indexer process directly.

There's an OCaml prometheus metrics library from the mirage project available here: https://github.com/mirage/prometheus and another project named "Liquidsoap" that can be used as a point of reference for how they implement prometheus metrics in their project: https://www.liquidsoap.info/doc-dev/prometheus.html

Edited by Jev Björsell
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information