你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

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