Skip to content

Commit

Permalink
HttpClient: Invoke Enrich when SocketException = HostNotFound (#3407)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwest authored Jun 24, 2022
1 parent b7a3a83 commit 98b4fde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 98b4fde

Please sign in to comment.