Skip to content

Commit

Permalink
run dotnet format
Browse files Browse the repository at this point in the history
  • Loading branch information
ppittle committed Dec 6, 2024
1 parent 2144722 commit 1dbdb19
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Amazon.Runtime.Telemetry;
using OpenTelemetry.AWS;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.AWS.Implementation;

Expand Down
Original file line number Diff line number Diff line change
@@ -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<TInput, TResult>(OpenTelemetry.Trace.TracerProvider? tracerProvider, System.Func<TInput, Amazon.Lambda.Core.ILambdaContext!, TResult>! lambdaHandler, TInput input, Amazon.Lambda.Core.ILambdaContext! context, System.Diagnostics.ActivityContext parentContext = default(System.Diagnostics.ActivityContext)) -> TResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public class AWSLambdaInstrumentationOptions
/// </remarks>
public bool SetParentFromBatch { get; set; }

/// <inheritdoc cref="OpenTelemetry.AWS.SemanticConventionVersion"/>
/// <inheritdoc cref="AWS.SemanticConventionVersion"/>
public SemanticConventionVersion SemanticConventionVersion { get; set; } = AWSSemanticConventions.DefaultSemanticConventionVersion;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Amazon.Lambda.APIGatewayEvents;
using Amazon.Lambda.ApplicationLoadBalancerEvents;
using OpenTelemetry.AWS;
using OpenTelemetry.Internal;

namespace OpenTelemetry.Instrumentation.AWSLambda.Implementation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ internal static IEnumerable<KeyValuePair<string, object>> GetFunctionTags<TInput
// The fifth item of function arn: https://github.com/open-telemetry/opentelemetry-specification/blob/86aeab1e0a7e6c67be09c7f15ff25063ee6d2b5c/specification/trace/semantic_conventions/instrumentation/aws-lambda.md#all-triggers
// Function arn format - arn:aws:lambda:<region>:<account-id>:function:<function-name>

var items = functionArn.Split(':');
var items = functionArn!.Split(':');
return items.Length >= 5 ? items[4] : null;
}

Expand Down
13 changes: 11 additions & 2 deletions src/OpenTelemetry.Resources.AWS/.publicApi/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -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<OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions!>? configure = null) -> OpenTelemetry.Resources.ResourceBuilder!
static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEC2Detector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action<OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions!>? configure = null) -> OpenTelemetry.Resources.ResourceBuilder!

Original file line number Diff line number Diff line change
@@ -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<OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions!>? configure = null) -> OpenTelemetry.Resources.ResourceBuilder!
static OpenTelemetry.Resources.AWSResourceBuilderExtensions.AddAWSEKSDetector(this OpenTelemetry.Resources.ResourceBuilder! builder, System.Action<OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions!>? configure = null) -> OpenTelemetry.Resources.ResourceBuilder!
1 change: 0 additions & 1 deletion src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Text.Json;
using System.Text.RegularExpressions;
using OpenTelemetry.AWS;
using OpenTelemetry.SemanticConventions;

