recordGauge method

  1. @override
Future<ResultDart<void, TelemetryException>> recordGauge({
  1. required String name,
  2. required double value,
  3. Map<String, String> attributes = const {},
})
override

Records a gauge metric (current value).

Returns ResultDart with success or TelemetryException on error.

Implementation

@override
Future<ResultDart<void, TelemetryException>> recordGauge({
  required String name,
  required double value,
  Map<String, String> attributes = const {},
}) async {
  final metric = Metric(
    name: name,
    value: value,
    unit: 'count',
    timestamp: DateTime.now().toUtc(),
    attributes: attributes,
  );

  await _repository.exportMetric(metric);
  return const Success(unit);
}