From 90bf9f031ea1db21ad21d954c51d2f13eb71f6c1 Mon Sep 17 00:00:00 2001 From: Lucas Pimentel Date: Tue, 21 May 2024 13:12:06 -0400 Subject: [PATCH] remove "_dd.agent_psr" only from TraceAnnotationsTests spanshots --- .../TraceAnnotationsTests.cs | 20 ++++++++++++++++++- .../VerifyHelper.cs | 11 +--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs index 4dd1160d07fc..c8c62fdd7e26 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs @@ -6,6 +6,7 @@ #pragma warning disable SA1402 // File may only contain a single class #pragma warning disable SA1649 // File name must match first type name +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Datadog.Trace.Configuration; @@ -155,13 +156,30 @@ public async Task SubmitTraces() telemetry?.AssertConfiguration("DD_TRACE_METHODS"); // normalised to trace_methods in the backend // Run snapshot verification - var settings = VerifyHelper.GetSpanVerifierSettings(); + var settings = VerifyHelper.GetSpanVerifierSettings( + scrubbers: null, + parameters: [], + apmStringTagsScrubber: VerifyHelper.ScrubStringTags, // remove "_dd.agent_psr" to prevent flake + apmNumericTagsScrubber: ApmNumericTagsScrubber, + ciVisStringTagsScrubber: null, + ciVisNumericTagsScrubber: null); + await Verifier.Verify(orderedSpans, settings) .UniqueForRuntime() .UseMethodName("_"); } telemetry?.Dispose(); + return; + + // remove "_dd.agent_psr" + static Dictionary ApmNumericTagsScrubber(MockSpan target, Dictionary tags) + { + return tags + ?.Where(kvp => !string.Equals(kvp.Key, Metrics.SamplingAgentDecision)) + .OrderBy(x => x.Key) + .ToDictionary(x => x.Key, x => x.Value); + } } [SkippableFact] diff --git a/tracer/test/Datadog.Trace.TestHelpers.SharedSource/VerifyHelper.cs b/tracer/test/Datadog.Trace.TestHelpers.SharedSource/VerifyHelper.cs index eec49afe7a2a..07786af4e295 100644 --- a/tracer/test/Datadog.Trace.TestHelpers.SharedSource/VerifyHelper.cs +++ b/tracer/test/Datadog.Trace.TestHelpers.SharedSource/VerifyHelper.cs @@ -215,16 +215,7 @@ public static void AddSimpleScrubber(this VerifySettings settings, string oldVal public static Dictionary? ScrubNumericTags(MockSpan span, Dictionary? tags) { - string[] ignoreKeys = - [ - Metrics.SamplingAgentDecision, - // more coming soon - ]; - - return tags - ?.Where(kvp => !ignoreKeys.Contains(kvp.Key)) - .OrderBy(x => x.Key) - .ToDictionary(x => x.Key, x => x.Value); + return tags; // no-op } public static Dictionary? ScrubCIVisibilityTags(MockSpan span, Dictionary? tags) => ScrubCIVisibilityTags(tags);