Repository navigation
Stable-channel republication of 1.0.0-rc.4. The code is the rc's code with a
stable version stamp, so users who have not opted into prereleases get the
fixes. See the 1.0.0-rc.4 entry for detail. The changes listed below are the
delta against 0.11.0, the previous stable release, not against the previous
prerelease.
Added
TraceState.toHeaderString()returns the W3Ctracestateheader value and
applies the §3.3.1.5 truncation procedure when the joined value exceeds the
512-character budget: whole entries are removed, entries over 128 characters
first, then entries from the end, and every removal is reported through
OTelErrorHandling.toString()continues to return all entries
(#128).APIMeter.registerBatchCallback(callback, instruments)registers one callback
that observes several instruments at once and returns an
APIBatchCallbackRegistrationwithunregister(). Instruments must belong
to the same meter, per metrics/api.md (#113).InstrumentAdvisoryon all sevenAPIMeter.create*methods, carrying
explicitBucketBoundariesandattributeKeyshints to the SDK
(#113).APIObservableInstrument, implemented by the three observable instruments,
so batch callbacks andregisterBatchCallbacktake a real type
(#113).createObservableCounter,createObservableUpDownCounterand
createObservableGaugeaccept acallbackslist, and the instruments gain
addCallback, which returns a registration handle, andremoveCallback
(#113).APITracer.startSpanandAPITracer.createSpannow accept aroot: true
parameter to force the creation of a root span, even when a parent span is
active in the context
(#118).APITracer.startSpannow accepts an optionalstartTimeparameter
(#118).TraceFlags.RANDOM_FLAG,TraceFlags.isRandomandTraceFlags.withRandom
expose the random-trace-id bit (0x02), which W3C Trace Context Level 2
makes a MUST to propagate unchanged across a continued trace. The byte
already propagated, but the bit could not be read or set
(#142).
Changed
- BREAKING:
TraceFlags.fromStringis now a static method that returns
null unless given two lowercase hex digits. Propagators must reject
invalid headers (context/api-propagators.md, MUST)
(#114). - BREAKING:
parentSpanandspanContextparameters have been removed from
APITracer.startSpanandAPITracer.createSpan. Span creation now always
uses the parent span or remote context stored in the providedContext(or
Context.currentif omitted).parentSpan: parentbecomes
context: Context.current.withSpan(parent).spanContext: schas no direct
replacement: it assignedscto the new span verbatim, span ID included,
which the specification's Span Creation section does not provide for. Putting
scon theContextinstead makes the new span a child of it — a new span
ID, withparentSpanIdset tosc.spanId. Callers who actually wanted a span
carryingscunchanged should useOTelAPI.nonRecordingSpan(sc).
The full parent precedence isroot> remoteSpanContext> localSpan>
valid non-remoteSpanContext> new root, applied identically with and
without an SDK installed. A candidate whoseSpanContextis invalid is
skipped, so aContextcarrying only an invalid span or span context yields
a root span rather than an error. When a remoteSpanContextidentifies a
Spanin the sameContext, thatSpanis kept as the new span's
parentSpan
(#118). - BREAKING:
Baggage.getAllValues()now returns
Map<String, BaggageEntry>instead ofList<String>, the name/value pairs
the specification's "Get All Values" operation requires. To get the old
List<String>back, write
getAllValues().values.map((e) => e.value).toList().
Baggage.getAllEntries()is now@Deprecatedand delegates to
getAllValues(); it will be removed in a future release
(#127). - BREAKING:
APIMeterProviderholds no configuration or operational
state, per metrics/noop.md. Theendpoint,serviceName,serviceVersion,
enabledandisShutdowngetters and setters are removed,getMeter
returns a fresh no-op meter each call, andshutdownandforceFlush
always returntrue(#113).
Deprecated
- The
boundariesparameter oncreateHistogram. Use
advisory: InstrumentAdvisory(explicitBucketBoundaries: ...). When both are
given,boundarieswins so existing callers keep their buckets, and the rest
of the advisory is kept (#113). - The
callbackparameter on the threecreateObservable*methods. Use the
callbackslist; acallbackis prepended to it (#113).
Removed
- BREAKING:
APISpanno longer exposesattributes,spanEvents,spanLinks,
statusorstatusDescription. trace/api.md says implementations SHOULD NOT
provide access to a span's data besides itsSpanContext. An SDK reads them
throughgetReadableSpan, which is not exported from the package barrel.
Setting attributes is unchanged. SDK users are unaffected in practice: the SDK
span already gates every mutator on its own recording state, so this reaches
API-direct users and custom SDKs
(#140). - BREAKING: the
parentSpanandspanContextparameters of
APITracer.startSpanandAPITracer.createSpan. The parent now comes from
theContext, soparentSpan: parentbecomes
context: Context.current.withSpan(parent).spanContext: schas no
equivalent, because it gave the new spanscverbatim, span ID included.
Putscon theContextto parent a new span to it, or use
OTelAPI.nonRecordingSpan(sc)to wrap it unchanged. ThestartSpandartdoc
documents the full parent precedence
(#118). - BREAKING:
Context.copyWithValue. It generated a key the caller could never
get back, so a value stored through it was unreachable. Create the key with
OTelAPI.contextKey<T>(name)and useContext.copyWith(key, value)
(#130).
Fixed
-
The metrics API now documents that
APIMeterProvider,APIMeterand the seven
instruments need to be safe for concurrent use, that an instrumentnamemust
conform to the instrument name syntax, and thatHistogram.recordexpects a
non-negative value. metrics/api.md makes the first a MUST and the other two a
SHOULD. Comments only, no behavior change
(#141). -
IdGeneratorno longer draws every ID byte from a fresh
Random.secure().nextInt(256)call (one OS entropy syscall per byte), which
made generating a span ID cost ~330 µs and a trace ID ~665 µs on macOS arm64 —
roughly 1 ms to start a root span. It now seeds a xorshift128 generator once
from the OS CSPRNG and expands it locally (~18,000–21,000× faster), keeping
the same 8/16-byte, non-zero, unique-ID contract, with 32-bit-masked
arithmetic so VM and web builds produce identical sequences. Note that a
locally generated trace ID exposes the full generator state, so subsequent
IDs from the same isolate are predictable — generated IDs must not be used
as secrets or security tokens
(#144). -
Integer trace flags retain only the low byte, including during
SpanContext.fromJson, so they always render as two hex digits as required
by the W3C Trace Context trace-flags grammar
(#114). -
TraceStateconstruction (fromMap,OTelAPI/OTelFactorytraceState(...))
now validates keys and values against the W3C tracestate grammar, dropping
invalid entries instead of silently accepting them
(#119). -
BREAKING:
IdGenerator.hexToBytes, and soOTelAPI.traceIdFromand
OTelAPI.spanIdFrom, no longer accept anything outside lowercase hex
(#112). -
OTelAPI.traceIdFromandOTelAPI.spanIdFromno longer throw a
FormatExceptionon malformed or wrong-length input: the error is reported
throughOTelErrorHandlingand an invalid (all-zero) id is returned, since
error-handling.md says API methods MUST NOT throw on incorrect use
(#137). -
APISpan.addLinkandAPISpan.addSpanLinknow document that a link given at
span creation is preferred to a later call. The trace/api.md spec makes this
a MUST, because head sampling can only use the information present at span
creation. Comments only, no behavior change
(#133). -
The trace API now documents that
APITracerProvider,APITracerand
APISpanimplementations need to be safe for concurrent use, which
trace/api.md makes a MUST. Comments only, no behavior change
(#120). -
The logs API now documents that
APILoggerProviderandAPILogger
implementations need to be safe for concurrent use, which logs/api.md makes
a MUST. Comments only, no behavior change
(#121). -
Span events with an empty name are dropped and reported to
OTelErrorHandler.
OTelAPI.spanEvent(''),addEvent,addEventNowandaddEventsno longer
throw anArgumentError, per error-handling.md
(#117). -
Empty string and empty array attribute values no longer throw
ArgumentError
(#103). -
Typed
Attributesgetters return null on a type mismatch instead of throwing
StateError, and report it through the error handler
(#106). -
APISpanhonors theisRecordingvalue given at creation, so mutating
operations on a non-recording span are no-ops
(#124). -
APITracer.isEnabled()no longer always returnsfalse. It reports whether
a real SDK factory is installed, so honoringisRecordingno longer makes
every span non-recording
(#124). -
TraceState.putnow moves a new or updated key to the front of the
entries, per the W3C Trace Context rules for mutatingtracestate. This
also fixes overflow trimming, which evicted the newest entry instead of
the oldest.
(#115) -
TraceState.fromStringkeeps only the first entry when a key repeats, which
W3C Trace Context allows one of. A list member with an invalid key or value is
now reported to the error handler instead of being dropped silently. An empty
list member and a whitespace-only list member are dropped without a report,
because the W3C grammar allows them
(#116). -
Without an SDK,
createSpanreturns the parent span directly when it is already
non-recording instead of wrapping it again, per trace/api.md
(#129). -
APITracerbuilds itsInstrumentationScopeonce, from the tracer's own name,
version, schema URL and attributes. Span attributes no longer leak into the
scope, and no version is invented (#129).