diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md index 180bf3334ff..c4b7cc797c8 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md @@ -4,6 +4,9 @@ * **Users migrating from version `1.0.0-rc9.9` will see the following breaking changes:** + * Updated `http.status_code` dimension type from string to int for + `http.server.duration` metric. + ([#3930](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3930)) * `http.host` will no longer be populated on `http.server.duration` metric. `net.host.name` and `net.host.port` attributes will be populated instead. ([#3928](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3928)) diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs index cfa346fad87..ea025fb5004 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs @@ -63,7 +63,7 @@ public override void OnEventWritten(string name, object payload) tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocol(context.Request.Protocol))); tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpScheme, context.Request.Scheme)); tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpMethod, context.Request.Method)); - tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpStatusCode, context.Response.StatusCode.ToString())); + tags.Add(new KeyValuePair(SemanticConventions.AttributeHttpStatusCode, context.Response.StatusCode)); if (context.Request.Host.HasValue) { diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs index f846d1cf139..9ed66c4220e 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs @@ -117,7 +117,7 @@ public async Task RequestMetricIsCaptured() var method = new KeyValuePair(SemanticConventions.AttributeHttpMethod, "GET"); var scheme = new KeyValuePair(SemanticConventions.AttributeHttpScheme, "http"); - var statusCode = new KeyValuePair(SemanticConventions.AttributeHttpStatusCode, "200"); + var statusCode = new KeyValuePair(SemanticConventions.AttributeHttpStatusCode, 200); var flavor = new KeyValuePair(SemanticConventions.AttributeHttpFlavor, "1.1"); var host = new KeyValuePair(SemanticConventions.AttributeNetHostName, "localhost"); var route = new KeyValuePair(SemanticConventions.AttributeHttpRoute, "api/Values");