Skip to content

Commit

Permalink
introduce a new propagated span tag _dd.p.appsec: 1 providing the kno…
Browse files Browse the repository at this point in the history
…wledge to downstream services that the current distributed trace is containing at least one ASM event and must inherit from the given force-keep priority indeed.
  • Loading branch information
jandro996 committed May 21, 2024
1 parent ad49247 commit 91397e3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.datadog.appsec.gateway;

import static com.datadog.appsec.event.data.MapDataBundle.Builder.CAPACITY_6_10;
import static com.datadog.appsec.gateway.AppSecRequestContext.DEFAULT_REQUEST_HEADERS_ALLOW_LIST;
import static com.datadog.appsec.gateway.AppSecRequestContext.REQUEST_HEADERS_ALLOW_LIST;
import static com.datadog.appsec.gateway.AppSecRequestContext.RESPONSE_HEADERS_ALLOW_LIST;

import com.datadog.appsec.AppSecSystem;
import com.datadog.appsec.api.security.ApiSecurityRequestSampler;
Expand Down Expand Up @@ -145,6 +142,12 @@ public void init() {
traceSeg.setTagTop(DDTags.MANUAL_KEEP, true);
traceSeg.setTagTop("appsec.event", true);
traceSeg.setTagTop("network.client.ip", ctx.getPeerAddress());
// If APM is disabled Provide the knowledge to downstream services that the current
// distributed trace is containing at least one ASM event and must inherit from the
// given force-keep priority indeed
if (!Config.get().isTraceEnabled()) {
traceSeg.setTagTop("_dd.p.appsec", 1);
}

// Reflect client_ip as actor.ip for backward compatibility
Object clientIp = spanInfo.getTags().get(Tags.HTTP_CLIENT_IP);
Expand Down

0 comments on commit 91397e3

Please sign in to comment.