Skip to content

Commit fba7ee0

Browse files
committed
Set sampling priority as soon as changed on appsec
1 parent a9f74bd commit fba7ee0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

appsec/src/extension/tags.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,6 @@ void dd_tags_add_tags(
358358
// tag _dd.runtime_family
359359
_set_runtime_family(span);
360360

361-
if (_force_keep) {
362-
dd_trace_set_priority_sampling_on_span_zobj(
363-
span, PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_MANUAL);
364-
mlog(dd_log_debug, "Updated sampling priority to user_keep");
365-
}
366-
367361
if (zend_llist_count(&_appsec_json_frags) == 0) {
368362
if (!server) {
369363
return;
@@ -406,7 +400,19 @@ void dd_tags_add_tags(
406400

407401
void dd_tags_add_blocked() { _blocked = true; }
408402

409-
void dd_tags_set_sampling_priority() { _force_keep = true; }
403+
void dd_tags_set_sampling_priority()
404+
{
405+
if (_force_keep) {
406+
return;
407+
}
408+
409+
zend_object *nullable span = dd_req_lifecycle_get_cur_span();
410+
dd_trace_set_priority_sampling_on_span_zobj(
411+
span, PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_MANUAL);
412+
mlog(dd_log_debug, "Updated sampling priority to user_keep");
413+
414+
_force_keep = true;
415+
}
410416

411417
static void _zend_string_release_indirect(void *s)
412418
{

0 commit comments

Comments
 (0)