feat: use specific W3CTraceContextPropagator for OTel by feywind · Pull Request #2036 · googleapis/nodejs-pubsub · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

feat: use specific W3CTraceContextPropagator for OTel #2036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025

Conversation

feywind
Copy link
Collaborator

@feywind feywind commented May 6, 2025

Replaces the use of the global OpenTelemetry propagator (propagation) with a specific instance of W3CTraceContextPropagator within the telemetry-tracing.ts module.

This ensures that trace context propagation for Pub/Sub messages always uses the W3C format via the googclient_traceparent attribute, regardless of the global propagator configured by user code. This maintains consistent tracing behaviour as it moves between library instances as a Pub/Sub attribute.

Fixes #2005 🦕

Replaces the use of the global OpenTelemetry propagator (`propagation`)
with a specific instance of `W3CTraceContextPropagator` within the
`telemetry-tracing.ts` module.

This ensures that trace context propagation for Pub/Sub messages always
uses the W3C format via the `googclient_traceparent` attribute,
regardless of the global propagator configured by your code. This is
important for maintaining consistent tracing behavior, especially when
context is passed through non-HTTP transports used by the library.

The change involves:
- Importing `W3CTraceContextPropagator` from `@opentelemetry/core`.
- Instantiating the propagator.
- Updating `injectSpan` and `extractSpan` to use the specific instance.

Existing tests pass without modification as they implicitly relied on
the W3C propagator behavior via the test setup's `BasicTracerProvider`.
@feywind feywind requested review from a team as code owners May 6, 2025 21:49
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: pubsub Issues related to the googleapis/nodejs-pubsub API. labels May 6, 2025
@feywind feywind added owlbot:ignore instruct owl-bot to ignore a PR owlbot:run Add this label to trigger the Owlbot post processor. and removed owlbot:ignore instruct owl-bot to ignore a PR labels May 8, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 8, 2025
@feywind feywind merged commit c9a9656 into googleapis:main May 8, 2025
14 of 15 checks passed
@feywind feywind deleted the feat-otel-w3c-propagator branch May 8, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenTelemetry support needs to use its own context propagator
2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.