diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs index 8e688b03432..810225daa25 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/Implementation/HttpInMetricsListener.cs @@ -21,6 +21,7 @@ using Microsoft.AspNetCore.Routing; #endif using OpenTelemetry.Trace; +using static OpenTelemetry.Internal.HttpSemanticConventionHelper; namespace OpenTelemetry.Instrumentation.AspNetCore.Implementation { @@ -34,12 +35,16 @@ internal sealed class HttpInMetricsListener : ListenerHandler private readonly AspNetCoreMetricsInstrumentationOptions options; private readonly Histogram httpServerDuration; + private readonly HttpSemanticConvention httpSemanticConvention; + internal HttpInMetricsListener(string name, Meter meter, AspNetCoreMetricsInstrumentationOptions options) : base(name) { this.meter = meter; this.options = options; this.httpServerDuration = meter.CreateHistogram(HttpServerDurationMetricName, "ms", "Measures the duration of inbound HTTP requests."); + + this.httpSemanticConvention = GetSemanticConventionOptIn(); } public override void OnEventWritten(string name, object payload) diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs index 73b7cd98f6f..04183129d15 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs @@ -19,6 +19,7 @@ using OpenTelemetry.Context.Propagation; using OpenTelemetry.Instrumentation.Http; using OpenTelemetry.Trace; +using static OpenTelemetry.Internal.HttpSemanticConventionHelper; namespace OpenTelemetry.Instrumentation.GrpcNetClient.Implementation { @@ -36,10 +37,14 @@ internal sealed class GrpcClientDiagnosticListener : ListenerHandler private readonly PropertyFetcher startRequestFetcher = new("Request"); private readonly PropertyFetcher stopRequestFetcher = new("Response"); + private readonly HttpSemanticConvention httpSemanticConvention; + public GrpcClientDiagnosticListener(GrpcClientInstrumentationOptions options) : base("Grpc.Net.Client") { this.options = options; + + this.httpSemanticConvention = GetSemanticConventionOptIn(); } public override void OnEventWritten(string name, object payload) diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj index 08a03911108..11ef412972d 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj @@ -13,6 +13,7 @@ + diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs index fa10137333b..c0709fcd759 100644 --- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs @@ -21,6 +21,7 @@ using System.Reflection; using OpenTelemetry.Context.Propagation; using OpenTelemetry.Trace; +using static OpenTelemetry.Internal.HttpSemanticConventionHelper; namespace OpenTelemetry.Instrumentation.Http.Implementation { @@ -45,6 +46,8 @@ internal sealed class HttpHandlerDiagnosticListener : ListenerHandler private readonly PropertyFetcher stopRequestStatusFetcher = new("RequestTaskStatus"); private readonly HttpClientInstrumentationOptions options; + private readonly HttpSemanticConvention httpSemanticConvention; + static HttpHandlerDiagnosticListener() { try @@ -61,6 +64,8 @@ public HttpHandlerDiagnosticListener(HttpClientInstrumentationOptions options) : base("HttpHandlerDiagnosticListener") { this.options = options; + + this.httpSemanticConvention = GetSemanticConventionOptIn(); } public override void OnEventWritten(string name, object payload) diff --git a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs index 4fc5a4f982e..b39806232aa 100644 --- a/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerMetricsDiagnosticListener.cs @@ -20,6 +20,7 @@ using System.Net.Http; #endif using OpenTelemetry.Trace; +using static OpenTelemetry.Internal.HttpSemanticConventionHelper; namespace OpenTelemetry.Instrumentation.Http.Implementation { @@ -31,10 +32,14 @@ internal sealed class HttpHandlerMetricsDiagnosticListener : ListenerHandler private readonly PropertyFetcher stopRequestFetcher = new("Request"); private readonly Histogram httpClientDuration; + private readonly HttpSemanticConvention httpSemanticConvention; + public HttpHandlerMetricsDiagnosticListener(string name, Meter meter) : base(name) { this.httpClientDuration = meter.CreateHistogram("http.client.duration", "ms", "Measures the duration of outbound HTTP requests."); + + this.httpSemanticConvention = GetSemanticConventionOptIn(); } public override void OnEventWritten(string name, object payload) diff --git a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj index ff3eece862e..23a8c183a25 100644 --- a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj +++ b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj @@ -13,6 +13,7 @@ + diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlClientDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlClientDiagnosticListener.cs index 8849f218b72..fe17f8e907d 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlClientDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlClientDiagnosticListener.cs @@ -17,6 +17,7 @@ using System.Data; using System.Diagnostics; using OpenTelemetry.Trace; +using static OpenTelemetry.Internal.HttpSemanticConventionHelper; namespace OpenTelemetry.Instrumentation.SqlClient.Implementation { @@ -40,10 +41,14 @@ internal sealed class SqlClientDiagnosticListener : ListenerHandler private readonly PropertyFetcher exceptionFetcher = new("Exception"); private readonly SqlClientInstrumentationOptions options; + private readonly HttpSemanticConvention httpSemanticConvention; + public SqlClientDiagnosticListener(string sourceName, SqlClientInstrumentationOptions options) : base(sourceName) { this.options = options ?? new SqlClientInstrumentationOptions(); + + this.httpSemanticConvention = GetSemanticConventionOptIn(); } public override bool SupportsNullActivity => true; diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj index 186e71373d3..9a47a00608f 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj +++ b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj @@ -13,6 +13,7 @@ +