Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

* Removes `SetHttpFlavor` option. "http.flavor" is now always
automatically populated.
To remove this tag, set "http.flavor" to null using `ActivityProcessor`.
([#3380](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3380))

## 1.0.0-rc9.4

Released 2022-Jun-03
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ namespace OpenTelemetry.Instrumentation.Http
/// </summary>
public class HttpClientInstrumentationOptions
{
/// <summary>
/// Gets or sets a value indicating whether or not the HTTP version should be added as the <see cref="SemanticConventions.AttributeHttpFlavor"/> tag. Default value: False.
/// </summary>
public bool SetHttpFlavor { get; set; }

/// <summary>
/// Gets or sets a Filter function that determines whether or not to collect telemetry about requests on a per request basis.
/// The Filter gets the HttpRequestMessage, and should return a boolean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ namespace OpenTelemetry.Instrumentation.Http
/// </summary>
public class HttpWebRequestInstrumentationOptions
{
/// <summary>
/// Gets or sets a value indicating whether or not the HTTP version should be added as the <see cref="SemanticConventions.AttributeHttpFlavor"/> tag. Default value: False.
/// </summary>
public bool SetHttpFlavor { get; set; }

/// <summary>
/// Gets or sets a Filter function that determines whether or not to collect telemetry about requests on a per request basis.
/// The Filter gets the HttpWebRequest, and should return a boolean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ public override void OnStartActivity(Activity activity, object payload)
activity.SetTag(SemanticConventions.AttributeHttpMethod, HttpTagHelper.GetNameForHttpMethod(request.Method));
activity.SetTag(SemanticConventions.AttributeHttpHost, HttpTagHelper.GetHostTagValueFromRequestUri(request.RequestUri));
activity.SetTag(SemanticConventions.AttributeHttpUrl, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
if (this.options.SetHttpFlavor)
{
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version));
}
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version));

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ private static void AddRequestTagsAndInstrumentRequest(HttpWebRequest request, A
activity.SetTag(SemanticConventions.AttributeHttpMethod, request.Method);
activity.SetTag(SemanticConventions.AttributeHttpHost, HttpTagHelper.GetHostTagValueFromRequestUri(request.RequestUri));
activity.SetTag(SemanticConventions.AttributeHttpUrl, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
if (Options.SetHttpFlavor)
{
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));
}
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public async Task HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOut
using (Sdk.CreateTracerProviderBuilder()
.AddHttpClientInstrumentation((opt) =>
{
opt.SetHttpFlavor = tc.SetHttpFlavor;
opt.Enrich = ActivityEnrichment;
opt.RecordException = tc.RecordException ?? false;
})
Expand Down Expand Up @@ -202,6 +201,7 @@ public async Task DebugIndividualTestAsync()
""http.method"": ""GET"",
""http.host"": ""{host}:{port}"",
""http.status_code"": ""399"",
""http.flavor"": ""2.0"",
""http.url"": ""http://{host}:{port}/""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public class HttpOutTestCase

public Dictionary<string, string> SpanAttributes { get; set; }

public bool SetHttpFlavor { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void HttpOutCallsAreCollectedSuccessfully(HttpTestData.HttpOutTestCase tc
.AddProcessor(activityProcessor.Object)
.AddHttpClientInstrumentation(options =>
{
options.SetHttpFlavor = tc.SetHttpFlavor;
options.Enrich = ActivityEnrichment;
options.RecordException = tc.RecordException.HasValue ? tc.RecordException.Value : false;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
[
{
"name": "Successful GET call to localhost",
"method": "GET",
Expand All @@ -9,6 +9,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/"
}
Expand All @@ -23,6 +24,7 @@
"spanAttributes": {
"http.method": "POST",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/"
}
Expand All @@ -38,6 +40,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/path/to/resource/"
}
Expand All @@ -53,6 +56,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/path/to/resource#fragment"
}
Expand All @@ -68,6 +72,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/path/to/resource#fragment"
}
Expand All @@ -84,6 +89,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
"http.url": "https://sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com/"
}
},
Expand All @@ -99,6 +105,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com",
"http.flavor": "2.0",
"http.url": "https://sdlfaldfjalkdfjlkajdflkajlsdjf.sdlkjafsdjfalfadslkf.com/"
}
},
Expand All @@ -113,6 +120,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/"
}
Expand All @@ -128,6 +136,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": 200,
"http.url": "http://{host}:{port}/"
}
Expand All @@ -143,6 +152,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "399",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -158,6 +168,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "400",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -173,6 +184,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "401",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -188,6 +200,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "403",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -203,6 +216,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "404",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -218,6 +232,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "429",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -233,6 +248,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "501",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -248,6 +264,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "503",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -263,6 +280,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "504",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -278,6 +296,7 @@
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
"http.flavor": "2.0",
"http.status_code": "600",
"http.url": "http://{host}:{port}/"
}
Expand All @@ -290,7 +309,6 @@
"spanName": "HTTP GET",
"spanStatus": "UNSET",
"responseExpected": true,
"setHttpFlavor": true,
"spanAttributes": {
"http.method": "GET",
"http.host": "{host}:{port}",
Expand Down