Skip to content
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

Let standard limiters to work when standalone not enabled #3001

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions appsec/tests/extension/client_init_record_span_tags.phpt
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ Array
(
[_dd.appsec.json] => {"triggers":[{"found":"attack"},{"another":"attack"},{"yet another":"attack"}]}
[_dd.p.appsec] => 1
[_dd.p.dm] => -5
[_dd.p.dm] => -0
[_dd.p.tid] => %s
[_dd.runtime_family] => php
[appsec.event] => true
@@ -107,7 +107,8 @@ Array
[metric_1] => 2
[metric_2] => 10
[_dd.appsec.enabled] => 1
[_sampling_priority_v1] => 2
[_dd.agent_psr] => 1
[_sampling_priority_v1] => 1
[php.compilation.total_time_ms] => %f
[php.memory.peak_usage_bytes] => %f
[php.memory.peak_real_usage_bytes] => %f
5 changes: 3 additions & 2 deletions appsec/tests/extension/rinit_record_span_tags.phpt
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ Array
(
[_dd.appsec.json] => {"triggers":[{"found":"attack"},{"another":"attack"},{"yet another":"attack"}]}
[_dd.p.appsec] => 1
[_dd.p.dm] => -5
[_dd.p.dm] => -0
[_dd.p.tid] => %s
[_dd.runtime_family] => php
[appsec.event] => true
@@ -100,7 +100,8 @@ Array
[%s] => %d
[rshutdown_metric] => 2.1
[_dd.appsec.enabled] => 1
[_sampling_priority_v1] => 2
[_dd.agent_psr] => 1
[_sampling_priority_v1] => 1
[php.compilation.total_time_ms] => %f
[php.memory.peak_usage_bytes] => %f
[php.memory.peak_real_usage_bytes] => %f
6 changes: 5 additions & 1 deletion ext/asm_event.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "asm_event.h"

#include "configuration.h"
#include "ddtrace.h"
#include "priority_sampling/priority_sampling.h"
#include "tracer_tag_propagation/tracer_tag_propagation.h"
@@ -24,7 +26,9 @@ DDTRACE_PUBLIC void ddtrace_emit_asm_event() {
ZVAL_STR(&_1_zval, _1_zstr);
ddtrace_add_propagated_tag(_dd_tag_p_appsec_zstr, &_1_zval);

ddtrace_set_priority_sampling_on_root(PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_ASM);
if (get_DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED()) {
ddtrace_set_priority_sampling_on_root(PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_ASM);
}
}

PHP_FUNCTION(DDTrace_Testing_emit_asm_event) {
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ Distributed tracing header tags propagate asm events with curl_exec()
--ENV--
DD_TRACE_TRACED_INTERNAL_FUNCTIONS=curl_exec
HTTP_X_DATADOG_TRACE_ID=42
DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED=1
--FILE--
<?php