Skip to content

Commit ffa797a

Browse files
docs(sdk): Add docs for w3c traceparent support (#14622)
## DESCRIBE YOUR PR Add docs around w3c traceparent support. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent d6b9322 commit ffa797a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

develop-docs/sdk/telemetry/traces/distributed-tracing/index.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes how an SDK should propagate information between differen
66

77
For an overview see [Distributed Tracing](https://docs.sentry.io/product/performance/distributed-tracing/) in the product docs.
88

9-
Sentry uses two containers to hold trace information [`sentry-trace`](/sdk/performance/#header-sentry-trace) and [`baggage`](/sdk/performance/dynamic-sampling-context/#baggage-header).
9+
Sentry uses three containers to hold trace information [`sentry-trace`](/sdk/performance/#header-sentry-trace), [`baggage`](/sdk/performance/dynamic-sampling-context/#baggage-header) and optionally [`traceparent`](/sdk/performance/distributed-tracing/#w3c-trace-context-header).
1010

1111
With these containers you can propagate a trace to a down-stream service by either:
1212
- adding `sentry-trace` and `baggage` HTTP headers (when making outgoing HTTP requests),
@@ -19,3 +19,11 @@ The SDK running in the receiving service needs to make sure to pick up incoming
1919
- reading the environment variables `SENTRY_TRACE` and `SENTRY_BAGGAGE` on startup.
2020

2121
This trace information should be stored in the "propagation context" of the current scope. This makes sure that all telemetry that is emitted from the receiving service to Sentry will include the correct trace information.
22+
23+
## W3C Trace Context Header
24+
25+
To interoperate with OpenTelemetry (OTel) services, SDKs can optionally send the W3C Trace Context `traceparent` HTTP header on outgoing requests in addition to Sentry’s own `sentry-trace` and `baggage`. This enables traces originating from a Sentry SDK to be continued by components that only use OTel/W3C propagation.
26+
27+
The `traceparent` header must only be sent when [`propagateTraceparent`](/sdk/telemetry/traces/#propagatetraceparent) is `true` and the request matches `tracePropagationTargets` (same condition as for `sentry-trace`/`baggage`).
28+
29+
The full spec is available in the [W3C Trace Context](https://www.w3.org/TR/trace-context/) document.

develop-docs/sdk/telemetry/traces/index.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ The `maxSpans` should be implemented as an internal, non-configurable, constant
115115

116116
The `maxSpans` limit may also help avoiding transactions that never finish (in platforms that keep a transaction open for as long as spans are open), preventing OOM errors, and generally avoiding degraded application performance.
117117

118+
119+
### `propagateTraceparent`
120+
121+
This must be a boolean value. The default is `false`. This option is used to enable the propagation of the W3C Trace Context HTTP header `traceparent` on outgoing HTTP requests. This is useful when the receiving services only support OTel/W3C propagation.
122+
123+
The `traceparent` header is only sent when `propagateTraceparent` is `true` and the request matches `tracePropagationTargets` (same condition as for `sentry-trace`/`baggage`).
124+
125+
Header Format:
126+
- Key: `traceparent`
127+
- Value: `00-<traceId>-<spanId>-<sampled>` where `<sampled>` is `01` if sampled, otherwise `00`.
128+
129+
The full spec is available in the [W3C Trace Context](https://www.w3.org/TR/trace-context/) specification.
130+
118131
## `Event` Changes
119132

120133
As of writing, transactions are implemented as an extension of the `Event`

0 commit comments

Comments
 (0)