Skip to content

Comments

Add support for W3C traceparent header#1680

Merged
cleptric merged 4 commits intomasterfrom
traceparent
Jan 18, 2024
Merged

Add support for W3C traceparent header#1680
cleptric merged 4 commits intomasterfrom
traceparent

Conversation

@cleptric
Copy link
Member

}

if (isset($matches['sampled'])) {
$context->parentSampled = $matches['sampled'] === '01';
Copy link
Member Author

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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cleptric cleptric marked this pull request as ready for review January 18, 2024 09:48
@cleptric cleptric requested a review from stayallive January 18, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants