Class MetricStorageRegistry


  • public class MetricStorageRegistry
    extends java.lang.Object
    Responsible for storing metrics by MetricDescriptor and returning access to input pipeline for instrument measurements.

    Each descriptor in the registry results in an exported metric stream. Under normal circumstances each descriptor shares a unique MetricDescriptor.getName(). When multiple descriptors share the same name, but have some difference in identifying fields, an identity conflict has occurred. The registry detects identity conflicts on register(MetricStorage) and logs diagnostic information when they occur. See MetricDescriptor.equals(Object) for definition of identity equality.

    This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • lock

        private final java.lang.Object lock
    • Constructor Detail

      • MetricStorageRegistry

        public MetricStorageRegistry()
    • Method Detail

      • register

        public <I extends MetricStorage> I register​(I newStorage)
        Registers the metric newStorage to this registry. If a metric with compatible identity was previously registered, returns the previously registered storage. If a metric with the same name (case-insensitive) but incompatible MetricDescriptor was previously registered, logs a diagnostic warning and returns the newStorage.
        Parameters:
        newStorage - the metric storage to use or discard.
        Returns:
        the newStorage if no compatible metric is already registered, otherwise the previously registered storage.
      • resetForTest

        public void resetForTest()
        Reset the storage registry, clearing all storages.