namespace OpenTelemetry.Resources.AWS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class AWSResourceBuilderExtensions
/// Enables AWS Elastic Beanstalk resource detector.
/// </summary>
/// <param name="builder">The <see cref="ResourceBuilder"/> being configured.</param>
/// <param name="configure">Optional callback action for configuring <see cref="AWSResourceBuilderOptions"/>.</param>
/// <returns>The instance of <see cref="ResourceBuilder"/> being configured.</returns>
public static ResourceBuilder AddAWSEBSDetector(this ResourceBuilder builder, Action<AWSResourceBuilderOptions>? configure = null)
{
Expand All @@ -33,6 +34,7 @@ public static ResourceBuilder AddAWSEBSDetector(this ResourceBuilder builder, Ac
/// Enables AWS EC2 resource detector.
/// </summary>
/// <param name="builder">The <see cref="ResourceBuilder"/> being configured.</param>
/// <param name="configure">Optional callback action for configuring <see cref="AWSResourceBuilderOptions"/>.</param>
/// <returns>The instance of <see cref="ResourceBuilder"/> being configured.</returns>
public static ResourceBuilder AddAWSEC2Detector(this ResourceBuilder builder, Action<AWSResourceBuilderOptions>? configure = null)
{
Expand All @@ -51,6 +53,7 @@ public static ResourceBuilder AddAWSEC2Detector(this ResourceBuilder builder, Ac
/// Enables AWS ECS resource detector.
/// </summary>
/// <param name="builder">The <see cref="ResourceBuilder"/> being configured.</param>
/// <param name="configure">Optional callback action for configuring <see cref="AWSResourceBuilderOptions"/>.</param>
/// <returns>The instance of <see cref="ResourceBuilder"/> being configured.</returns>
public static ResourceBuilder AddAWSECSDetector(this ResourceBuilder builder, Action<AWSResourceBuilderOptions>? configure = null)
{
Expand All @@ -68,6 +71,7 @@ public static ResourceBuilder AddAWSECSDetector(this ResourceBuilder builder, Ac
/// Enables AWS EKS resource detector.
/// </summary>
/// <param name="builder">The <see cref="ResourceBuilder"/> being configured.</param>
/// <param name="configure">Optional callback action for configuring <see cref="AWSResourceBuilderOptions"/>.</param>
/// <returns>The instance of <see cref="ResourceBuilder"/> being configured.</returns>
public static ResourceBuilder AddAWSEKSDetector(this ResourceBuilder builder, Action<AWSResourceBuilderOptions>? configure = null)
{
Expand Down
5 changes: 3 additions & 2 deletions src/Shared/AWS/AWSSemanticConventions.Base.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 cref="SemanticConventionVersion"/>.
///
/// See <see cref="AWSSemanticConventions.GetSemanticConventionVersion"/> for details.
/// See <see cref="GetSemanticConventionVersion"/> for details.
/// </summary>
private abstract class AWSSemanticConventionsBase
{
Expand Down
7 changes: 4 additions & 3 deletions src/Shared/AWS/AWSSemanticConventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
namespace OpenTelemetry.AWS;

/// <summary>
/// Abstracts the complexities of honoring <see cref="OpenTelemetry.AWS.SemanticConventionVersion"/>.
/// Abstracts the complexities of honoring <see cref="AWS.SemanticConventionVersion"/>.
/// <para/>
/// Classes emitting attributes can use the extension methods in this class to build
/// a List of <see cref="KeyValuePair"/>s containing Attribute Name and Value without
/// needing to know which version of the Semantic Convention to use.
/// a List of <see cref="KeyValuePair{K,V}"/>s containing
/// Attribute Name and Value without needing to know which version of the
/// Semantic Convention to use.
/// <example>
/// Below is a hypothetical example showing how attributes can be constructed. It is not necessary
/// for this consumer to accommodate differing behavior based on <see cref="SemanticConventionVersion"/>,
Expand Down
3 changes: 3 additions & 0 deletions src/Shared/AWS/AWSSemanticConventions.v1.10.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/AWS/AWSSemanticConventions.v1.10_1.cs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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";
Expand Down
3 changes: 3 additions & 0 deletions src/Shared/AWS/SemanticConventionVersion.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

namespace OpenTelemetry.AWS;

#pragma warning disable SA1300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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<string> expectedTags)
{
var request = new APIGatewayProxyRequest
Expand All @@ -72,11 +82,10 @@ private void CheckHttpTags(SemanticConventionVersion version, List<string> expec
},
};

using var _ =
using var builder =
Sdk.CreateTracerProviderBuilder()
.AddAWSLambdaConfigurations(c =>
c.SemanticConventionVersion = version
)
c.SemanticConventionVersion = version)
.Build();

var actualTags = AWSLambdaHttpUtils.GetHttpTags(request);
Expand All @@ -96,15 +105,4 @@ private void AssertContainsTags<TActualValue>(List<string> 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();
}
}

0 comments on commit 1dbdb19

Please sign in to comment.