Class GlobalMetricsProvider


  • public final class GlobalMetricsProvider
    extends Object
    IMPORTANT: This is a temporary class, and solution for the metrics package until it will be marked as stable.
    • Method Detail

      • set

        public static void set​(MeterProvider meterProvider)
        Sets the MeterProvider that should be the global instance. Future calls to get() will return the provided MeterProvider instance. This should be called once as early as possible in your application initialization logic, often in a static block in your main class.
      • getMeter

        public static Meter getMeter​(String instrumentationName)
        Gets or creates a named meter instance from the globally registered MeterProvider.

        This is a shortcut method for getGlobalMeterProvider().get(instrumentationName)

        Parameters:
        instrumentationName - The name of the instrumentation library, not the name of the instrument*ed* library.
        Returns:
        a tracer instance.
      • getMeter

        public static Meter getMeter​(String instrumentationName,
                                     String instrumentationVersion)
        Gets or creates a named and versioned meter instance from the globally registered MeterProvider.

        This is a shortcut method for getGlobalMeterProvider().get(instrumentationName, instrumentationVersion)

        Parameters:
        instrumentationName - The name of the instrumentation library, not the name of the instrument*ed* library.
        instrumentationVersion - The version of the instrumentation library.
        Returns:
        a tracer instance.