opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

NEED FEEDBACK FROM MAINTAINERS Addressing issue #4793 - allow app to control b3-propagator sampling decision when no sampling state in carrier from remote

Open vitaly-krugl opened this issue 1 month ago • 1 comments

Description

WORK IN PROGRESS - requesting acceptance feasibility feedback from maintainers before proceeding with additional unit tests.

Fixes #4793 opentelemetry-propagator-b3 doesn't allow the receiver to make sampling decision when X-B3-Sampled header is absent.

This issue is somewhat unique to Zipkin/B3 because it treats sampling state in HTTP headers as optional. Hence, the solution is specific to B3. By contrast, the sampling state is required in W3C Trace Context, and no such solution is necessary for W3C support.

The Zipkin/B3 protocol - https://github.com/openzipkin/b3-propagation - leaves the sampling decision up to the receiver whenever it doesn't receive an explicit sampling state from remote in the carrier:

An accept sampling decision is encoded as X-B3-Sampled: 1 and a deny as X-B3-Sampled: 0. Absent means defer the decision to the receiver of this header.

However, opentelemetry-propagator-b3 incorrectly hard-codes absent sampling state to OFF, not giving the application an opportunity to make this decision. The class B3MultiFormat does not provide the means for an application to specify its preference for the default behavior when sampling state is not received from remote

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] Not tested yet - work in progress to get feedback

Does This PR Require a Contrib Repo Change?

  • [x] No.

Checklist:

  • [ ] Followed the style guidelines of this project

vitaly-krugl avatar Oct 31 '25 04:10 vitaly-krugl

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: vitaly-krugl / name: Vitaly Kruglikov (a2faf10ab1ce709e1cb581c62567d29f0d5b498c)