Skip to content

Commit

Permalink
Let standard limiters to work when standalone not enabled (#3001)
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana authored Dec 18, 2024
1 parent 620af85 commit 0d57b55
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
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
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions appsec/tests/extension/rinit_record_span_tags.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
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"
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0d57b55

Please sign in to comment.