diff --git a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md index 76b9ffe1cef..2c22ca8c063 100644 --- a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md @@ -7,6 +7,10 @@ To remove this tag, set "http.flavor" to null using `ActivityProcessor`. ([#3380](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3380)) +* Fix `Enrich` not getting invoked when SocketException due to HostNotFound + occurs. + ([#3407](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3407)) + ## 1.0.0-rc9.4 Released 2022-Jun-03 diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs index fcca7defd74..428cce5701f 100644 --- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs @@ -17,7 +17,6 @@ using System; using System.Diagnostics; using System.Net.Http; -using System.Net.Sockets; using System.Reflection; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -194,20 +193,7 @@ public override void OnException(Activity activity, object payload) if (exc is HttpRequestException) { - if (exc.InnerException is SocketException exception) - { - switch (exception.SocketErrorCode) - { - case SocketError.HostNotFound: - activity.SetStatus(Status.Error.WithDescription(exc.Message)); - return; - } - } - - if (exc.InnerException != null) - { - activity.SetStatus(Status.Error.WithDescription(exc.Message)); - } + activity.SetStatus(Status.Error.WithDescription(exc.Message)); } try