APIMeterProvider class
APIMeterProvider is the entry point of the OpenTelemetry metrics API.
The API prefix indicates that it's part of the API and not the SDK
and generally should not be used since an API without an SDK is a noop.
Use the MeterProvider from the SDK instead.
It provides access to APIMeters which are used to record metrics.
You cannot create a MeterProvider directly;
you must use OTelAPI or more likely, OTel, for example to get the default meter provider:
var meterProvider = OTel.meterProvider();
See OTel for creating meters in addition to the default.
Use OTelAPI to run in no-op mode, as required by the specification.
Properties
- enabled ↔ bool
-
Gets whether this meter provider is enabled.
getter/setter pair
- endpoint ↔ String
-
Gets the endpoint URL where metrics data is sent.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isShutdown ↔ bool
-
Gets whether this meter provider has been shut down.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serviceName ↔ String
-
Gets the name of the service being instrumented.
getter/setter pair
- serviceVersion ↔ String?
-
Gets the version of the service being instrumented.
getter/setter pair
Methods
-
forceFlush(
) → Future< bool> - Forces the MeterProvider to flush all pending metrics to exporters. This is useful when the application is about to terminate and you want to ensure all metrics are exported. Returns true if the flush was successful, false otherwise.
-
getMeter(
{required String name, String? version, String? schemaUrl, Attributes? attributes}) → APIMeter -
Returns a APIMeter with the given
nameandversion. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shutdown(
) → Future< bool> - Shuts down the MeterProvider. After shutdown:
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited