-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is a new configuration called `DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED`(default: `false`) which disable APM. When `DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED` is enabled, traces will be only sent under the following conditions: - There is an ASM event - One APM trace will be sent as a heartbeat at least once a minute in the absence of ASM events. This is done to keep the service alive on the backend and avoid it gets into degraded mode. Since the tracing engine is coupled to the tracer extension, it will be required that `DD_TRACE_ENABLED` is set to `true`. However `DD_TRACE_ENABLED` being enabled does not mean APM is.
- Loading branch information
1 parent
978658e
commit 0926c77
Showing
39 changed files
with
1,278 additions
and
205 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
66 changes: 66 additions & 0 deletions
66
appsec/tests/extension/rinit_asm_events_propagate_tags.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,66 @@ | ||
--TEST-- | ||
Asm events are added as meta tags and also as propagated tags | ||
--INI-- | ||
extension=ddtrace.so | ||
datadog.appsec.log_file=/tmp/php_appsec_test.log | ||
datadog.appsec.log_level=debug | ||
datadog.appsec.enabled=1 | ||
--ENV-- | ||
HTTP_X_DATADOG_TRACE_ID=42 | ||
HTTP_X_DATADOG_PARENT_ID=10 | ||
HTTP_X_DATADOG_ORIGIN=datadog | ||
HTTP_X_DATADOG_TAGS=_dd.p.custom_tag=inherited,_dd.p.second_tag=bar | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\{rinit,rshutdown,ddtrace_rshutdown,root_span_get_meta}; | ||
include __DIR__ . '/inc/ddtrace_version.php'; | ||
|
||
ddtrace_version_at_least('0.79.0'); | ||
|
||
include __DIR__ . '/inc/mock_helper.php'; | ||
|
||
$helper = Helper::createInitedRun([ | ||
response_list(response_request_init([[['record', []]], ['{"found":"attack"}','{"another":"attack"}']])), | ||
response_list( | ||
response_request_shutdown( | ||
[[['record', []]], ['{"yet another":"attack"}'], false, ["rshutdown_tag" => "rshutdown_value"], ["rshutdown_metric" => 2.1]] | ||
) | ||
), | ||
], ['continuous' => true]); | ||
|
||
echo "rinit\n"; | ||
var_dump(rinit()); | ||
$helper->get_commands(); //ignore | ||
|
||
$context = DDTrace\current_context(); | ||
echo "_dd.p.appsec on distributed propagated tags? "; | ||
echo isset($context['distributed_tracing_propagated_tags']['_dd.p.appsec']) && $context['distributed_tracing_propagated_tags']['_dd.p.appsec'] == 1 ? "Yes": "No"; | ||
echo PHP_EOL; | ||
|
||
echo "rshutdown\n"; | ||
var_dump(rshutdown()); | ||
$helper->get_commands(); //ignore | ||
|
||
echo "ddtrace_rshutdown\n"; | ||
var_dump(ddtrace_rshutdown()); | ||
dd_trace_internal_fn('synchronous_flush'); | ||
|
||
$commands = $helper->get_commands(); | ||
$tags = $commands[0]['payload'][0][0]['meta']; | ||
|
||
echo "_dd.p.appsec? "; | ||
echo isset($tags['_dd.p.appsec']) && $tags['_dd.p.appsec'] === "1" ? "Yes": "No"; | ||
echo PHP_EOL; | ||
|
||
$helper->finished_with_commands(); | ||
|
||
?> | ||
--EXPECTF-- | ||
rinit | ||
bool(true) | ||
_dd.p.appsec on distributed propagated tags? Yes | ||
rshutdown | ||
bool(true) | ||
ddtrace_rshutdown | ||
bool(true) | ||
_dd.p.appsec? Yes |
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
Oops, something went wrong.