Partager via


MeterProvider Interface

public interface MeterProvider

Resolves and provides Meter implementation.

This class is intended to be used by Azure client libraries and provides abstraction over different metrics implementations. Application developers should use metrics implementations such as OpenTelemetry or Micrometer directly.

Method Summary

Modifier and Type Method and Description
default Meter createMeter(LibraryTelemetryOptions libraryOptions, MetricsOptions applicationOptions)

Creates meter instance.

abstract Meter createMeter(String libraryName, String libraryVersion, MetricsOptions applicationOptions)

Creates named and versioned meter instance.

static MeterProvider getDefaultProvider()

Returns default implementation of MeterProvider that uses SPI to resolve metrics implementation.

Method Details

createMeter

public default Meter createMeter(LibraryTelemetryOptions libraryOptions, MetricsOptions applicationOptions)

Creates meter instance.

Parameters:

libraryOptions - Azure SDK telemetry options.
applicationOptions - instance of MetricsOptions provided by the application.

Returns:

a meter instance.

createMeter

public abstract Meter createMeter(String libraryName, String libraryVersion, MetricsOptions applicationOptions)

Creates named and versioned meter instance.

MetricsOptions metricsOptions = new MetricsOptions();

 Meter meter = MeterProvider.getDefaultProvider().createMeter("azure-core", "1.0.0", metricsOptions);

Parameters:

libraryName - Azure client library package name
libraryVersion - Azure client library version
applicationOptions - instance of MetricsOptions provided by the application.

Returns:

a meter instance.

getDefaultProvider

public static MeterProvider getDefaultProvider()

Returns default implementation of MeterProvider that uses SPI to resolve metrics implementation.

Returns:

an instance of MeterProvider

Applies to