otel_logging 0.2.0
otel_logging: ^0.2.0 copied to clipboard
Bridge `package:logging` records into the OpenTelemetry logs SDK so trace_id / span_id correlation works automatically for any Dart app using the standard logging package.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.2.0 - 2026-08-10 #
Changed #
- Semantic conventions updated to the current OTel registry: deprecated
attribute keys are no longer emitted (
db.system->db.system.name,db.operation->db.operation.name,rpc.system->rpc.system.name, withrpc.servicefolded into a fully-qualifiedrpc.method). - Dependency floors raised to
dartastic_opentelemetry ^1.1.0-beta.12anddartastic_opentelemetry_api ^1.0.0-rc.1. The previous floors declared compatibility with API versions that predate the semconv enums this package uses and could not actually resolve-and-compile. repositoryURL corrected to the canonicalDartasticorg casing so pub.dev repository verification succeeds.- Attribute keys are now emitted via semconv enum constants
(
ExceptionAttributesfrom the API, plus a package-localLoggingSemanticsenum for the non-registrylogging.zonekey) instead of raw string literals. Wire format is unchanged. - The runnable
example_app/now depends only on the OSS SDK and a self-containeddocker runbackend, so it works out of the box for every consumer.
Added #
PackageLoggingBridge.install()/uninstall()— subscribes topackage:logging'sLogger.root.onRecordand emits OTel log records via the activeLoggerProvider. EachLogger(name)becomes its own OTel instrumentation scope; severity is mapped to OTelSeverityusing the same boundaries as the SDK's existingdart:developerbridge.error/stackTraceon a record becomeexception.type/exception.message/exception.stacktraceattributes.- Bridge holds a single
StreamSubscriptionand cancels it onuninstall(), so the isolate exits cleanly aftermain()(related to issue #33 in the SDK repo). - Trace-log correlation: the bridge re-enters the caller's
Zone(captured bypackage:loggingonLogRecord.zone) before callingLogger.emit, soContext.currentresolves to the user's active span instead of the install-zone's context. Without this, records emitted insidestartActiveSpanAsyncreached the logs backend without atrace_id/span_id, breaking log-to-trace correlation. Pinned down bytest/integration/logs_backend_test.dart.