MetricsCollector class
Metrics collector.
Constructors
-
MetricsCollector({MetricSink? sink, Map<
String, String> ? defaultLabels})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sink → MetricSink
-
Get the underlying metric sink.
no setter
Methods
-
child(
Map< String, String> labels) → MetricsCollector - Create child collector with additional labels.
-
gauge(
String name, double value, [Map< String, String> ? labels]) → void - Set a gauge value.
-
getMetric(
String name) → double? - Query the latest value for a named metric.
-
getMetrics(
{String? prefix}) → List< Metric> - Query all recorded metrics, optionally filtered by name prefix.
-
histogram(
String name, double value, [Map< String, String> ? labels]) → void - Record a histogram value.
-
increment(
String name, [double value = 1.0, Map< String, String> ? labels]) → void - Increment a counter.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordDuration(
String name, Duration duration, [Map< String, String> ? labels]) → void - Record duration.
-
timer(
String name, [Map< String, String> ? labels]) → MetricTimer - Start a timer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited