io.opentelemetry.api.metrics.MeterProvider Maven / Gradle / Ivy
Show all versions of polaris-all Show documentation
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.api.metrics;
import javax.annotation.concurrent.ThreadSafe;
/**
* A registry for creating named {@link Meter}s.
*
* The name Provider is for consistency with other languages and it is NOT loaded
* using reflection.
*
* @see Meter
* @since 1.10.0
*/
@ThreadSafe
public interface MeterProvider {
/**
* Gets or creates a named Meter instance.
*
* @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as
* the instrumentation library, package, or fully qualified class name. Must not be null.
* @return a Meter instance.
*/
default Meter get(String instrumentationScopeName) {
return meterBuilder(instrumentationScopeName).build();
}
/**
* Creates a MeterBuilder for a named Meter instance.
*
* @param instrumentationScopeName A name uniquely identifying the instrumentation scope, such as
* the instrumentation library, package, or fully qualified class name. Must not be null.
* @return a MeterBuilder instance.
*/
MeterBuilder meterBuilder(String instrumentationScopeName);
/** Returns a no-op {@link MeterProvider} which provides meters which do not record or emit. */
static MeterProvider noop() {
return DefaultMeterProvider.getInstance();
}
}