[HttpClient and ASP.NET Core] Fix failures due to changes in .NET8.0 stable release (#5049)

This commit is contained in:
Vishwesh Bankwar 2023-11-14 14:17:29 -08:00 committed by GitHub
parent ecb5dc8732
commit 201811aa87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -41,6 +41,10 @@ exception. The attribute value will be set to full name of exception type.
path.
([#5044](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5044))
* Removed `network.protocol.name` from `http.server.request.duration` metric as
per spec.
([#5049](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5049))
## 1.6.0-beta.2
Released 2023-Oct-26

View File

@ -188,7 +188,6 @@ internal sealed class HttpInMetricsListener : ListenerHandler
TagList tags = default;
// see the spec https://github.com/open-telemetry/semantic-conventions/blob/v1.21.0/docs/http/http-spans.md
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeNetworkProtocolName, NetworkProtocolName));
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeNetworkProtocolVersion, HttpTagHelper.GetFlavorTagValueFromProtocol(context.Request.Protocol)));
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeUrlScheme, context.Request.Scheme));
tags.Add(new KeyValuePair<string, object>(SemanticConventions.AttributeHttpResponseStatusCode, TelemetryHelper.GetBoxedStatusCode(context.Response.StatusCode)));

View File

@ -118,6 +118,10 @@ Released 2023-Oct-26
definition.
([#4990](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4990))
* `dns.lookups.duration` metric is renamed to `dns.lookup.duration`. This change
impacts only users on `.NET8.0` or newer framework.
([#5049](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5049))
## 1.5.1-beta.1
Released 2023-Jul-20

View File

@ -242,7 +242,7 @@ public class MetricTests
expectedRoutes: new List<string> { expectedRoute },
expectedErrorType,
expectedStatusCode,
expectedTagsCount: expectedErrorType == null ? 6 : 7);
expectedTagsCount: expectedErrorType == null ? 5 : 6);
}
[Theory]
@ -440,7 +440,7 @@ public class MetricTests
expectedRoutes: new List<string> { "api/Values", "api/Values/{id}" },
null,
200,
expectedTagsCount: 6);
expectedTagsCount: 5);
}
#endif
@ -565,13 +565,8 @@ public class MetricTests
if (expectedErrorType != null)
{
#if NET8_0_OR_GREATER
// Expected to change in next release
// https://github.com/dotnet/aspnetcore/issues/51029
var errorType = new KeyValuePair<string, object>("exception.type", expectedErrorType);
#else
var errorType = new KeyValuePair<string, object>(SemanticConventions.AttributeErrorType, expectedErrorType);
#endif
Assert.Contains(errorType, attributes);
}

View File

@ -189,8 +189,6 @@ public partial class HttpClientTests
meterProvider.Dispose();
}
// dns.lookups.duration is a typo
// https://github.com/dotnet/runtime/issues/92917
var requestMetrics = metrics
.Where(metric =>
metric.Name == "http.client.request.duration" ||
@ -198,7 +196,7 @@ public partial class HttpClientTests
metric.Name == "http.client.request.time_in_queue" ||
metric.Name == "http.client.connection.duration" ||
metric.Name == "http.client.open_connections" ||
metric.Name == "dns.lookups.duration")
metric.Name == "dns.lookup.duration")
.ToArray();
if (tc.ResponseExpected)