[HttpClient] update `network.protocol.version` values as per specification (#5006)
This commit is contained in:
parent
4ccee25c9f
commit
66373082d8
|
|
@ -41,6 +41,9 @@
|
|||
([#5005](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5005))
|
||||
([#5034](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5034))
|
||||
|
||||
* Fixed `network.protocol.version` attribute values to match the specification.
|
||||
([#5006](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5006))
|
||||
|
||||
## 1.6.0-beta.2
|
||||
|
||||
Released 2023-Oct-26
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ internal sealed class HttpHandlerDiagnosticListener : ListenerHandler
|
|||
}
|
||||
|
||||
activity.SetTag(SemanticConventions.AttributeUrlFull, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
|
||||
activity.SetTag(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version));
|
||||
activity.SetTag(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetProtocolVersionString(request.Version));
|
||||
|
||||
if (request.Headers.TryGetValues("User-Agent", out var userAgentValues))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ internal sealed class HttpHandlerMetricsDiagnosticListener : ListenerHandler
|
|||
|
||||
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeServerAddress, request.RequestUri.Host));
|
||||
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeUrlScheme, request.RequestUri.Scheme));
|
||||
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version)));
|
||||
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetProtocolVersionString(request.Version)));
|
||||
|
||||
if (!request.RequestUri.IsDefaultPort)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,6 +78,15 @@ internal static class HttpTagHelper
|
|||
return string.Concat(uri.Scheme, Uri.SchemeDelimiter, uri.Authority, uri.PathAndQuery, uri.Fragment);
|
||||
}
|
||||
|
||||
public static string GetProtocolVersionString(Version httpVersion) => (httpVersion.Major, httpVersion.Minor) switch
|
||||
{
|
||||
(1, 0) => "1.0",
|
||||
(1, 1) => "1.1",
|
||||
(2, 0) => "2",
|
||||
(3, 0) => "3",
|
||||
_ => httpVersion.ToString(),
|
||||
};
|
||||
|
||||
private static string ConvertMethodToOperationName(string method) => $"HTTP {method}";
|
||||
|
||||
private static string ConvertHttpMethodToOperationName(HttpMethod method) => $"HTTP {method}";
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ internal static class HttpWebRequestActivitySource
|
|||
}
|
||||
|
||||
activity.SetTag(SemanticConventions.AttributeUrlFull, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
|
||||
activity.SetTag(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));
|
||||
activity.SetTag(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetProtocolVersionString(request.ProtocolVersion));
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -531,7 +531,7 @@ internal static class HttpWebRequestActivitySource
|
|||
|
||||
tags.Add(SemanticConventions.AttributeServerAddress, request.RequestUri.Host);
|
||||
tags.Add(SemanticConventions.AttributeUrlScheme, request.RequestUri.Scheme);
|
||||
tags.Add(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));
|
||||
tags.Add(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetProtocolVersionString(request.ProtocolVersion));
|
||||
if (!request.RequestUri.IsDefaultPort)
|
||||
{
|
||||
tags.Add(SemanticConventions.AttributeServerPort, request.RequestUri.Port);
|
||||
|
|
|
|||
Loading…
Reference in New Issue