recordMetric method
Future<ResultDart<void, TelemetryException> >
recordMetric({
- required String name,
- required String metricType,
- required double value,
- String unit = 'count',
- Map<
String, String> attributes = const {},
override
Records a counter metric.
Returns ResultDart with success or TelemetryException on error.
Implementation
@override
Future<ResultDart<void, TelemetryException>> recordMetric({
required String name,
required String metricType,
required double value,
String unit = 'count',
Map<String, String> attributes = const {},
}) async {
final metric = Metric(
name: name,
value: value,
unit: unit,
timestamp: DateTime.now().toUtc(),
attributes: attributes,
);
await _repository.exportMetric(metric);
return Success(unit);
}