Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fixes #184
Browse files Browse the repository at this point in the history
Use activity source registry to resolve memory leak
  • Loading branch information
Jacob-Morgan committed Dec 28, 2023
1 parent eb76ee8 commit 1f841cf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/HttpClientRequestAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public HttpClientRequestAdapter(IAuthenticationProvider authenticationProvider,
pNodeFactory = parseNodeFactory ?? ParseNodeFactoryRegistry.DefaultInstance;
sWriterFactory = serializationWriterFactory ?? SerializationWriterFactoryRegistry.DefaultInstance;
obsOptions = observabilityOptions ?? new ObservabilityOptions();
activitySource = new(obsOptions.TracerInstrumentationName);
activitySource = ActivitySourceRegistry.DefaultInstance.GetOrCreateActivitySource(obsOptions.TracerInstrumentationName);
}
/// <summary>Factory to use to get a serializer for payload serialization</summary>
public ISerializationWriterFactory SerializationWriterFactory
Expand Down Expand Up @@ -603,7 +603,6 @@ protected virtual void Dispose(bool disposing)
// Cleanup
if(createdClient)
{
activitySource?.Dispose();
client?.Dispose();
}
}
Expand Down

0 comments on commit 1f841cf

Please sign in to comment.