Skip to content

Commit d74ac9e

Browse files
authored
Remove SetHttpFlavor from Http instrumentations (#3381)
1 parent 274dc44 commit d74ac9e

File tree

11 files changed

+28
-32
lines changed

11 files changed

+28
-32
lines changed

src/OpenTelemetry.Instrumentation.Http/.publicApi/net462/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.Filter.set -
66
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.HttpClientInstrumentationOptions() -> void
77
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.RecordException.get -> bool
88
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.RecordException.set -> void
9-
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.SetHttpFlavor.get -> bool
10-
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.SetHttpFlavor.set -> void
119
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions
1210
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.Enrich.get -> System.Action<System.Diagnostics.Activity, string, object>
1311
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.Enrich.set -> void
@@ -16,8 +14,6 @@ OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.Filter.s
1614
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.HttpWebRequestInstrumentationOptions() -> void
1715
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.RecordException.get -> bool
1816
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.RecordException.set -> void
19-
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.SetHttpFlavor.get -> bool
20-
OpenTelemetry.Instrumentation.Http.HttpWebRequestInstrumentationOptions.SetHttpFlavor.set -> void
2117
OpenTelemetry.Metrics.MeterProviderBuilderExtensions
2218
OpenTelemetry.Trace.TracerProviderBuilderExtensions
2319
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder

src/OpenTelemetry.Instrumentation.Http/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.Filter.set -
66
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.HttpClientInstrumentationOptions() -> void
77
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.RecordException.get -> bool
88
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.RecordException.set -> void
9-
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.SetHttpFlavor.get -> bool
10-
OpenTelemetry.Instrumentation.Http.HttpClientInstrumentationOptions.SetHttpFlavor.set -> void
119
OpenTelemetry.Metrics.MeterProviderBuilderExtensions
1210
OpenTelemetry.Trace.TracerProviderBuilderExtensions
1311
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddHttpClientInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder

src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
* [Breaking] Removes `SetHttpFlavor` option. "http.flavor" is
6+
now always automatically populated.
7+
To remove this tag, set "http.flavor" to null using `ActivityProcessor`.
8+
([#3380](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3380))
9+
510
## 1.0.0-rc9.4
611

712
Released 2022-Jun-03

src/OpenTelemetry.Instrumentation.Http/HttpClientInstrumentationOptions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Net.Http;
2020
using System.Runtime.CompilerServices;
2121
using OpenTelemetry.Instrumentation.Http.Implementation;
22-
using OpenTelemetry.Trace;
2322

2423
namespace OpenTelemetry.Instrumentation.Http
2524
{
@@ -28,11 +27,6 @@ namespace OpenTelemetry.Instrumentation.Http
2827
/// </summary>
2928
public class HttpClientInstrumentationOptions
3029
{
31-
/// <summary>
32-
/// 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.
33-
/// </summary>
34-
public bool SetHttpFlavor { get; set; }
35-
3630
/// <summary>
3731
/// Gets or sets a Filter function that determines whether or not to collect telemetry about requests on a per request basis.
3832
/// The Filter gets the HttpRequestMessage, and should return a boolean.

src/OpenTelemetry.Instrumentation.Http/HttpWebRequestInstrumentationOptions.netfx.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Diagnostics;
2020
using System.Net;
2121
using OpenTelemetry.Instrumentation.Http.Implementation;
22-
using OpenTelemetry.Trace;
2322

2423
namespace OpenTelemetry.Instrumentation.Http
2524
{
@@ -28,11 +27,6 @@ namespace OpenTelemetry.Instrumentation.Http
2827
/// </summary>
2928
public class HttpWebRequestInstrumentationOptions
3029
{
31-
/// <summary>
32-
/// 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.
33-
/// </summary>
34-
public bool SetHttpFlavor { get; set; }
35-
3630
/// <summary>
3731
/// Gets or sets a Filter function that determines whether or not to collect telemetry about requests on a per request basis.
3832
/// The Filter gets the HttpWebRequest, and should return a boolean.

src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,7 @@ public override void OnStartActivity(Activity activity, object payload)
115115
activity.SetTag(SemanticConventions.AttributeHttpMethod, HttpTagHelper.GetNameForHttpMethod(request.Method));
116116
activity.SetTag(SemanticConventions.AttributeHttpHost, HttpTagHelper.GetHostTagValueFromRequestUri(request.RequestUri));
117117
activity.SetTag(SemanticConventions.AttributeHttpUrl, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
118-
if (this.options.SetHttpFlavor)
119-
{
120-
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version));
121-
}
118+
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.Version));
122119

123120
try
124121
{

src/OpenTelemetry.Instrumentation.Http/Implementation/HttpWebRequestActivitySource.netfx.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ private static void AddRequestTagsAndInstrumentRequest(HttpWebRequest request, A
9999
activity.SetTag(SemanticConventions.AttributeHttpMethod, request.Method);
100100
activity.SetTag(SemanticConventions.AttributeHttpHost, HttpTagHelper.GetHostTagValueFromRequestUri(request.RequestUri));
101101
activity.SetTag(SemanticConventions.AttributeHttpUrl, HttpTagHelper.GetUriTagValueFromRequestUri(request.RequestUri));
102-
if (Options.SetHttpFlavor)
103-
{
104-
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));
105-
}
102+
activity.SetTag(SemanticConventions.AttributeHttpFlavor, HttpTagHelper.GetFlavorTagValueFromProtocolVersion(request.ProtocolVersion));
106103

107104
try
108105
{

test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.netcore31.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public async Task HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOut
6666
using (Sdk.CreateTracerProviderBuilder()
6767
.AddHttpClientInstrumentation((opt) =>
6868
{
69-
opt.SetHttpFlavor = tc.SetHttpFlavor;
7069
opt.Enrich = ActivityEnrichment;
7170
opt.RecordException = tc.RecordException ?? false;
7271
})
@@ -202,6 +201,7 @@ public async Task DebugIndividualTestAsync()
202201
""http.method"": ""GET"",
203202
""http.host"": ""{host}:{port}"",
204203
""http.status_code"": ""399"",
204+
""http.flavor"": ""2.0"",
205205
""http.url"": ""http://{host}:{port}/""
206206
}
207207
}

test/OpenTelemetry.Instrumentation.Http.Tests/HttpTestData.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ public class HttpOutTestCase
7474
public bool? SpanStatusHasDescription { get; set; }
7575

7676
public Dictionary<string, string> SpanAttributes { get; set; }
77-
78-
public bool SetHttpFlavor { get; set; }
7977
}
8078
}
8179
}

test/OpenTelemetry.Instrumentation.Http.Tests/HttpWebRequestTests.netfx.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public void HttpOutCallsAreCollectedSuccessfully(HttpTestData.HttpOutTestCase tc
5050
.AddProcessor(activityProcessor.Object)
5151
.AddHttpClientInstrumentation(options =>
5252
{
53-
options.SetHttpFlavor = tc.SetHttpFlavor;
5453
options.Enrich = ActivityEnrichment;
5554
options.RecordException = tc.RecordException.HasValue ? tc.RecordException.Value : false;
5655
})

0 commit comments

Comments
 (0)