Skip to content

Commit

Permalink
Set sampling priority as soon as changed on appsec
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Nov 8, 2024
1 parent a9f74bd commit fba7ee0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions appsec/src/extension/tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@ void dd_tags_add_tags(
// tag _dd.runtime_family
_set_runtime_family(span);

if (_force_keep) {
dd_trace_set_priority_sampling_on_span_zobj(
span, PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_MANUAL);
mlog(dd_log_debug, "Updated sampling priority to user_keep");
}

if (zend_llist_count(&_appsec_json_frags) == 0) {
if (!server) {
return;
Expand Down Expand Up @@ -406,7 +400,19 @@ void dd_tags_add_tags(

void dd_tags_add_blocked() { _blocked = true; }

void dd_tags_set_sampling_priority() { _force_keep = true; }
void dd_tags_set_sampling_priority()
{
if (_force_keep) {
return;
}

zend_object *nullable span = dd_req_lifecycle_get_cur_span();
dd_trace_set_priority_sampling_on_span_zobj(
span, PRIORITY_SAMPLING_USER_KEEP, DD_MECHANISM_MANUAL);
mlog(dd_log_debug, "Updated sampling priority to user_keep");

_force_keep = true;
}

static void _zend_string_release_indirect(void *s)
{
Expand Down

0 comments on commit fba7ee0

Please sign in to comment.