From c5f5dd7dbd07cdba192c9aaac6c568df8da3dcbf Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Fri, 1 Dec 2023 15:47:01 -0800 Subject: [PATCH] [HttpWebRequest] Add additional error types (#5111) --- src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md | 4 ++++ .../Implementation/HttpWebRequestActivitySource.netfx.cs | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md index e698306f061..1df45ecef5d 100644 --- a/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md @@ -26,6 +26,10 @@ * **Breaking Change**: Removed `http.user_agent` tag from HttpClient activity. ([#5110](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5110)) +* `HttpWebRequest` : Introduced additional values for `error.type` tag on + activity and `http.client.request.duration` metric. + ([#5111](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5111)) + ## 1.6.0-beta.3 Released 2023-Nov-17 diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs index 1b73409a01c..1223711476e 100644 --- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs +++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs @@ -166,13 +166,21 @@ private static string GetErrorType(Exception exception) { WebExceptionStatus.NameResolutionFailure => "name_resolution_failure", WebExceptionStatus.ConnectFailure => "connect_failure", + WebExceptionStatus.ReceiveFailure => "receive_failure", WebExceptionStatus.SendFailure => "send_failure", + WebExceptionStatus.PipelineFailure => "pipeline_failure", WebExceptionStatus.RequestCanceled => "request_cancelled", + WebExceptionStatus.ProtocolError => "protocol_error", + WebExceptionStatus.ConnectionClosed => "connection_closed", WebExceptionStatus.TrustFailure => "trust_failure", WebExceptionStatus.SecureChannelFailure => "secure_channel_failure", WebExceptionStatus.ServerProtocolViolation => "server_protocol_violation", + WebExceptionStatus.KeepAliveFailure => "keep_alive_failure", WebExceptionStatus.Timeout => "timeout", + WebExceptionStatus.ProxyNameResolutionFailure => "proxy_name_resolution_failure", WebExceptionStatus.MessageLengthLimitExceeded => "message_length_limit_exceeded", + WebExceptionStatus.RequestProhibitedByCachePolicy => "request_prohibited_by_cache_policy", + WebExceptionStatus.RequestProhibitedByProxy => "request_prohibited_by_proxy", _ => wexc.GetType().FullName, }; }