initialize method
Future<ResultDart<void, TelemetryException> >
initialize({
- String otlpEndpoint = 'http://localhost:4318',
Implementation
Future<ResultDart<void, TelemetryException>> initialize({
String otlpEndpoint = 'http://localhost:4318',
}) async {
try {
final initialized = _ffi.initialize(otlpEndpoint) != 0;
if (initialized) {
_isInitialized = true;
return const Success(unit);
}
return Failure(
TelemetryInitializationException(
message:
'Failed to initialize telemetry: OTLP endpoint is $otlpEndpoint',
),
);
} on Exception catch (e) {
return Failure(
TelemetryException(
message: 'Unexpected error during telemetry initialization: $e',
code: 'INIT_ERROR',
),
);
}
}