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

未关闭
#4,793 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

  • #4794 来自 @vitaly-krugl —— 已关闭,未合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

从 B3MultiFormat 类开始,跟踪提取过程如何处理不带 X-B3-Sampled header 的 carrier。当应用程序可以选择 receiver 的默认采样决策,同时显式的 B3 采样值保持现有行为时,此更改即完成;该 issue 引用了 pull request #4794。

由索引模型根据 Issue 内容生成。

描述

bug

Here is the pull request: #4794

Describe your environment

OS: ALL (Ubuntu, OS X, etc.)
Python version: ALL Python 3x - Python 3.9 and later.
Package version: 1.37.0

What happened?

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

The Zipkin/B3 protocol - https://github.com/openzipkin/b3-propagation - leaves the sampling decision up to the receiver whenever it doesn't receive the "X-B3-Sampled" HTTP header:

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 "X-B3-Sampled" as if "X-B3-Sampled: 0", not giving the application an opportunity to make this decision. The class B3MultiFormat does not provide the means for an application to specify it's preference for the default behavior when "X-B3-Sampled" is not received

Steps to Reproduce

Instantiate B3MultiFormat and observe that the class does't offer any parameters or alternate mechanism to specify the default behavior in the event that explicit sampling state (e.g. "X-B3-Sampled") is absent from carrier.

Expected Result

A mechanism in B3MultiFormat to allow the application to decide the desired sampled state in the event that "X-B3-Sampled" is not received.

Actual Result

B3MultiFormat always drops the received "X-B3-TraceId" and "X-B3-SpanId" whenever "X-B3-Sampled" is not received.

This contradicts the Zipkin/B3 protocol specification which explicitly leaves the sampling decision up to the receiver whenever it doesn't receive the "X-B3-Sampled" HTTP header:

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.

Additional context
Would you like to implement a fix?

Yes: Here is the pull request: #4794

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

主要语言
Python
星标
2.7k
派生
1.1k
平均合并
3 天 12 小时
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-telemetry/opentelemetry-python 的其他 Issue

查看 open-telemetry/opentelemetry-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。