From 1dbdb19c44569593dc520fa4b5092ab5378a3194 Mon Sep 17 00:00:00 2001 From: philip pittle Date: Thu, 5 Dec 2024 20:44:50 -0800 Subject: [PATCH] run dotnet format --- .../.publicApi/PublicAPI.Unshipped.txt | 5 ++++ .../AWSTracingPipelineHandler.cs | 1 - .../.publicApi/PublicAPI.Unshipped.txt | 5 ++++ .../AWSLambdaInstrumentationOptions.cs | 2 +- .../Implementation/AWSLambdaHttpUtils.cs | 1 - .../Implementation/AWSLambdaUtils.cs | 2 +- .../.publicApi/PublicAPI.Unshipped.txt | 13 +++++++-- .../.publicApi/net8.0/PublicAPI.Unshipped.txt | 4 +-- .../AWSECSDetector.cs | 1 - .../AWSResourceBuilderExtensions.cs | 4 +++ src/Shared/AWS/AWSSemanticConventions.Base.cs | 5 ++-- src/Shared/AWS/AWSSemanticConventions.cs | 7 +++-- .../AWS/AWSSemanticConventions.v1.10.cs | 3 ++ .../AWS/AWSSemanticConventions.v1.10_1.cs | 4 +++ src/Shared/AWS/SemanticConventionVersion.cs | 3 ++ .../AWSLambdaInstrumentationOptionsTests.cs | 28 +++++++++---------- 16 files changed, 59 insertions(+), 29 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.AWS/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AWS/.publicApi/PublicAPI.Unshipped.txt index e89899177b..c215e54797 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Instrumentation.AWS/.publicApi/PublicAPI.Unshipped.txt @@ -1,7 +1,12 @@ #nullable enable OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_1_Experimental = 2 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_Experimental = 1 -> OpenTelemetry.AWS.SemanticConventionVersion OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.AWSClientInstrumentationOptions() -> void +OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.SemanticConventionVersion.get -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.SemanticConventionVersion.set -> void OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.SuppressDownstreamInstrumentation.get -> bool OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.SuppressDownstreamInstrumentation.set -> void OpenTelemetry.Trace.TracerProviderBuilderExtensions diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs index 6497c569e9..4a95f2768a 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs +++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs @@ -7,7 +7,6 @@ using Amazon.Runtime.Telemetry; using OpenTelemetry.AWS; using OpenTelemetry.Context.Propagation; -using OpenTelemetry.Trace; namespace OpenTelemetry.Instrumentation.AWS.Implementation; diff --git a/src/OpenTelemetry.Instrumentation.AWSLambda/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.AWSLambda/.publicApi/PublicAPI.Unshipped.txt index c15767dc98..aa2cbd314b 100644 --- a/src/OpenTelemetry.Instrumentation.AWSLambda/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Instrumentation.AWSLambda/.publicApi/PublicAPI.Unshipped.txt @@ -1,11 +1,16 @@ #nullable enable OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_1_Experimental = 2 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_Experimental = 1 -> OpenTelemetry.AWS.SemanticConventionVersion OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.AWSLambdaInstrumentationOptions() -> void OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.DisableAwsXRayContextExtraction.get -> bool OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.DisableAwsXRayContextExtraction.set -> void OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.SetParentFromBatch.get -> bool OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.SetParentFromBatch.set -> void +OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.SemanticConventionVersion.get -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.SemanticConventionVersion.set -> void OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaWrapper OpenTelemetry.Instrumentation.AWSLambda.TracerProviderBuilderExtensions static OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaWrapper.Trace(OpenTelemetry.Trace.TracerProvider? tracerProvider, System.Func! lambdaHandler, TInput input, Amazon.Lambda.Core.ILambdaContext! context, System.Diagnostics.ActivityContext parentContext = default(System.Diagnostics.ActivityContext)) -> TResult diff --git a/src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaInstrumentationOptions.cs index 457175d389..3080d90335 100644 --- a/src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.AWSLambda/AWSLambdaInstrumentationOptions.cs @@ -24,6 +24,6 @@ public class AWSLambdaInstrumentationOptions /// public bool SetParentFromBatch { get; set; } - /// + /// public SemanticConventionVersion SemanticConventionVersion { get; set; } = AWSSemanticConventions.DefaultSemanticConventionVersion; } diff --git a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaHttpUtils.cs b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaHttpUtils.cs index 1d9a73f7ac..ba554d06e3 100644 --- a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaHttpUtils.cs +++ b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaHttpUtils.cs @@ -7,7 +7,6 @@ using Amazon.Lambda.APIGatewayEvents; using Amazon.Lambda.ApplicationLoadBalancerEvents; using OpenTelemetry.AWS; -using OpenTelemetry.Internal; namespace OpenTelemetry.Instrumentation.AWSLambda.Implementation; diff --git a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs index 31aabeb321..a772c5f761 100644 --- a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs +++ b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSLambdaUtils.cs @@ -156,7 +156,7 @@ internal static IEnumerable> GetFunctionTags::function: - var items = functionArn.Split(':'); + var items = functionArn!.Split(':'); return items.Length >= 5 ? items[4] : null; } diff --git a/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt index a6dd3ce0c5..abbd25c43d 100644 --- a/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt @@ -1,3 +1,12 @@ +OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_1_Experimental = 2 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.AWS.SemanticConventionVersion.v1_10_Experimental = 1 -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions +OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions.AWSResourceBuilderOptions() -> void +OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions.SemanticConventionVersion.get -> OpenTelemetry.AWS.SemanticConventionVersion +OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions.SemanticConventionVersion.set -> void OpenTelemetry.Resources.AWSResourceBuilderExtensions -static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEBSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! -static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEC2Detector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEBSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action? configure = null) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEC2Detector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action? configure = null) -> OpenTelemetry.Resources.ResourceBuilder! + diff --git a/src/OpenTelemetry.Resources.AWS/.publicApi/net8.0/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Resources.AWS/.publicApi/net8.0/PublicAPI.Unshipped.txt index dd8d0109c1..1eb23ec46e 100644 --- a/src/OpenTelemetry.Resources.AWS/.publicApi/net8.0/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Resources.AWS/.publicApi/net8.0/PublicAPI.Unshipped.txt @@ -1,2 +1,2 @@ -static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSECSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! -static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEKSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSECSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action? configure = null) -> OpenTelemetry.Resources.ResourceBuilder! +static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEKSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action? configure = null) -> OpenTelemetry.Resources.ResourceBuilder! diff --git a/src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs b/src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs index 15869ad232..04d546fba2 100644 --- a/src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs @@ -5,7 +5,6 @@ using System.Text.Json; using System.Text.RegularExpressions; using OpenTelemetry.AWS; -using OpenTelemetry.SemanticConventions; namespace OpenTelemetry.Resources.AWS; diff --git a/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs b/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs index 30bb40319a..d671ab9892 100644 --- a/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs +++ b/src/OpenTelemetry.Resources.AWS/AWSResourceBuilderExtensions.cs @@ -16,6 +16,7 @@ public static class AWSResourceBuilderExtensions /// Enables AWS Elastic Beanstalk resource detector. /// /// The being configured. + /// Optional callback action for configuring . /// The instance of being configured. public static ResourceBuilder AddAWSEBSDetector(this ResourceBuilder builder, Action? configure = null) { @@ -33,6 +34,7 @@ public static ResourceBuilder AddAWSEBSDetector(this ResourceBuilder builder, Ac /// Enables AWS EC2 resource detector. /// /// The being configured. + /// Optional callback action for configuring . /// The instance of being configured. public static ResourceBuilder AddAWSEC2Detector(this ResourceBuilder builder, Action? configure = null) { @@ -51,6 +53,7 @@ public static ResourceBuilder AddAWSEC2Detector(this ResourceBuilder builder, Ac /// Enables AWS ECS resource detector. /// /// The being configured. + /// Optional callback action for configuring . /// The instance of being configured. public static ResourceBuilder AddAWSECSDetector(this ResourceBuilder builder, Action? configure = null) { @@ -68,6 +71,7 @@ public static ResourceBuilder AddAWSECSDetector(this ResourceBuilder builder, Ac /// Enables AWS EKS resource detector. /// /// The being configured. + /// Optional callback action for configuring . /// The instance of being configured. public static ResourceBuilder AddAWSEKSDetector(this ResourceBuilder builder, Action? configure = null) { diff --git a/src/Shared/AWS/AWSSemanticConventions.Base.cs b/src/Shared/AWS/AWSSemanticConventions.Base.cs index d4aa76d586..370a96ac84 100644 --- a/src/Shared/AWS/AWSSemanticConventions.Base.cs +++ b/src/Shared/AWS/AWSSemanticConventions.Base.cs @@ -1,7 +1,8 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 using OpenTelemetry.SemanticConventions; - namespace OpenTelemetry.AWS; // disable Style Warnings to improve readability of this specific file. @@ -21,7 +22,7 @@ internal static partial class AWSSemanticConventions /// to use it. This helps ensure the attribute doesn't get used if the user has specified /// a specific . /// - /// See for details. + /// See for details. /// private abstract class AWSSemanticConventionsBase { diff --git a/src/Shared/AWS/AWSSemanticConventions.cs b/src/Shared/AWS/AWSSemanticConventions.cs index 1d6a245f77..bf38f5a35a 100644 --- a/src/Shared/AWS/AWSSemanticConventions.cs +++ b/src/Shared/AWS/AWSSemanticConventions.cs @@ -14,11 +14,12 @@ namespace OpenTelemetry.AWS; /// -/// Abstracts the complexities of honoring . +/// Abstracts the complexities of honoring . /// /// Classes emitting attributes can use the extension methods in this class to build -/// a List of s containing Attribute Name and Value without -/// needing to know which version of the Semantic Convention to use. +/// a List of s containing +/// Attribute Name and Value without needing to know which version of the +/// Semantic Convention to use. /// /// Below is a hypothetical example showing how attributes can be constructed. It is not necessary /// for this consumer to accommodate differing behavior based on , diff --git a/src/Shared/AWS/AWSSemanticConventions.v1.10.cs b/src/Shared/AWS/AWSSemanticConventions.v1.10.cs index 36286dd295..f3b594bd7d 100644 --- a/src/Shared/AWS/AWSSemanticConventions.v1.10.cs +++ b/src/Shared/AWS/AWSSemanticConventions.v1.10.cs @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + namespace OpenTelemetry.AWS; // disable Style Warnings to improve readability of this specific file. diff --git a/src/Shared/AWS/AWSSemanticConventions.v1.10_1.cs b/src/Shared/AWS/AWSSemanticConventions.v1.10_1.cs index 2455ed850a..399f864ec9 100644 --- a/src/Shared/AWS/AWSSemanticConventions.v1.10_1.cs +++ b/src/Shared/AWS/AWSSemanticConventions.v1.10_1.cs @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + namespace OpenTelemetry.AWS; // disable Style Warnings to improve readability of this specific file. @@ -21,6 +24,7 @@ private class AWSSemanticConventions_v1_10_1 : AWSSemanticConventions_v1_10 // HTTP Attributes public override string AttributeHttpStatusCode => this.AttributeHttpResponseStatusCode; public override string AttributeHttpScheme => this.AttributeUrlScheme; + //public override string AttributeHttpTarget => string.Empty; // value no longer written ---- move to new PR public override string AttributeHttpMethod => this.AttributeHttpRequestMethod; public override string AttributeHttpResponseStatusCode => "http.response.status_code"; diff --git a/src/Shared/AWS/SemanticConventionVersion.cs b/src/Shared/AWS/SemanticConventionVersion.cs index b521738d79..6d2706fefc 100644 --- a/src/Shared/AWS/SemanticConventionVersion.cs +++ b/src/Shared/AWS/SemanticConventionVersion.cs @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + namespace OpenTelemetry.AWS; #pragma warning disable SA1300 diff --git a/test/OpenTelemetry.Instrumentation.AWSLambda.Tests/Implementation/AWSLambdaInstrumentationOptionsTests.cs b/test/OpenTelemetry.Instrumentation.AWSLambda.Tests/Implementation/AWSLambdaInstrumentationOptionsTests.cs index 7f53ba59cf..244a9ee919 100644 --- a/test/OpenTelemetry.Instrumentation.AWSLambda.Tests/Implementation/AWSLambdaInstrumentationOptionsTests.cs +++ b/test/OpenTelemetry.Instrumentation.AWSLambda.Tests/Implementation/AWSLambdaInstrumentationOptionsTests.cs @@ -20,7 +20,7 @@ namespace OpenTelemetry.Instrumentation.AWSLambda.Tests.Implementation; #else [Collection("Sequential-.NET8")] #endif -public class AWSLambdaInstrumentationOptionsTests :IDisposable +public sealed class AWSLambdaInstrumentationOptionsTests : IDisposable { [Fact] public void CanUseSemanticConvention1_10() @@ -56,6 +56,16 @@ public void CanUseSemanticConvention1_10_1() this.CheckHttpTags(semanticVersion, expectedTags); } + public void Dispose() + { + // Semantic Convention is saved statically - and needs to be reset to + // Latest following these tests. + Sdk.CreateTracerProviderBuilder() + .AddAWSLambdaConfigurations(c => + c.SemanticConventionVersion = SemanticConventionVersion.Latest) + .Build(); + } + private void CheckHttpTags(SemanticConventionVersion version, List expectedTags) { var request = new APIGatewayProxyRequest @@ -72,11 +82,10 @@ private void CheckHttpTags(SemanticConventionVersion version, List expec }, }; - using var _ = + using var builder = Sdk.CreateTracerProviderBuilder() .AddAWSLambdaConfigurations(c => - c.SemanticConventionVersion = version - ) + c.SemanticConventionVersion = version) .Build(); var actualTags = AWSLambdaHttpUtils.GetHttpTags(request); @@ -96,15 +105,4 @@ private void AssertContainsTags(List expectedTags, IEnumer Assert.Contains(tag, keys); } } - - public void Dispose() - { - // Semantic Convention is saved statically - and needs to be reset to - // Latest following these tests. - Sdk.CreateTracerProviderBuilder() - .AddAWSLambdaConfigurations(c => - c.SemanticConventionVersion = SemanticConventionVersion.Latest - ) - .Build(); - } }