-
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 128-bit trace id generation and propagation via _dd.p.tid (#1875)
* Add 128 bit trace_id generation and propagation via _dd.p.tid Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> * Save start time as seconds on the highest 32 bits of the trace_id Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> * Apply suggestions from review Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> --------- Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
- Loading branch information
Showing
8 changed files
with
78 additions
and
9 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
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
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,38 @@ | ||
--TEST-- | ||
Test 128 bit generation | ||
--ENV-- | ||
DD_TRACE_GENERATE_ROOT_SPAN=0 | ||
--FILE-- | ||
<?php | ||
|
||
ini_set("datadog.trace.128_bit_traceid_generation_enabled", "1"); | ||
DDTrace\start_span(); | ||
var_dump(\DDTrace\trace_id() > 2 ** 64); | ||
|
||
ini_set("datadog.trace.128_bit_traceid_generation_enabled", "0"); | ||
DDTrace\set_distributed_tracing_context(0, 0); | ||
var_dump(\DDTrace\trace_id() < 2 ** 64); | ||
|
||
ini_set("datadog.trace.128_bit_traceid_generation_enabled", "1"); | ||
DDTrace\set_distributed_tracing_context(0, 0); | ||
var_dump(\DDTrace\trace_id() > 2 ** 64); | ||
$first_trace_id = \DDTrace\trace_id(); | ||
DDTrace\close_span(); | ||
|
||
ini_set("datadog.trace.128_bit_traceid_generation_enabled", "0"); | ||
DDTrace\start_span(); | ||
var_dump(\DDTrace\trace_id() < 2 ** 64); | ||
DDTrace\close_span(); | ||
|
||
$spans = dd_trace_serialize_closed_spans(); | ||
var_dump(!isset($spans[0]["meta"]["_dd.p.tid"])); | ||
var_dump(hexdec($spans[1]["meta"]["_dd.p.tid"]) == floor($spans[1]["start"] / 1000000000) * (1 << 32)); | ||
|
||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) |
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