From 5677f4ffbd4c1dd6bd7a009783cae42e91265e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 8 Mar 2024 08:29:35 +0100 Subject: [PATCH] Fix http.response.status_code --- .../Implementation/HttpInListener.cs | 2 +- .../HttpInListenerTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.AspNet/Implementation/HttpInListener.cs b/src/OpenTelemetry.Instrumentation.AspNet/Implementation/HttpInListener.cs index 1fc03b4e50..379a57b2c6 100644 --- a/src/OpenTelemetry.Instrumentation.AspNet/Implementation/HttpInListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNet/Implementation/HttpInListener.cs @@ -115,7 +115,7 @@ private void OnStopActivity(Activity activity, HttpContext context) { var response = context.Response; - activity.SetTag(SemanticConventions.AttributeHttpStatusCode, response.StatusCode); + activity.SetTag(SemanticConventions.AttributeHttpResponseStatusCode, response.StatusCode); if (activity.Status == ActivityStatusCode.Unset) { diff --git a/test/OpenTelemetry.Instrumentation.AspNet.Tests/HttpInListenerTests.cs b/test/OpenTelemetry.Instrumentation.AspNet.Tests/HttpInListenerTests.cs index 2fbe46ddec..a1947507c8 100644 --- a/test/OpenTelemetry.Instrumentation.AspNet.Tests/HttpInListenerTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNet.Tests/HttpInListenerTests.cs @@ -118,7 +118,7 @@ public void AspNetRequestsAreCollectedSuccessfully( Assert.Equal(ActivityKind.Server, span.Kind); Assert.True(span.Duration != TimeSpan.Zero); - Assert.Equal(200, span.GetTagValue(SemanticConventions.AttributeHttpStatusCode)); + Assert.Equal(200, span.GetTagValue("http.response.status_code")); var expectedUri = new Uri(expectedUrl); var actualUrl = span.GetTagValue(SemanticConventions.AttributeHttpUrl);