Class PrometheusRegistry.RegistrationInfo
java.lang.Object
io.prometheus.metrics.model.registry.PrometheusRegistry.RegistrationInfo
- Enclosing class:
- PrometheusRegistry
Tracks registration information for each metric name to enable validation of type consistency,
label schema uniqueness, and help/unit consistency.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateRegistrationInfo(MetricType type, Set<Set<String>> labelSchemas, String help, Unit unit) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanaddLabelSet(Set<String> labelNames) Adds a label schema to this registration.(package private) MetricTypegetType()(package private) booleanisEmpty()Returns true if all label schemas have been unregistered.(package private) static PrometheusRegistry.RegistrationInfo(package private) voidremoveLabelSet(Set<String> labelNames) Removes a label schema from this registration.(package private) voidvalidateMetadata(String newHelp, Unit newUnit) Validates that the given help and unit are exactly equal to this registration.
-
Field Details
-
type
-
labelSchemas
-
help
-
unit
-
-
Constructor Details
-
RegistrationInfo
-
-
Method Details
-
of
static PrometheusRegistry.RegistrationInfo of(MetricType type, Set<String> labelNames, String help, Unit unit) -
validateMetadata
Validates that the given help and unit are exactly equal to this registration. Throws if values differ, including when one is null and the other is non-null. This ensures consistent metadata across all collectors sharing the same metric name. -
addLabelSet
Adds a label schema to this registration.- Parameters:
labelNames- the label names to add (null or empty sets are normalized to empty set)- Returns:
- true if the schema was added (new), false if it already existed
-
removeLabelSet
Removes a label schema from this registration.- Parameters:
labelNames- the label names to remove (null or empty sets are normalized to empty set)
-
isEmpty
boolean isEmpty()Returns true if all label schemas have been unregistered. -
getType
MetricType getType()
-