-
Notifications
You must be signed in to change notification settings - Fork 825
Open
Description
Consider this metric registration:
Counter.builder().name("whatever_created_total").register();It will end up with the exception:
java.lang.IllegalArgumentException: 'whatever_created': Illegal metric name: The metric name must not include the '_created' suffix.
at io.prometheus.metrics.core.metrics.MetricWithFixedMetadata$Builder.name(MetricWithFixedMetadata.java:62)
at io.prometheus.metrics.core.metrics.Counter$Builder.name(Counter.java:240)
This happens because the Counter strips the _total suffix before, sending it to the validation logic. The validation has a suffix list which is denying _created, even though in the example case _created is not the suffix of the metric.
Looking at the code, I think it is too naive to have one general static metrics validation logic for all metric types. For example, Counter should have validation logic, which allows _total suffixes.
Metadata
Metadata
Assignees
Labels
No labels