Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http.scheme tag to HttpClient instrumentation #3464

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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