Skip to content

Output valid monitoring metric names

Created by: hacklschorsch

Currently, I cannot scrape the /metrics endpoint with Prometheus. It seems metric names can not include capital letters, and our current implementation has them.

From my understanding, before version 2.4.0 Prometheus was more lax when parsing and did not enforce metrics naming rules. Since 2.4.0 it does.

Actual behaviour

In, for example: curl -k -s https://payments1/metrics

servant.path.metrics.GET.time_ms_count 6

the all-caps GET invalidates the name.

Expected behaviour

Output metric names that Prometheus likes to parse.

Test

promtool, which is included with prometheus, features a linter for the metric format:

[vagrant@monitoring1:~]$ curl -k -s https://payments1/metrics | /nix/store/nxivhdxrmm14nzv9j9bylglcix9rsjnb-prometheus-2.13.0-bin/bin/promtool check metrics

outputs

error while linting: text format parsing error in line 1: invalid metric name in comment