-
Notifications
You must be signed in to change notification settings - Fork 805
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
fix: add type checking in propagators #904
fix: add type checking in propagators #904
Conversation
@jordanworner would appreciate you taking a look at this. |
@@ -66,7 +66,6 @@ export class B3Propagator implements HttpTextPropagator { | |||
const traceIdHeader = getter(carrier, X_B3_TRACE_ID); | |||
const spanIdHeader = getter(carrier, X_B3_SPAN_ID); | |||
const sampledHeader = getter(carrier, X_B3_SAMPLED); | |||
if (!traceIdHeader || !spanIdHeader) return context; | |||
const traceId = Array.isArray(traceIdHeader) |
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.
The root of this issue was that Array.isArray
turns our unknown
into an any
which made the type system not complain like we would have expected.
Codecov Report
@@ Coverage Diff @@
## master #904 +/- ##
==========================================
- Coverage 92.85% 92.60% -0.25%
==========================================
Files 244 243 -1
Lines 10982 10954 -28
Branches 1067 1084 +17
==========================================
- Hits 10197 10144 -53
- Misses 785 810 +25
|
@dyladan I applied your fix and retested my gRPC server using both the b3 and trace context propagators and that seems to have fixed it. Requests now work with or without the parent metadata. |
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.
LGTM, It would be nice if you can test.
Trying to figure out a good way to test |
@mayurkale22 added tests |
Fixes #903