diff --git a/tracer/src/Datadog.Trace/AppSec/Coordinator/SecurityCoordinator.Reporter.cs b/tracer/src/Datadog.Trace/AppSec/Coordinator/SecurityCoordinator.Reporter.cs index a3f210c80da8..5d3fa4945509 100644 --- a/tracer/src/Datadog.Trace/AppSec/Coordinator/SecurityCoordinator.Reporter.cs +++ b/tracer/src/Datadog.Trace/AppSec/Coordinator/SecurityCoordinator.Reporter.cs @@ -92,8 +92,11 @@ internal static void ReportWafInitInfoOnce(Security security, Span span) security.WafInitResult.Reported = true; span.Context.TraceContext?.SetSamplingPriority(SamplingPriorityValues.UserKeep, SamplingMechanism.Asm); span.SetMetric(Metrics.AppSecWafInitRulesLoaded, security.WafInitResult.LoadedRules); - span.SetMetric(Metrics.AppSecWafInitRulesErrorCount, security.WafInitResult.FailedToLoadRules); - if (security.WafInitResult.HasErrors && !Security.HasOnlyUnknownMatcherErrors(security.WafInitResult.Errors)) + bool onlyUnknownMatcherErrors = Security.HasOnlyUnknownMatcherErrors(security.WafInitResult.Errors); + + // If there are only unknown matcher errors, we don't want to report the failures + span.SetMetric(Metrics.AppSecWafInitRulesErrorCount, onlyUnknownMatcherErrors ? 0 : security.WafInitResult.FailedToLoadRules); + if (security.WafInitResult.HasErrors && !onlyUnknownMatcherErrors) { span.SetTag(Tags.AppSecWafInitRuleErrors, security.WafInitResult.ErrorMessage); }