New - expand trace flags and temp workaround for upstream bug.#460
Merged
cleverchuk merged 4 commits intomainfrom Apr 10, 2026
Merged
New - expand trace flags and temp workaround for upstream bug.#460cleverchuk merged 4 commits intomainfrom
cleverchuk merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes loss of X-Trace-Options on root spans due to an upstream OTel SDK context handling bug, expands trace-flags handling to support full W3C hex-byte semantics, pins Netty for CVE remediation, and parallelizes a CI smoke-test job.
Changes:
- Add a
ThreadLocal“side channel” (PropagatedContext) populated duringextract()and consumed bySolarwindsSampleras a fallback for root-span sampling. - Replace hardcoded
"00"/"01"flag logic withTraceFlags.asHex()and relaxswtracestate validation to accept any 2-hex-char byte. - Pin Netty via BOM, update smoke tests (Java + k6) to accept/interpret full hex-byte trace flags, and adjust CI job dependencies to increase parallelism.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| smoke-tests/src/test/java/com/solarwinds/SmokeTestV2.java | Updates log regex to accept any 2-hex-char trace_flags. |
| smoke-tests/src/test/java/com/solarwinds/SmokeTest.java | Updates log regex to accept any 2-hex-char trace_flags. |
| smoke-tests/k6/basic.js | Updates sampled/not-sampled checks to use W3C bitwise semantics. |
| libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SolarwindsSamplerTest.java | Adds coverage for root-span sampler fallback to PropagatedContext. |
| libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SolarwindsContextPropagatorTest.java | Adds coverage that extract() populates PropagatedContext. |
| libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/SamplingUtilTest.java | Extends tests for tracestate flag validation beyond 00/01. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsSampler.java | Reads XtraceOptions from PropagatedContext fallback and clears it in finally. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsContextPropagator.java | Injects full hex-byte flags into sw tracestate and sets PropagatedContext on extract. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SamplingUtil.java | Validates sw tracestate flags as any 2-hex-char byte. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/ResponseHeaderCustomizer.java | Emits X-Trace using TraceFlags.asHex() instead of 00/01. |
| libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/PropagatedContext.java | Introduces ThreadLocal holder for propagated XtraceOptions. |
| libs/sampling/src/main/java/com/solarwinds/joboe/sampling/XtraceOptions.java | Adds Lombok @ToString for debug visibility. |
| libs/sampling/src/main/java/com/solarwinds/joboe/sampling/TraceDecision.java | Adds Lombok @ToString for debug visibility. |
| dependencyManagement/build.gradle.kts | Adds Netty BOM pin to 4.1.132.Final. |
| .github/workflows/push.yml | Changes smoke-test job dependency to run in parallel with other release checks. |
jerrytfleung
reviewed
Apr 9, 2026
8b3a37d to
7337201
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an OTel SDK bug that silently drops
X-Trace-Optionsfor root spans, updates trace flag handling to support the full W3C hex byte spec instead of only00/01, pins Netty to 4.1.132.Final to address a CVE-2026-33871, and parallelizes the release smoke test in CI.Changes
ThreadLocal fallback for
XtraceOptionspropagationThe OTel SDK has a bug (opentelemetry-java#8012) where it replaces the parent
ContextwithContext.root()when constructing root spans. This discards anyXtraceOptionsplaced in the context duringextract(), causing trigger-trace and custom KVs from theX-Trace-Optionsheader to be silently lost.A new
PropagatedContextclass storesXtraceOptionsin aThreadLocalas a side-channel. This is safe because the OTel agent'sPropagatingFromUpstreamInstrumenter.start()callsextract()andshouldSample()synchronously in the same method — no async gap, no thread switch — across all server instrumentations (Servlet, Netty, WebFlux, gRPC). The sampler reads from theThreadLocalonly when the context-based lookup returns null, and unconditionally clears it in afinallyblock.Trace flags handling
Previously, trace flags were hardcoded to
"00"or"01"(sampled/not-sampled). The W3C trace context spec defines trace flags as a full hex byte, and upstream OTel now emits values beyond01(e.g.,02,03). Changes:isSampled() ? "01" : "00"withgetTraceFlags().asHex()in the context propagator and response header customizerswtracestate flag validation from exact"00"/"01"to a two-character hex patternparseInt(flag, 16) & 1) instead of exact string comparison to determine sampled status, matching the W3C spec where bit 0 indicates the sampled flagNetty BOM for CVE remediation
Adds the Netty BOM (
io.netty:netty-bom:4.1.132.Final) to centralized dependency management, pinning all transitive Netty dependencies to a version that addresses CVE-2026-33871.CI: parallelize release smoke test
The release smoke test job now depends on
s3-stage-uploadinstead ofrelease-test, removing the serial dependency and allowing it to run in parallel.Misc
@ToString(Lombok) toTraceDecisionandXtraceOptionsfor better debug loggingTest services data