-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathWcfClientInstrumentation.cs
25 lines (22 loc) · 1.11 KB
/
WcfClientInstrumentation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
using IntegrationTests.Helpers;
using OpenTelemetry.Proto.Trace.V1;
namespace IntegrationTests;
internal static class WcfClientInstrumentation
{
public static bool ValidateExpectedSpanHierarchy(ICollection<MockSpansCollector.Collected> assertedSpans)
{
var customParent = assertedSpans.Single(collected =>
collected.InstrumentationScopeName.StartsWith("TestApplication.Wcf.Client") &&
collected.Span.Name == "Parent");
var customSibling = assertedSpans.Single(collected =>
collected.InstrumentationScopeName.StartsWith("TestApplication.Wcf.Client") &&
collected.Span.Name == "Sibling");
var wcfClientSpans = assertedSpans.Where(collected =>
collected.Span.Kind == Span.Types.SpanKind.Client &&
collected.InstrumentationScopeName == "OpenTelemetry.Instrumentation.Wcf");
return wcfClientSpans.All(span => span.Span.ParentSpanId == customParent.Span.SpanId) &&
customSibling.Span.ParentSpanId == customParent.Span.SpanId;
}
}