Metric class

Metric represents a named collection of data points.

A Metric is a collection of data points that share the same name, description, unit, and other metadata. It is the fundamental unit of telemetry that is exported to backends.

More information: https://opentelemetry.io/docs/specs/otel/metrics/data-model/#metric

Constructors

Metric({required String name, String? description, String? unit, required MetricType type, AggregationTemporality temporality = AggregationTemporality.cumulative, InstrumentationScope? instrumentationScope, required List<MetricPoint> points, bool? isMonotonic})
Creates a new Metric instance.
Metric.gauge({required String name, String? description, String? unit, required List<MetricPoint> points, InstrumentationScope? instrumentationScope})
Creates a gauge metric.
factory
Metric.histogram({required String name, String? description, String? unit, required List<MetricPoint> points, AggregationTemporality temporality = AggregationTemporality.cumulative, InstrumentationScope? instrumentationScope})
Creates a histogram metric.
factory
Metric.sum({required String name, String? description, String? unit, required List<MetricPoint> points, AggregationTemporality temporality = AggregationTemporality.cumulative, InstrumentationScope? instrumentationScope, bool isMonotonic = true})
Creates a sum metric.
factory

Properties

description → String?
The description of the metric.
final
hashCode → int
The hash code for this object.
no setterinherited
instrumentationScope → InstrumentationScope?
The instrumentation scope that created this metric.
final
isMonotonic → bool?
Whether this metric is monotonic (sum metrics only).
final
name → String
The name of the metric.
final
points → List<MetricPoint>
The data points for this metric.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
temporality → AggregationTemporality
The aggregation temporality of the metric.
final
type → MetricType
The kind of metric.
final
unit → String?
The unit of the metric.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited