-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(axiom): handle locale for dt w3c priority (#828)
Account for locale differences when generating the DT w3c tracestate header. Mitigates a risk against unexpected locale settings using `,` rather than `.` for the decimal priority value breaking the PHP Agent's DT w3c handling. --------- Co-authored-by: Michal Nowacki <[email protected]>
- Loading branch information
1 parent
2cd020e
commit 4746cca
Showing
11 changed files
with
104 additions
and
3 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
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
37 changes: 37 additions & 0 deletions
37
tests/integration/distributed_tracing/w3c/test_insert_dt_headers_locale.php
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,37 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Tests that the locale is handled correctly in w3c dt tracestate header | ||
priority for locales that use `,` instead of `.` for decimal values | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled = true | ||
newrelic.distributed_tracing_exclude_newrelic_header = false | ||
newrelic.cross_application_tracer.enabled = false | ||
*/ | ||
|
||
/*EXPECT | ||
ok - insert function succeeded | ||
ok - preexisting header is present | ||
ok - newrelic header is present | ||
ok - tracestate header is present | ||
ok - traceparent header is present | ||
ok - locale handled correctly for w3c dt priority | ||
*/ | ||
|
||
require_once(realpath (dirname ( __FILE__ )) . '/../../../include/tap.php'); | ||
|
||
$headers = array('Accept-Language' => 'en-US,en;q=0.5'); | ||
setlocale(LC_NUMERIC, 'fr_FR'); | ||
tap_assert(newrelic_insert_distributed_trace_headers($headers), 'insert function succeeded'); | ||
tap_assert(array_key_exists('Accept-Language', $headers), 'preexisting header is present'); | ||
tap_assert(array_key_exists('newrelic', $headers), 'newrelic header is present'); | ||
tap_assert(array_key_exists('tracestate', $headers), 'tracestate header is present'); | ||
tap_assert(array_key_exists('traceparent', $headers), 'traceparent header is present'); | ||
tap_refute(strpos($headers['tracestate'], ','), 'locale handled correctly for w3c dt priority'); | ||
|