-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Add support for W3C traceparent header #1680
Conversation
} | ||
|
||
if (isset($matches['sampled'])) { | ||
$context->parentSampled = $matches['sampled'] === '01'; |
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.
https://www.w3.org/TR/trace-context/#trace-flags
While this is a hex-encoded bit field, I think we can get away with just checking for 01
, as the other values are either 00
or omitting it altogether.
$sampled = $this->sampled ? '-01' : '-00'; | ||
} | ||
|
||
return sprintf('00-%s-%s%s', (string) $this->traceId, (string) $this->spanId, $sampled); |
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.
https://www.w3.org/TR/trace-context/#version-format
Hardcoding the version to 00 seems to be okay.
getsentry/team-sdks#41