prometheus

Prometheus INFO metrics with recording rules


How to generate custom INFO metrics with recording rules?

The only workaround for this we've found is to use absent and non_exist together so it creates a custom INFO metric.

e.g. recording rule named "networks_id" defined as:

absent(non_exist{network_id="1",network_name="Ethereum"})

will create series

networks_id{{network_id="1", network_name="Ethereum Mainnet"}

where "non_exists" is just a string for metric name we don't have scraped...

Is there a more common way to accomplish this with prometheus recording rules?


Solution

  • In the Prometheus config, have you tried something like

      - record: networks_id
        expr: 1
        labels:
          network_id: 1
          network_name: Ethereum Mainnet