Add http.scheme tag to HttpClient instrumentation (#3464)

* add http.scheme tag
This commit is contained in:
Vishwesh Bankwar 2022-07-20 13:59:07 -07:00 committed by GitHub
parent 95419ed309
commit 54e83a9c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -2,6 +2,9 @@
## Unreleased
* Added `http.scheme` tag to tracing instrumentation.
([#3464](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3464))
* [Breaking] Removes `SetHttpFlavor` option. "http.flavor" is
now always automatically populated.
To remove this tag, set "http.flavor" to null using `ActivityProcessor`.

View File

@ -111,6 +111,7 @@ namespace OpenTelemetry.Instrumentation.Http.Implementation
ActivityInstrumentationHelper.SetActivitySourceProperty(activity, ActivitySource);
ActivityInstrumentationHelper.SetKindProperty(activity, ActivityKind.Client);
activity.SetTag(SemanticConventions.AttributeHttpScheme, request.RequestUri.Scheme);
activity.SetTag(SemanticConventions.AttributeHttpMethod, HttpTagHelper.GetNameForHttpMethod(request.Method));
activity.SetTag(SemanticConventions.AttributeHttpHost, HttpTagHelper.GetHostTagValueFromRequestUri(request.RequestUri));
activity.SetTag(SemanticConventions.AttributeHttpUrl, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));

View File

@ -198,6 +198,7 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
""spanStatus"": ""UNSET"",
""spanKind"": ""Client"",
""spanAttributes"": {
""http.scheme"": ""http"",
""http.method"": ""GET"",
""http.host"": ""{host}:{port}"",
""http.status_code"": ""399"",

View File

@ -7,6 +7,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -22,6 +23,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "POST",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -38,6 +40,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -54,6 +57,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -70,6 +74,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -87,6 +92,7 @@
"responseExpected": false,
"recordException": false,
"spanAttributes": {
"http.scheme": "https",
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
@ -103,6 +109,7 @@
"responseExpected": false,
"recordException": true,
"spanAttributes": {
"http.scheme": "https",
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
@ -118,6 +125,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -134,6 +142,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -150,6 +159,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -166,6 +176,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -182,6 +193,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -198,6 +210,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -214,6 +227,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -230,6 +244,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -246,6 +261,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -262,6 +278,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -278,6 +295,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -294,6 +312,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
@ -310,6 +329,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",