Class PrometheusRegistry.RegistrationInfo

java.lang.Object
io.prometheus.metrics.model.registry.PrometheusRegistry.RegistrationInfo
Enclosing class:
PrometheusRegistry

private static class PrometheusRegistry.RegistrationInfo extends Object
Tracks registration information for each metric name to enable validation of type consistency, label schema uniqueness, and help/unit consistency.
  • Field Details

  • Constructor Details

  • Method Details

    • of

      static PrometheusRegistry.RegistrationInfo of(MetricType type, Set<String> labelNames, String help, Unit unit)
    • validateMetadata

      void validateMetadata(String newHelp, Unit newUnit)
      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

      boolean addLabelSet(Set<String> labelNames)
      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

      void removeLabelSet(Set<String> labelNames)
      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()