Class GlobalMeterProvider


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static MeterProvider get()
      Returns the globally registered MeterProvider.
      static Meter getMeter​(java.lang.String instrumentationName)
      Gets or creates a named meter instance from the globally registered MeterProvider.
      static Meter getMeter​(java.lang.String instrumentationName, java.lang.String instrumentationVersion)
      Gets or creates a named and versioned meter instance from the globally registered MeterProvider.
      static void set​(MeterProvider meterProvider)
      Sets the MeterProvider that should be the global instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.lang.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​(java.lang.String instrumentationName,
                                     java.lang.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.