Skip to content

Sampling flag propagation - #537

Open
arjun-rajappa wants to merge 11 commits into
masterfrom
sampling-flag-propagation
Open

arjun-rajappa wants to merge 11 commits into
masterfrom
sampling-flag-propagation

Conversation

@arjun-rajappa

Copy link
Copy Markdown
Contributor

Why

Sampling decisions (the Instana level, or the W3C sampled flag) were being dropped when a trace crossed async or messaging boundaries. A suppressed trace could therefore resume as sampled downstream. Several instrumentations also ignored W3C traceparent/tracestate or didn't inject them.

What

  • ActiveJob: added extract_context, which keeps level from the Instana payload and falls back to W3C traceparent/tracestate in job.__otel_headers. Removed the TraceParent::REGEXP monkey patch.
  • AWS SNS: inject X_INSTANA_T/S/L message attributes on publish.
  • AWS Lambda: inject X-INSTANA-T/S/L into the client context on invoke. If a client context already exists, merge into it instead of skipping.
  • Bunny: publish traceparent and tracestate. The consumer extracts context from the Instana headers, or from the W3C headers if those are missing.
  • gRPC: the client injects x-instana-l, traceparent and tracestate. The server extracts context from either header set via extract_grpc_context.
  • Rack: when X-Instana-L is absent, derive the level from the W3C sampled bit. X-Instana-L still takes priority.
  • Resque and Sidekiq: propagate level through the job payload and apply it in the worker, defaulting to 1.
  • SpanContext: to_hash now includes level.
  • Tests: added tests for each instrumentation above.
  • RuboCop: added rubocop:disable comments for the gRPC block length and the AwsTest class length, and renamed test_w3c_sampled_flag_sets_level_1 to ..._level_one.

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
…d consume

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
…server

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
Keep only the newest run of each workflow name and the latest attempt of
each job, so reruns no longer fail the coverage report or mix in stale
results. Also accept an optional WORKFLOW_ID to resolve the pipeline,
exit early when the pipeline or workflows cannot be found, and skip jobs
without a coverage artifact.

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
@sonarqubecloud

Copy link
Copy Markdown

@arjun-rajappa
arjun-rajappa requested a review from a team October 13, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant