diff --git a/dart/lib/src/metrics/metric.dart b/dart/lib/src/metrics/metric.dart index e4edf3fc79..4b86b5cb87 100644 --- a/dart/lib/src/metrics/metric.dart +++ b/dart/lib/src/metrics/metric.dart @@ -208,7 +208,7 @@ class SetMetric extends Metric { required super.unit, required super.tags}) : super(type: MetricType.set) { - _values.add(value.toInt()); + add(value); } @override @@ -235,7 +235,7 @@ class DistributionMetric extends Metric { required super.unit, required super.tags}) : super(type: MetricType.distribution) { - _values.add(value); + add(value); } @override diff --git a/dart/lib/src/metrics/metrics_aggregator.dart b/dart/lib/src/metrics/metrics_aggregator.dart index 51d7cf6c45..5551c396c0 100644 --- a/dart/lib/src/metrics/metrics_aggregator.dart +++ b/dart/lib/src/metrics/metrics_aggregator.dart @@ -80,7 +80,7 @@ class MetricsAggregator { _scheduleFlush(); } - Future _scheduleFlush() async { + void _scheduleFlush() { if (!_isClosed && _buckets.isNotEmpty) { if (_isOverWeight()) { _flushTimer?.cancel(); @@ -133,7 +133,7 @@ class MetricsAggregator { _flushTimer = null; flushCompleter?.complete(null); _flushCompleter = null; - await _scheduleFlush(); + _scheduleFlush(); } /// Return a list of bucket keys to flush. diff --git a/dart/lib/src/metrics/metrics_api.dart b/dart/lib/src/metrics/metrics_api.dart index 17e8b9f89b..380c21e92f 100644 --- a/dart/lib/src/metrics/metrics_api.dart +++ b/dart/lib/src/metrics/metrics_api.dart @@ -10,6 +10,7 @@ class MetricsApi { final Hub _hub; /// Emits a Counter metric, identified by [key], increasing it by [value]. + /// Counters track a value that can only be incremented. /// You can set the [unit] and the optional [tags] to associate to the metric. void increment(final String key, {final double value = 1.0, @@ -25,6 +26,7 @@ class MetricsApi { } /// Emits a Gauge metric, identified by [key], adding [value] to it. + /// Gauges track a value that can go up and down. /// You can set the [unit] and the optional [tags] to associate to the metric. void gauge(final String key, {required final double value, @@ -39,7 +41,8 @@ class MetricsApi { ); } - /// Emits a Gauge metric, identified by [key], adding [value] to it. + /// Emits a Distribution metric, identified by [key], adding [value] to it. + /// Distributions track a list of values. /// You can set the [unit] and the optional [tags] to associate to the metric. void distribution(final String key, {required final double value, @@ -57,6 +60,7 @@ class MetricsApi { /// Emits a Set metric, identified by [key], adding [value] or the CRC32 /// checksum of [stringValue] to it. /// Providing both [value] and [stringValue] adds both values to the metric. + /// Sets track a set of values to perform aggregations such as count_unique. /// You can set the [unit] and the optional [tags] to associate to the metric. void set(final String key, {final int? value,