diff --git a/Source/ApiTemplate/.template.config/template.json b/Source/ApiTemplate/.template.config/template.json index e0d0c8152..1ad28770a 100644 --- a/Source/ApiTemplate/.template.config/template.json +++ b/Source/ApiTemplate/.template.config/template.json @@ -153,7 +153,6 @@ "condition": "(!OpenTelemetry)", "exclude": [ "Source/ApiTemplate/Constants/OpenTelemetryAttributeName.cs", - "Source/ApiTemplate/Constants/OpenTelemetryHttpFlavour.cs", "Source/ApiTemplate/TracerProviderBuilderExtensions.cs" ] } diff --git a/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryAttributeName.cs b/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryAttributeName.cs index ed184f41d..617c44b17 100644 --- a/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryAttributeName.cs +++ b/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryAttributeName.cs @@ -51,18 +51,6 @@ public static class EndUser /// public static class Http { - /// - /// The URI scheme identifying the used protocol. - /// - /// E.g. http or https. - public const string Scheme = "http.scheme"; - - /// - /// Kind of HTTP protocol used. - /// - /// E.g. 1.0, 1.1, 2.0, SPDY or QUIC. - public const string Flavor = "http.flavor"; - /// /// The IP address of the original client behind all proxies, if known (e.g. from X-Forwarded-For). /// diff --git a/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryHttpFlavour.cs b/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryHttpFlavour.cs deleted file mode 100644 index 402bafc9e..000000000 --- a/Source/ApiTemplate/Source/ApiTemplate/Constants/OpenTelemetryHttpFlavour.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace ApiTemplate.Constants; - -public static class OpenTelemetryHttpFlavour -{ - public const string Http10 = "1.0"; - public const string Http11 = "1.1"; - public const string Http20 = "2.0"; - public const string Http30 = "3.0"; - - public static string GetHttpFlavour(string protocol) - { - if (HttpProtocol.IsHttp10(protocol)) - { - return Http10; - } - else if (HttpProtocol.IsHttp11(protocol)) - { - return Http11; - } - else if (HttpProtocol.IsHttp2(protocol)) - { - return Http20; - } - else if (HttpProtocol.IsHttp3(protocol)) - { - return Http30; - } - - throw new InvalidOperationException($"Protocol {protocol} not recognised."); - } -} diff --git a/Source/ApiTemplate/Source/ApiTemplate/TracerProviderBuilderExtensions.cs b/Source/ApiTemplate/Source/ApiTemplate/TracerProviderBuilderExtensions.cs index 9db2062d2..0194fd7dd 100644 --- a/Source/ApiTemplate/Source/ApiTemplate/TracerProviderBuilderExtensions.cs +++ b/Source/ApiTemplate/Source/ApiTemplate/TracerProviderBuilderExtensions.cs @@ -61,8 +61,6 @@ private static void Enrich(Activity activity, string eventName, object obj) if (obj is HttpRequest request) { var context = request.HttpContext; - activity.AddTag(OpenTelemetryAttributeName.Http.Flavor, OpenTelemetryHttpFlavour.GetHttpFlavour(request.Protocol)); - activity.AddTag(OpenTelemetryAttributeName.Http.Scheme, request.Scheme); activity.AddTag(OpenTelemetryAttributeName.Http.ClientIP, context.Connection.RemoteIpAddress); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentLength, request.ContentLength); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentType, request.ContentType); diff --git a/Source/GraphQLTemplate/.template.config/template.json b/Source/GraphQLTemplate/.template.config/template.json index e93035458..85e91281a 100644 --- a/Source/GraphQLTemplate/.template.config/template.json +++ b/Source/GraphQLTemplate/.template.config/template.json @@ -146,7 +146,6 @@ "condition": "(!OpenTelemetry)", "exclude": [ "Source/GraphQLTemplate/Constants/OpenTelemetryAttributeName.cs", - "Source/GraphQLTemplate/Constants/OpenTelemetryHttpFlavour.cs", "Source/GraphQLTemplate/TracerProviderBuilderExtensions.cs" ] } diff --git a/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryAttributeName.cs b/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryAttributeName.cs index c4d957e8f..8776ccad1 100644 --- a/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryAttributeName.cs +++ b/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryAttributeName.cs @@ -51,18 +51,6 @@ public static class EndUser /// public static class Http { - /// - /// The URI scheme identifying the used protocol. - /// - /// E.g. http or https. - public const string Scheme = "http.scheme"; - - /// - /// Kind of HTTP protocol used. - /// - /// E.g. 1.0, 1.1, 2.0, SPDY or QUIC. - public const string Flavor = "http.flavor"; - /// /// The IP address of the original client behind all proxies, if known (e.g. from X-Forwarded-For). /// diff --git a/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryHttpFlavour.cs b/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryHttpFlavour.cs deleted file mode 100644 index 8a4ca024d..000000000 --- a/Source/GraphQLTemplate/Source/GraphQLTemplate/Constants/OpenTelemetryHttpFlavour.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace GraphQLTemplate.Constants; - -public static class OpenTelemetryHttpFlavour -{ - public const string Http10 = "1.0"; - public const string Http11 = "1.1"; - public const string Http20 = "2.0"; - public const string Http30 = "3.0"; - - public static string GetHttpFlavour(string protocol) - { - if (HttpProtocol.IsHttp10(protocol)) - { - return Http10; - } - else if (HttpProtocol.IsHttp11(protocol)) - { - return Http11; - } - else if (HttpProtocol.IsHttp2(protocol)) - { - return Http20; - } - else if (HttpProtocol.IsHttp3(protocol)) - { - return Http30; - } - - throw new InvalidOperationException($"Protocol {protocol} not recognised."); - } -} diff --git a/Source/GraphQLTemplate/Source/GraphQLTemplate/TracerProviderBuilderExtensions.cs b/Source/GraphQLTemplate/Source/GraphQLTemplate/TracerProviderBuilderExtensions.cs index 027e5245c..9c15eb584 100644 --- a/Source/GraphQLTemplate/Source/GraphQLTemplate/TracerProviderBuilderExtensions.cs +++ b/Source/GraphQLTemplate/Source/GraphQLTemplate/TracerProviderBuilderExtensions.cs @@ -67,8 +67,6 @@ private static void Enrich(Activity activity, string eventName, object obj) if (obj is HttpRequest request) { var context = request.HttpContext; - activity.AddTag(OpenTelemetryAttributeName.Http.Flavor, OpenTelemetryHttpFlavour.GetHttpFlavour(request.Protocol)); - activity.AddTag(OpenTelemetryAttributeName.Http.Scheme, request.Scheme); activity.AddTag(OpenTelemetryAttributeName.Http.ClientIP, context.Connection.RemoteIpAddress); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentLength, request.ContentLength); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentType, request.ContentType); diff --git a/Source/OrleansTemplate/.template.config/template.json b/Source/OrleansTemplate/.template.config/template.json index 6ba6f1cac..e1b7a56de 100644 --- a/Source/OrleansTemplate/.template.config/template.json +++ b/Source/OrleansTemplate/.template.config/template.json @@ -86,7 +86,6 @@ "condition": "(!OpenTelemetry)", "exclude": [ "Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryAttributeName.cs", - "Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryHttpFlavour.cs", "Source/OrleansTemplate.Server/TracerProviderBuilderExtensions.cs" ] } diff --git a/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryAttributeName.cs b/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryAttributeName.cs index a78933358..1695ccf87 100644 --- a/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryAttributeName.cs +++ b/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryAttributeName.cs @@ -51,18 +51,6 @@ public static class EndUser /// public static class Http { - /// - /// The URI scheme identifying the used protocol. - /// - /// E.g. http or https. - public const string Scheme = "http.scheme"; - - /// - /// Kind of HTTP protocol used. - /// - /// E.g. 1.0, 1.1, 2.0, SPDY or QUIC. - public const string Flavor = "http.flavor"; - /// /// The IP address of the original client behind all proxies, if known (e.g. from X-Forwarded-For). /// diff --git a/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryHttpFlavour.cs b/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryHttpFlavour.cs deleted file mode 100644 index fd49d88c6..000000000 --- a/Source/OrleansTemplate/Source/OrleansTemplate.Abstractions/Constants/OpenTelemetryHttpFlavour.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OrleansTemplate.Abstractions.Constants; - -public static class OpenTelemetryHttpFlavour -{ - public const string Http10 = "1.0"; - public const string Http11 = "1.1"; - public const string Http20 = "2.0"; - public const string Http30 = "3.0"; -} diff --git a/Source/OrleansTemplate/Source/OrleansTemplate.Server/TracerProviderBuilderExtensions.cs b/Source/OrleansTemplate/Source/OrleansTemplate.Server/TracerProviderBuilderExtensions.cs index 4a2e509d5..2f464a06a 100644 --- a/Source/OrleansTemplate/Source/OrleansTemplate.Server/TracerProviderBuilderExtensions.cs +++ b/Source/OrleansTemplate/Source/OrleansTemplate.Server/TracerProviderBuilderExtensions.cs @@ -63,8 +63,6 @@ private static void Enrich(Activity activity, string eventName, object obj) if (obj is HttpRequest request) { var context = request.HttpContext; - activity.AddTag(OpenTelemetryAttributeName.Http.Flavor, GetHttpFlavour(request.Protocol)); - activity.AddTag(OpenTelemetryAttributeName.Http.Scheme, request.Scheme); activity.AddTag(OpenTelemetryAttributeName.Http.ClientIP, context.Connection.RemoteIpAddress); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentLength, request.ContentLength); activity.AddTag(OpenTelemetryAttributeName.Http.RequestContentType, request.ContentType); @@ -82,26 +80,4 @@ private static void Enrich(Activity activity, string eventName, object obj) activity.AddTag(OpenTelemetryAttributeName.Http.ResponseContentType, response.ContentType); } } - - private static string GetHttpFlavour(string protocol) - { - if (HttpProtocol.IsHttp10(protocol)) - { - return OpenTelemetryHttpFlavour.Http10; - } - else if (HttpProtocol.IsHttp11(protocol)) - { - return OpenTelemetryHttpFlavour.Http11; - } - else if (HttpProtocol.IsHttp2(protocol)) - { - return OpenTelemetryHttpFlavour.Http20; - } - else if (HttpProtocol.IsHttp3(protocol)) - { - return OpenTelemetryHttpFlavour.Http30; - } - - throw new InvalidOperationException($"Protocol {protocol} not recognised."); - } }