TelemetryService class

Service for managing OpenTelemetry-based tracing and metrics.

Provides a unified interface for instrumenting ODBC operations with distributed tracing context.

Traces and spans are stored locally during operation and exported only when ended (to calculate accurate duration).

Implemented types

Constructors

TelemetryService(ITelemetryRepository _repository)
Creates a new TelemetryService instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceName String
Service name for all traces.
no setteroverride

Methods

endSpan({required String spanId, Map<String, String> attributes = const {}}) Future<ResultDart<void, TelemetryException>>
Finishes a span by calculating duration.
override
endTrace({required String traceId, Map<String, String> attributes = const {}}) Future<ResultDart<void, TelemetryException>>
Finishes a trace by calculating duration.
override
flush() Future<ResultDart<void, TelemetryException>>
Flushes all pending telemetry data.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordEvent({required String name, required TelemetrySeverity severity, required String message, Map<String, dynamic> context = const {}}) Future<ResultDart<void, TelemetryException>>
Records a telemetry event (log entry).
override
recordGauge({required String name, required double value, Map<String, String> attributes = const {}}) Future<ResultDart<void, TelemetryException>>
Records a gauge metric (current value).
override
recordMetric({required String name, required String metricType, required double value, String unit = 'count', Map<String, String> attributes = const {}}) Future<ResultDart<void, TelemetryException>>
Records a counter metric.
override
recordTiming({required String name, required Duration duration, Map<String, String> attributes = const {}}) Future<ResultDart<void, TelemetryException>>
Records a timing metric.
override
shutdown() Future<ResultDart<void, TelemetryException>>
Shutdown telemetry exporter and release resources.
override
startSpan({required String parentId, required String spanName, Map<String, String> initialAttributes = const {}}) Future<ResultDart<Span, TelemetryException>>
Creates a child span within an existing trace.
override
startTrace(String operationName) Future<ResultDart<Trace, TelemetryException>>
Starts a new trace for an ODBC operation.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited