Class MetricMetadata
Object
MetricMetadata
Immutable container for metric metadata: name, help, unit.
-
Constructor Summary
ConstructorsConstructorDescriptionMetricMetadata
(String name) MetricMetadata
(String name, String help) MetricMetadata
(String name, String help, Unit unit) Constructor. -
Method Summary
-
Constructor Details
-
MetricMetadata
-
MetricMetadata
-
MetricMetadata
Constructor.- Parameters:
name
- must not benull
.isValidMetricName(name)
must betrue
. UsePrometheusNaming.sanitizeMetricName(String)
to convert arbitrary strings into valid names.help
- optional. May benull
.unit
- optional. May benull
.
-
-
Method Details
-
getName
The name does not include the_total
suffix for counter metrics or the_info
suffix for Info metrics.The name may contain any Unicode chars. Use
getPrometheusName()
to get the name in legacy Prometheus format, i.e. with all dots and all invalid chars replaced by underscores. -
getPrometheusName
Same asgetName()
but with all invalid characters and dots replaced by underscores.This is used by Prometheus exposition formats.
-
getHelp
-
hasUnit
-
getUnit
-