Closed
Description
We're using the Enum
metric to represent the state of different critical processes in the following way:
registry = CollectorRegistry()
deadline_start = Enum(
'deadline_start', 'Start of a time-critical process',
labelnames=['customer'], states=['waiting', 'late', 'started'],
registry=registry
)
deadline_end = Enum(
'deadline_end', 'Completion of a time-critical process',
labelnames=['customer'], states=['waiting', 'late', 'started'],
registry=registry
)
and the result we obtain is:
# HELP deadline_start Start of a time-critical process
# TYPE deadline_start gauge
deadline_start{customer="customerA",deadline_start="waiting"} 1.0
deadline_start{customer="customerA",deadline_start="late"} 0.0
deadline_start{customer="customerA",deadline_start="started"} 0.0
# HELP deadline_end Completion of a time-critical process
# TYPE deadline_end gauge
deadline_end{customer="customerA",deadline_end="waiting"} 1.0
deadline_end{customer="customerA",deadline_end="late"} 0.0
deadline_end{customer="customerA",deadline_end="started"} 0.0
but we would like to have a custom_label for the state instead of the metric name as we need to have the same label for all the metrics.
# HELP deadline_start Start of a time-critical process
# TYPE deadline_start gauge
deadline_start{customer="customerA",custom_label="waiting"} 1.0
deadline_start{customer="customerA",custom_label="late"} 0.0
deadline_start{customer="customerA",custom_label="started"} 0.0
# HELP deadline_end Completion of a time-critical process
# TYPE deadline_end gauge
deadline_end{customer="customerA",custom_label="waiting"} 1.0
deadline_end{customer="customerA",custom_label="late"} 0.0
deadline_end{customer="customerA",custom_label="started"} 0.0
the same happens with StateSetMetricFamily
.
Would be possible to allow to pass a custom label? I can make a PR with the improvement
Metadata
Metadata
Assignees
Labels
No labels