-
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.
[loader] Assign an appropriate tag to each type of error (#2985)
* Assign an appropriate tag to each type of error * Update loader/dd_library_loader.c Co-authored-by: Florian Engelhardt <[email protected]> --------- Co-authored-by: Florian Engelhardt <[email protected]>
- Loading branch information
1 parent
b0da77f
commit b928df9
Showing
4 changed files
with
126 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
require_once __DIR__."/includes/autoload.php"; | ||
skip_if_php5(); | ||
|
||
$telemetryLogPath = tempnam(sys_get_temp_dir(), 'test_loader_'); | ||
|
||
$output = runCLI('-v', true, [ | ||
'FAKE_FORWARDER_LOG_PATH='.$telemetryLogPath, | ||
'DD_TELEMETRY_FORWARDER_PATH='.__DIR__.'/../../bin/fake_forwarder.sh', | ||
'DD_LOADER_PACKAGE_PATH=/foo/bar' | ||
]); | ||
|
||
// Let time to the fork to write the telemetry log | ||
usleep(5000); | ||
|
||
$raw = file_get_contents($telemetryLogPath); | ||
$payload = json_decode($raw, true); | ||
|
||
$format = <<<EOS | ||
{ | ||
"metadata": { | ||
"runtime_name": "php", | ||
"runtime_version": "%d.%d.%d%S", | ||
"language_name": "php", | ||
"language_version": "%d.%d.%d%S", | ||
"tracer_version": "%s", | ||
"pid": %d | ||
}, | ||
"points": [ | ||
{ | ||
"name": "library_entrypoint.error", | ||
"tags": [ | ||
"error_type:so_not_found" | ||
] | ||
} | ||
] | ||
} | ||
EOS; | ||
|
||
assertMatchesFormat(json_encode($payload, JSON_PRETTY_PRINT), $format); |