Class SharedMetricRegistries


  • public class SharedMetricRegistries
    extends Object
    SharedMetricRegistries is used to create/retrieve a MicroProfile Metric's MetricRegistry instance of a provided scope. For each "scope" there exists an individual MicroProfile Metric MetricRegistry which is associated to an single "underlying" Micrometer MeterRegistry that is registered to the Micrometer global registry. This is either a Prometheus MeterRegistry or a "simple" MeterRegistry. By default, it is the Prometheus MeterRegistry unless the MP Config "mp.metrics.prometheus.enabled" is set to false. In which case the simple MeterRegistry is used. Alternatively, if the Prometheus MeterRegistry is not detected on the classpath the simple Meter Registry will be used.
    • Constructor Detail

      • SharedMetricRegistries

        public SharedMetricRegistries()
    • Method Detail

      • getRegistryScopeNames

        public static Set<String> getRegistryScopeNames()
      • getOrCreate

        public static org.eclipse.microprofile.metrics.MetricRegistry getOrCreate​(String scope)
      • drop

        public static void drop​(String scope)
        Drops a particular registry. If a reference to the same registry type is requested later, a new empty registry will be created for that purpose.
        Parameters:
        scope - The scope of registry that should be dropped.
      • dropAll

        public static void dropAll()
        Drops all registries. If a reference to a registry is requested later, a new empty registry will be created for that purpose.
      • doesScopeExist

        public static boolean doesScopeExist​(String scope)
        Returns true/false if registry with this scope exists
        Parameters:
        scope - name of scope
        Returns:
        true/false if registry with this scope exists