-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a DDTrace\generate_distributed_tracing_headers() function
It's a direct opposite function to consume_distributed_tracing_headers, thereby trivially enabling users to use it for custom propoagation and later consumption. Also needed for easy testing of parametric tests. Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
- Loading branch information
Showing
4 changed files
with
72 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/ext/distributed_tracing/distributed_trace_generate.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Test generate_distributed_tracing_headers() | ||
--ENV-- | ||
HTTP_X_DATADOG_TRACE_ID=42 | ||
HTTP_X_DATADOG_PARENT_ID=10 | ||
HTTP_X_DATADOG_ORIGIN=datadog | ||
HTTP_X_DATADOG_SAMPLING_PRIORITY=3 | ||
DD_TRACE_GENERATE_ROOT_SPAN=0 | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(DDTrace\generate_distributed_tracing_headers()); | ||
|
||
?> | ||
--EXPECT-- | ||
array(6) { | ||
["x-datadog-sampling-priority"]=> | ||
string(1) "3" | ||
["x-datadog-origin"]=> | ||
string(7) "datadog" | ||
["x-datadog-trace-id"]=> | ||
string(2) "42" | ||
["x-datadog-parent-id"]=> | ||
string(2) "10" | ||
["traceparent"]=> | ||
string(55) "00-0000000000000000000000000000002a-000000000000000a-01" | ||
["tracestate"]=> | ||
string(16) "dd=o:datadog;s:3" | ||
} |