otel_tracer: stale b3 header forwarded upstream

Đang mở
#14,177 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
67/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
networking

Hướng nghiên cứu

Read plugins/experimental/otel_tracer/otel_tracer.cc around the incoming B3 header handling and outbound request header writing, plus plugins/experimental/otel_tracer/tracer_common.h where the propagator is selected. Reproduce the single-header b3 case and check how the origin receives propagation headers. Done when the outgoing headers consistently identify the ATS span as the origin's parent; the issue leaves the choice of propagation format open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug otel_tracer

Ran into a tracing bug while testing otel_tracer with single-header b3 requests.

When a request comes in with a single b3 header, ATS reads b3 into parent_headers and starts its span as a child of the client span just fine. The problem is what goes out to the origin. tracer_common.h wires up B3PropagatorMultiHeader, so otel_tracer.cc writes X-B3-TraceId, X-B3-SpanId, and X-B3-Sampled onto the request and leaves the old b3 header sitting there. Now the upstream request has both formats, and they don't match.

That breaks the trace chain downstream. In opentelemetry-cpp 1.19.0, and per the B3 spec, the extractor checks b3 first and ignores X-B3-* if b3 is present. So a B3 origin grabs the client's span ID out of the stale b3 header and skips right past ATS. You end up with ATS hanging off to the side as a sibling instead of sitting between the client and the origin.

I tested this on Ubuntu 24.04 with Traffic Server 11.0.0 built from master, opentelemetry-cpp 1.19.0, protobuf 3.21.12, and nlohmann-json 3.11.3. I sent b3: 463ac35c9f6413ad48485a3953bb6124-a2fb4a1d1a96d312-1 through ATS with otel_tracer.so enabled. ATS exported span 3aa4178cab7d8bf9 with parent a2fb4a1d1a96d312, and the origin got these B3 headers:

b3: 463ac35c9f6413ad48485a3953bb6124-a2fb4a1d1a96d312-1
X-B3-Sampled: 1
X-B3-SpanId: 3aa4178cab7d8bf9
X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124

When I ran opentelemetry-cpp 1.19.0's B3 extractor on those exact headers, it returned span_id=a2fb4a1d1a96d312 instead of 3aa4178cab7d8bf9. Requests that already come in as multi-header X-B3-* work fine since set_request_header overwrites them.

Dropping the incoming b3 header before writing X-B3-* would stop the stale header from winning, or the plugin could inject single-header b3 when that's what came in. Happy to put up a PR if you have a preference between the two.

Ngôn ngữ chính
C++
Star
2k
Fork
903
Merge trung bình
4 ngày 4 giờ
Pull request đã merge (30 ngày)
135

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/trafficserver

Tất cả issue của apache/trafficserver

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.