Skip to content

Commit

Permalink
addressed PR feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanosiano committed Apr 3, 2024
1 parent 268ce92 commit 78c7087
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dart/lib/src/metrics/metric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -235,7 +235,7 @@ class DistributionMetric extends Metric {
required super.unit,
required super.tags})
: super(type: MetricType.distribution) {
_values.add(value);
add(value);
}

@override
Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/metrics/metrics_aggregator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MetricsAggregator {
_scheduleFlush();
}

Future<void> _scheduleFlush() async {
void _scheduleFlush() {
if (!_isClosed && _buckets.isNotEmpty) {
if (_isOverWeight()) {
_flushTimer?.cancel();
Expand Down Expand Up @@ -133,7 +133,7 @@ class MetricsAggregator {
_flushTimer = null;
flushCompleter?.complete(null);
_flushCompleter = null;
await _scheduleFlush();
_scheduleFlush();
}

/// Return a list of bucket keys to flush.
Expand Down
6 changes: 5 additions & 1 deletion dart/lib/src/metrics/metrics_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 78c7087

Please sign in to comment.