Repository navigation
v1.1.0-beta.7
Pre-release
Pre-release
·
95 commits
to main
since this release
Fixed
- Debug logging no longer adds a
ConsoleExporterto the trace pipeline.
OTel.initialize()used to append aConsoleExporterto the span exporters
whenever debug logging was enabled (e.g.OTEL_LOG_LEVEL=debug/trace),
silently changing the export pipeline shape. Per the OTel spec the default
exporter isotlponly — the same cleanup #49 applied to metrics. Console
output remains available explicitly:OTEL_TRACES_EXPORTER=console
(replaces the exporter) or theOTEL_CONSOLE_EXPORTER--dart-define
(adds one alongside). For span logging useOTEL_LOG_SPANS=true.
Added
- Configurable exception handling for
Tracer.withSpan/withSpanAsync. A newSpanExceptionOptions(withrecordException,setStatusOnException, and anexceptionSanitizercallback returning aSanitizedSpanException) lets callers customize how a thrown exception is recorded and whether the span status is set. The defaults preserve the existing behavior (record the exception + setSpanStatusCode.Error), and the original exception is always rethrown. Configure globally viaOTel.initialize(spanExceptionOptions: ...)(also available perTracerProviderandOTel.addTracerProvider) and override per call via the newexceptionOptions:parameter onwithSpan/withSpanAsync/startActiveSpan/startActiveSpanAsyncandOTel.withSpan/OTel.withSpanAsync. Per-call options are merged field-by-field over the global config (viaSpanExceptionOptions.mergeWith), so overriding a single flag preserves a globally configured sanitizer. When a sanitizer is provided, only its returned type/message/stacktrace are recorded — the raw exception's details never leak — and if the sanitizer itself throws, the span is marked failed with a generic description. This enables SDKs and applications to redact PII before it is recorded. (#51)
Fixed
- API-first usage no longer wedges SDK initialization (#50). The API
package auto-installs its no-opOTelAPIFactorywhen API-only code runs
before the SDK initializes (per the OTel spec). Previously
OTel.initialize()then failed with "can only be initialized once", and
OTel.tracerProvider()crashed with an opaque
APITracerProvider is not a subtype of TracerProvidercast error.
OTel.initialize()now replaces exactly the auto-installed no-op API
factory — identified viaOTelFactory.isAPIFactory(API ≥ beta.8), so real
factories are never silently replaced — and the SDK accessors
(tracerProvider()/meterProvider()/loggerProvider()/addTracerProvider())
throw a clearOTel.initialize() must be called first.StateErrorbefore
initialization instead of the cast error.OTelSDKFactorynow overrides
isAPIFactorytofalseper the API ≥ beta.8 contract. Note: API objects
handed out beforeinitialize()remain no-ops — capture tracers after
initialize. Thanks @robert-northmind for the investigation in #53 and the
regression test suite adapted from it.
Changed
- Bumped
dartastic_opentelemetry_apito^1.0.0-beta.9. Beta.8 adds
OTelFactory.isAPIFactory(used by the fix above) and replaces the no-op
factory inOTelAPI.initialize(); beta.9 fixes pre-initialization lazy
no-op installs (tracer(),logger(),instrumentationScope(),
TraceState.fromString, thefromJsons) and makesContextre-read the
global factory so an SDK factory installed later actually takes effect.