-
Notifications
You must be signed in to change notification settings - Fork 167
Adds process_tags to live crashtracking tags #3582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dubloom
wants to merge
14
commits into
master
Choose a base branch
from
dubloom/process-tags-crashtracking
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+74
−0
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4f6193a
init process tags for APM
dubloom 1046984
feat(process_tags): add process_tags to tracing payloads
dubloom 6501e1e
small auto review and fix test
dubloom 127c555
bwoebi review
dubloom 0bb55a1
Merge branch 'master' into dubloom/process-tags
dubloom 3a8038c
fix test
dubloom 7c56e32
Merge branch 'master' into dubloom/process-tags
dubloom ab3fbea
adds process tags to crashtracker tags
dubloom de48e39
Merge branch 'master' into dubloom/process-tags
dubloom 67e08df
Move process tags assign
bwoebi 89c75b2
Merge branch 'master' into dubloom/process-tags
dubloom 31f4a49
Merge branch 'dubloom/process-tags' into dubloom/process-tags-crashtr…
dubloom dae6e43
auto review
dubloom 6f0ea77
Merge branch 'master' into dubloom/process-tags-crashtracking
dubloom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,68 @@ | ||
| --TEST-- | ||
| [crasht] process tags are attached to crash report | ||
| --SKIPIF-- | ||
| <?php | ||
| if (!extension_loaded('posix')) die('skip: posix extension required'); | ||
| if (getenv('SKIP_ASAN') || getenv('USE_ZEND_ALLOC') === '0') die("skip: intentionally causes segfaults"); | ||
| if (getenv('PHP_PEAR_RUNTESTS') === '1') die("skip: pecl run-tests does not support %A in EXPECTF"); | ||
| if (getenv('DD_TRACE_CLI_ENABLED') === '0') die("skip: tracer is disabled"); | ||
| include __DIR__ . '/includes/skipif_no_dev_env.inc'; | ||
| ?> | ||
| --ENV-- | ||
| DD_TRACE_LOG_LEVEL=0 | ||
| DD_AGENT_HOST=request-replayer | ||
| DD_TRACE_AGENT_PORT=80 | ||
| DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED=1 | ||
| --INI-- | ||
| datadog.trace.agent_test_session_token=tests/ext/crashtracker_process_tags.phpt | ||
| --FILE-- | ||
| <?php | ||
|
|
||
| include __DIR__ . '/includes/request_replayer.inc'; | ||
| $rr = new RequestReplayer(); | ||
| $rr->replayRequest(); // cleanup possible leftover | ||
|
|
||
| usleep(100000); // Let time to the sidecar to open the crashtracker socket | ||
|
|
||
| posix_setrlimit(POSIX_RLIMIT_CORE, 0, 0); | ||
|
|
||
| $php = getenv('TEST_PHP_EXECUTABLE'); | ||
| $args = getenv('TEST_PHP_ARGS')." ".getenv("TEST_PHP_EXTRA_ARGS"); | ||
| $cmd = $php." ".$args." -r 'posix_kill(posix_getpid(), 11);'"; | ||
| system($cmd); | ||
|
|
||
| $rr->waitForRequest(function ($request) { | ||
| if ($request["uri"] != "/telemetry/proxy/api/v2/apmtelemetry") { | ||
| return false; | ||
| } | ||
| $body = json_decode($request["body"], true); | ||
| if ($body["request_type"] != "logs" || !isset($body["payload"][0]["message"])) { | ||
| return false; | ||
| } | ||
|
|
||
| foreach ($body["payload"] as $payload) { | ||
| $payload["message"] = json_decode($payload["message"], true); | ||
| if (!isset($payload["message"]["metadata"])) { | ||
| break; | ||
| } | ||
|
|
||
| $output = json_encode($payload, JSON_PRETTY_PRINT); | ||
| echo $output; | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| }); | ||
| ?> | ||
| --EXPECTF-- | ||
| %A{ | ||
| "message": { | ||
| %A | ||
| "metadata": { | ||
| "library_name": "dd-trace-php", | ||
| "library_version": "%s", | ||
| "family": "php", | ||
| "tags": [%A | ||
| "process_tags:entrypoint.name:standard_input_code,entrypoint.type:script,entrypoint.workdir:%s,runtime.sapi:cli"%A | ||
| }%A |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to update this once #3580 is merged