Skip to content

Commit b994e19

Browse files
committed
Filter out the ExitApp Span
Sometimes it shows up sometimes it don't We kill the process in that function so that is probably why.
1 parent 537f391 commit b994e19

File tree

2 files changed

+69
-99
lines changed

2 files changed

+69
-99
lines changed

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AzureFunctionsTests.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ public async Task SubmitsTraces()
149149
{
150150
const int expectedSpanCount = 21;
151151
var spans = await agent.WaitForSpansAsync(expectedSpanCount);
152+
var filteredSpans = spans.Where(s => !s.Resource.Equals("Timer ExitApp", StringComparison.OrdinalIgnoreCase)).ToImmutableList();
152153

153154
using var s = new AssertionScope();
154-
spans.Count.Should().Be(expectedSpanCount);
155+
filteredSpans.Count.Should().Be(expectedSpanCount);
155156

156-
await AssertInProcessSpans(spans);
157+
await AssertInProcessSpans(filteredSpans);
157158
}
158159
}
159160
}
@@ -216,10 +217,10 @@ public async Task SubmitsTraces()
216217
{
217218
const int expectedSpanCount = 21;
218219
var spans = await agent.WaitForSpansAsync(expectedSpanCount);
219-
220+
var filteredSpans = spans.Where(s => !s.Resource.Equals("Timer ExitApp", StringComparison.OrdinalIgnoreCase)).ToImmutableList();
220221
using var s = new AssertionScope();
221222

222-
await AssertIsolatedSpans(spans, $"{nameof(AzureFunctionsTests)}.Isolated.V4.Sdk1");
223+
await AssertIsolatedSpans(filteredSpans, $"{nameof(AzureFunctionsTests)}.Isolated.V4.Sdk1");
223224
}
224225
}
225226
}
@@ -280,14 +281,15 @@ public async Task SubmitsTraces()
280281
using var agent = EnvironmentHelper.GetMockAgent(useTelemetry: true);
281282
using (await RunAzureFunctionAndWaitForExit(agent, expectedExitCode: -1))
282283
{
283-
const int expectedSpanCount = 22;
284+
const int expectedSpanCount = 21;
284285
var spans = await agent.WaitForSpansAsync(expectedSpanCount);
286+
var filteredSpans = spans.Where(s => !s.Resource.Equals("Timer ExitApp", StringComparison.OrdinalIgnoreCase)).ToImmutableList();
285287

286288
using var s = new AssertionScope();
287289

288-
await AssertIsolatedSpans(spans);
290+
await AssertIsolatedSpans(filteredSpans);
289291

290-
spans.Count.Should().Be(expectedSpanCount);
292+
filteredSpans.Count.Should().Be(expectedSpanCount);
291293
}
292294
}
293295
}

0 commit comments

Comments
 (0)