PromPHP / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
423 stars 93 forks source link

Properly validate label names #82

Closed ttk closed 2 years ago

ttk commented 2 years ago

The label name validation function was using the same regex as for the metric names. But according to the official prometheus docs the label names need to conform to a slightly different pattern. A check is also done for reserved label names; any that start with a double underscore (__).

Unit tests added and pass.

ttk commented 2 years ago

Not sure why phpcs code checks are erroring out on files that I haven't edited....Have the code check rules changed recently?

LKaemmerling commented 2 years ago

Hey @ttk,

thanks for your contribution! Looks good from my side!