Skip to content

feat(tracing): declare 100% sampling (ot=th:0) on every span - #52

Merged
ETWOYA merged 2 commits into
mainfrom
friday/pbi-3317-declare-th0
Sep 18, 2026
Merged

ETWOYA merged 2 commits into
mainfrom
friday/pbi-3317-declare-th0

Conversation

@dankoverride

Copy link
Copy Markdown
Collaborator

What changed

Every span Snowglobe emits now carries the W3C tracestate entry ot=th:0: the OpenTelemetry probability-sampling threshold of zero, which means nothing was sampled away.

  • declaredFullSampler (cmd/snowglobe/sampler.go): records and samples every span, which is what the default sampler already did, and writes ot=th:0 into the span's tracestate. It starts from the parent's tracestate, keeps other ot sub-keys (such as rv) and every other vendor's entry, and moves ot to the front as W3C requires for a modified member.
  • newProvider (cmd/snowglobe/main.go): each service instance's tracer provider uses the new sampler.

Why

A backend cannot tell a complete trace stream from a sampled one unless the stream says so. With the threshold declared, a span that is missing on purpose (for example, a consumer that never ran) reads as genuinely missing rather than as possibly unsampled.

Tests

New tests cover root spans, child spans (including a child started from a different tracer provider using the parent's context), existing vendor entries (foo=bar becomes ot=th:0,foo=bar), existing ot values (rv:abc123 becomes th:0;rv:abc123, th:8 becomes th:0), and that every span in a run is still recorded and sampled. go vet ./... is clean and go test ./... passes.

AB#3317

🤖 Generated with Claude Code

Every span now carries the OpenTelemetry sampling threshold th:0 in its
tracestate, so a backend can tell a complete trace stream from a sampled one.
A consumer that is deliberately missing then reads as missing, not unsampled.

AB#3317

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… (errcheck)

AB#3317

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ETWOYA
ETWOYA merged commit 047901b into main Sep 18, 2026
4 checks passed
@ETWOYA
ETWOYA deleted the friday/pbi-3317-declare-th0 branch September 18, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants