Skip to content

Commit

Permalink
[HttpClient and ASP.NET Core] Fix failures due to changes in .NET8.0 …
Browse files Browse the repository at this point in the history
…stable release (#5049)
  • Loading branch information
vishweshbankwar authored Nov 14, 2023
1 parent ecb5dc8 commit 201811a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public void OnEventWritten_New(string name, object payload)
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)));
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public async Task RequestMetricIsCaptured_New(string api, string expectedRoute,
expectedRoutes: new List<string> { expectedRoute },
expectedErrorType,
expectedStatusCode,
expectedTagsCount: expectedErrorType == null ? 6 : 7);
expectedTagsCount: expectedErrorType == null ? 5 : 6);
}

[Theory]
Expand Down Expand Up @@ -440,7 +440,7 @@ public async Task RequestMetricIsCaptured_Dup()
expectedRoutes: new List<string> { "api/Values", "api/Values/{id}" },
null,
200,
expectedTagsCount: 6);
expectedTagsCount: 5);
}
#endif

Expand Down Expand Up @@ -565,13 +565,8 @@ private static KeyValuePair<string, object>[] AssertMetricPoint_New(

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,14 @@ public async Task ValidateNet8MetricsAsync(HttpTestData.HttpOutTestCase tc)
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" ||
metric.Name == "http.client.active_requests" ||
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)
Expand Down

0 comments on commit 201811a

Please sign in to comment.