diff --git a/CHANGELOG.md b/CHANGELOG.md index 934a464..48da269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.3.4] - 2023-12-29 + +### Added + +- Fixes `ActicitySource` memory leak when the HttpClientRequestAdapter does not construct the HttpClient internally. + ## [1.3.3] - 2023-11-28 ### Added diff --git a/src/HttpClientRequestAdapter.cs b/src/HttpClientRequestAdapter.cs index 788f10e..74ed178 100644 --- a/src/HttpClientRequestAdapter.cs +++ b/src/HttpClientRequestAdapter.cs @@ -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); } /// Factory to use to get a serializer for payload serialization public ISerializationWriterFactory SerializationWriterFactory @@ -603,7 +603,6 @@ protected virtual void Dispose(bool disposing) // Cleanup if(createdClient) { - activitySource?.Dispose(); client?.Dispose(); } } diff --git a/src/Microsoft.Kiota.Http.HttpClientLibrary.csproj b/src/Microsoft.Kiota.Http.HttpClientLibrary.csproj index 7ee7ac5..fcd4945 100644 --- a/src/Microsoft.Kiota.Http.HttpClientLibrary.csproj +++ b/src/Microsoft.Kiota.Http.HttpClientLibrary.csproj @@ -14,7 +14,7 @@ https://aka.ms/kiota/docs true true - 1.3.3 + 1.3.4 true