-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support b3 (zipkin) OpenTelemetry trace propagation headers #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I can't recall how the active propagator is selected, or if they're all just propagated, or something else... Might be worth having a quick description in the PR, or in a tracing section of the README. No blockers for merging.
CHANGELOG.md
Outdated
## 4.5.0 | ||
- Support b3 (zipkin) OpenTelemetry trace propagation headers ([#28](https://github.com/hasura/ndc-sdk-typescript/pull/28)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, might be good to link to the impl or spec for this format.
// This logs the parent span ID in the pino logs, useful for debugging propagation. | ||
// parentSpanId is an internal property, hence the cast to any, because I can't | ||
// seem to find a way to get at it through a supported API 😭 | ||
record["parent_span_id"] = (span as any).parentSpanId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat and Tidy 👍
textMapPropagator: new CompositePropagator({ | ||
propagators: [ | ||
new W3CTraceContextPropagator(), | ||
new W3CBaggagePropagator(), | ||
new B3Propagator(), | ||
new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }), | ||
] | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the active propagator selected again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're not "selected", they are run in sequence and effectively mutate the tracing context, so the last one wins.
This PR adds support for the b3 (zipkin) OpenTelemetry trace propagation headers. The old default was
tracecontext
andbaggage
, now we've extended that withb3
andb3-multi
by manually configuring the propagators ininstrumentation.ts
.Propagators are run in order and each contributes to the trace context. This means if multiple tracing header formats are provided in the request, the last configured propagator for the appropriate formats wins.
In addition:
This PR makes a similar change to the one in the Rust SDK.