Skip to content

Commit

Permalink
Add http.scheme tag to HttpClient instrumentation (#3464)
Browse files Browse the repository at this point in the history
* add http.scheme tag
  • Loading branch information
vishweshbankwar authored Jul 20, 2022
1 parent 95419ed commit 54e83a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public override void OnStartActivity(Activity activity, object payload)
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public async Task DebugIndividualTestAsync()
""spanStatus"": ""UNSET"",
""spanKind"": ""Client"",
""spanAttributes"": {
""http.scheme"": ""http"",
""http.method"": ""GET"",
""http.host"": ""{host}:{port}"",
""http.status_code"": ""399"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -22,6 +23,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "POST",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -38,6 +40,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -54,6 +57,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -70,6 +74,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -87,6 +92,7 @@
"responseExpected": false,
"recordException": false,
"spanAttributes": {
"http.scheme": "https",
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
Expand All @@ -103,6 +109,7 @@
"responseExpected": false,
"recordException": true,
"spanAttributes": {
"http.scheme": "https",
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
Expand All @@ -118,6 +125,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -134,6 +142,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -150,6 +159,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -166,6 +176,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -182,6 +193,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -198,6 +210,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -214,6 +227,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -230,6 +244,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -246,6 +261,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -262,6 +278,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -278,6 +295,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -294,6 +312,7 @@
"spanStatus": "ERROR",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand All @@ -310,6 +329,7 @@
"spanStatus": "UNSET",
"responseExpected": true,
"spanAttributes": {
"http.scheme": "http",
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
Expand Down

0 comments on commit 54e83a9

Please sign in to comment.