Skip to content

Commit

Permalink
moving to dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
eddynaka committed Nov 4, 2020
1 parent 31b15a4 commit 01d4140
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,6 @@ public async Task CustomPropagator()

Assert.Equal(expectedTraceId, activity.Context.TraceId);
Assert.Equal(expectedSpanId, activity.ParentSpanId);
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

[Fact]
Expand Down Expand Up @@ -338,6 +333,11 @@ void ConfigureTestServices(IServiceCollection services)
public void Dispose()
{
this.openTelemetrySdk?.Dispose();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

private static void WaitForProcessorInvocations(Mock<BaseProcessor<Activity>> activityProcessor, int invocationCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,6 @@ public async Task HttpClientInstrumentationInjectsHeadersAsync_CustomFormat(bool

Assert.Equal($"00/{activity.Context.TraceId}/{activity.Context.SpanId}/01", traceparents.Single());
Assert.Equal("k1=v1,k2=v2", tracestates.Single());
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

[Fact]
Expand Down Expand Up @@ -321,6 +316,11 @@ public void Dispose()
{
this.serverLifeTime?.Dispose();
Activity.Current = null;
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

private static void ActivityEnrichment(Activity activity, string method, object obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public HttpWebRequestTests()
public void Dispose()
{
this.serverLifeTime?.Dispose();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

[Fact]
Expand Down Expand Up @@ -141,11 +146,6 @@ public async Task HttpWebRequestInstrumentationInjectsHeadersAsync_CustomFormat(
Assert.Equal("k1=v1,k2=v2", tracestate);

parent.Stop();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}

[Fact]
Expand Down

0 comments on commit 01d4140

Please sign in to comment.