Skip to content

Commit

Permalink
Update libraries to impelement Semantic Convention 1.28 and 1.29
Browse files Browse the repository at this point in the history
  • Loading branch information
ppittle committed Dec 17, 2024
1 parent ab43e56 commit 78587b2
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion.V1_29_0_Experimental = 2 -> OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion.V1_27_0_Experimental = 1 -> OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion.V1_28_0_Experimental = 1 -> OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions
OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.AWSClientInstrumentationOptions() -> void
OpenTelemetry.Instrumentation.AWS.AWSClientInstrumentationOptions.SemanticConventionVersion.get -> OpenTelemetry.Instrumentation.AWS.SemanticConventionVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ namespace OpenTelemetry.Instrumentation.AWS.Implementation;
/// </summary>
internal class AWSTracingPipelineCustomizer : IRuntimePipelineCustomizer
{
public const string UniqueName = "AWS Tracing Registration Customization";

private readonly AWSClientInstrumentationOptions options;

public AWSTracingPipelineCustomizer(AWSClientInstrumentationOptions options)
{
this.options = options;
}

public string UniqueName => "AWS Tracing Registration Customization";
string IRuntimePipelineCustomizer.UniqueName => UniqueName;

public void Customize(Type serviceClientType, RuntimePipeline pipeline)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Instrumentation.AWS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ emit the GET as `"http.request.method"`.
Future versions the OpenTelemetry.*.AWS libraries will include updates to the
Semantic Convention, which may break compatibility with a previous version.

The default will remain as `V1_27_0_Experimental` until the next major version bump.
The default will remain as `V1_28_0_Experimental` until the next major version bump.

To opt in to automatic upgrades, you can use `SemanticConventionVersion.Latest`
or you can specify a specific version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion.V1_29_0_Experimental = 2 -> OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion.V1_27_0_Experimental = 1 -> OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion.V1_28_0_Experimental = 1 -> OpenTelemetry.Instrumentation.AWSLambda.SemanticConventionVersion
OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions
OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.AWSLambdaInstrumentationOptions() -> void
OpenTelemetry.Instrumentation.AWSLambda.AWSLambdaInstrumentationOptions.DisableAwsXRayContextExtraction.get -> bool
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Instrumentation.AWSLambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Future versions of OpenTelemetry.Instrumentation.AWSLambda library will include
updates to the Semantic Convention, which may break compatibility with a
previous version.

The default will remain as `V1_27_0_Experimental` until the next major version bump.
The default will remain as `V1_28_0_Experimental` until the next major version bump.

To opt in to automatic upgrades, you can use `SemanticConventionVersion.Latest`
or you can specify a specific version:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenTelemetry.Resources.AWS.SemanticConventionVersion
OpenTelemetry.Resources.AWS.SemanticConventionVersion.Latest = 0 -> OpenTelemetry.Resources.AWS.SemanticConventionVersion
OpenTelemetry.Resources.AWS.SemanticConventionVersion.V1_29_0_Experimental = 2 -> OpenTelemetry.Resources.AWS.SemanticConventionVersion
OpenTelemetry.Resources.AWS.SemanticConventionVersion.V1_27_0_Experimental = 1 -> OpenTelemetry.Resources.AWS.SemanticConventionVersion
OpenTelemetry.Resources.AWS.SemanticConventionVersion.V1_28_0_Experimental = 1 -> OpenTelemetry.Resources.AWS.SemanticConventionVersion
OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions
OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions.AWSResourceBuilderOptions() -> void
OpenTelemetry.Resources.AWS.AWSResourceBuilderOptions.SemanticConventionVersion.get -> OpenTelemetry.Resources.AWS.SemanticConventionVersion
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Resources.AWS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ emit the GET as `"http.request.method"`.
Future versions the OpenTelemetry.*.AWS libraries will include updates to the
Semantic Convention, which may break compatibility with a previous version.

The default will remain as `V1_27_0_Experimental` until the next major version bump.
The default will remain as `V1_28_0_Experimental` until the next major version bump.

To opt in to automatic upgrades, you can use `SemanticConventionVersion.Latest`
or you can specify a specific version:
Expand Down
59 changes: 46 additions & 13 deletions src/Shared/AWS/AWSSemanticConventions.Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ internal partial class AWSSemanticConventions
/// Defines all Semantic Conventions used by AWS extension projects.
///
/// All values default to <c>string.Empty</c> and are then is only defined
/// in the first version specific class (ie <see cref="AWSSemanticConventions_V1_27_0"/>)
/// in the first version specific class (ie <see cref="AWSSemanticConventions_V1_28_0"/>)
/// 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="GetSemanticConventionVersion"/> for details.
/// </summary>
private abstract class AWSSemanticConventionsBase
{
// CLOUD Attributes
#region CLOUD Attributes
/// <summary>
/// The cloud account ID the resource is assigned to.
/// </summary>
Expand Down Expand Up @@ -153,8 +153,9 @@ private abstract class AWSSemanticConventionsBase
/// CloudAttributes.CloudProviderValues.Aws
/// </remarks>
public virtual string CloudProviderValuesAws => string.Empty;
#endregion

// CONTAINER Attributes
#region CONTAINER Attributes

/// <summary>
/// Container ID. Usually a UUID, as for example used to <a href="https://docs.docker.com/engine/containers/run/#container-identification">identify Docker containers</a>. The UUID might be abbreviated.
Expand All @@ -163,8 +164,9 @@ private abstract class AWSSemanticConventionsBase
/// ContainerAttributes.AttributeContainerId
/// </remarks>
public virtual string AttributeContainerID => string.Empty;
#endregion

// DB Attributes
#region DB Attributes

/// <summary>
/// The database management system (DBMS) product as identified by the client instrumentation.
Expand All @@ -185,8 +187,9 @@ private abstract class AWSSemanticConventionsBase
/// DbAttributes.DbSystemValues.Dynamodb
/// </remarks>
public virtual string AttributeDynamoDb => string.Empty;
#endregion

// AWS Attributes
#region AWS Attributes

/// <summary>
/// The Amazon Resource Name (ARN) of an <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html">ECS container instance</a>.
Expand Down Expand Up @@ -331,7 +334,9 @@ private abstract class AWSSemanticConventionsBase
/// </summary>
public virtual string AttributeAWSBedrock => string.Empty;

// FAAS Attributes
#endregion

#region FAAS Attributes

/// <summary>
/// Cloud provider-specific native identifier of the monitored cloud resource (e.g. an <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> on AWS, a <a href="https://learn.microsoft.com/rest/api/resources/resources/get-by-id">fully qualified resource ID</a> on Azure, a <a href="https://cloud.google.com/apis/design/resource_names#full_resource_name">full resource name</a> on GCP).
Expand Down Expand Up @@ -434,8 +439,9 @@ private abstract class AWSSemanticConventionsBase
/// FaasAttributes.AttributeFaasColdstart
/// </remarks>
public virtual string AttributeFaasColdStart => string.Empty;
#endregion

// GEN AI Attributes
#region GEN AI Attributes
/// <summary>
/// The name of the GenAI model a request is being made to.
/// </summary>
Expand Down Expand Up @@ -463,7 +469,9 @@ private abstract class AWSSemanticConventionsBase
/// </remarks>
public virtual string AttributeGenAiSystem => string.Empty;

// HOST Attributes
#endregion

#region HOST Attributes

/// <summary>
/// Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the <c>machine-id</c>. See the table below for the sources to use to determine the <c>machine-id</c> based on operating system.
Expand All @@ -489,7 +497,9 @@ private abstract class AWSSemanticConventionsBase
/// </remarks>
public virtual string AttributeHostName => string.Empty;

// HTTP Attributes
#endregion

#region HTTP Attributes

/// <summary>
/// Deprecated, use <c>http.response.status_code</c> instead.
Expand Down Expand Up @@ -559,7 +569,9 @@ private abstract class AWSSemanticConventionsBase
/// </remarks>
public virtual string AttributeHttpRequestMethod => string.Empty;

// NET Attributes
#endregion

#region NET Attributes

/// <summary>
/// Deprecated, use <c>server.address</c>.
Expand All @@ -579,7 +591,9 @@ private abstract class AWSSemanticConventionsBase
[Obsolete("Replaced by <c>server.port</c>.")]
public virtual string AttributeNetHostPort => string.Empty;

// SERVER Attributes
#endregion

#region SERVER Attributes

/// <summary>
/// Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
Expand Down Expand Up @@ -613,7 +627,9 @@ private abstract class AWSSemanticConventionsBase
/// </remarks>
public virtual string AttributeK8SClusterName => string.Empty;

// SERVICE Attributes
#endregion

#region SERVICE Attributes

/// <summary>
/// Logical name of the service.
Expand Down Expand Up @@ -686,7 +702,9 @@ private abstract class AWSSemanticConventionsBase
/// </summary>
public virtual string ServiceNameValuesAwsElasticBeanstalk => string.Empty;

// URL Attributes
#endregion

#region URL Attributes

/// <summary>
/// The <a href="https://www.rfc-editor.org/rfc/rfc3986#section-3.3">URI path</a> component.
Expand All @@ -704,6 +722,19 @@ private abstract class AWSSemanticConventionsBase
/// </summary>
/// <remarks>
/// Sensitive content provided in <c>url.query</c> SHOULD be scrubbed when instrumentations can identify it.
/// <p>
/// Query string values for the following keys SHOULD be redacted by default and replaced by the value <c>REDACTED</c>:
/// <p>
/// <ul>
/// <li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth"><c>AWSAccessKeyId</c></a></li>
/// <li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth"><c>Signature</c></a></li>
/// <li><a href="https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token"><c>sig</c></a></li>
/// <li><a href="https://cloud.google.com/storage/docs/access-control/signed-urls"><c>X-Goog-Signature</c></a></li>
/// </ul>
/// This list is subject to change over time.
/// <p>
/// When a query string value is redacted, the query string key SHOULD still be preserved, e.g.
/// <c>q=OpenTelemetry&sig=REDACTED</c>.
/// </remarks>
/// <remarks>
/// UrlAttributes.AttributeUrlQuery
Expand All @@ -717,5 +748,7 @@ private abstract class AWSSemanticConventionsBase
/// UrlAttributes.AttributeUrlScheme
/// </remarks>
public virtual string AttributeUrlScheme => string.Empty;

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ namespace OpenTelemetry.AWS;
internal partial class AWSSemanticConventions
{
/// <summary>
/// Open Telemetry Semantic Conventions as of the 1.27.0
/// https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.27.0.
/// The Open Telemetry Semantic Conventions used by OpenTelemetry.*.AWS libraries as of
/// version 1.10.0-beta and represents a mixture of Semantic Conventions as these libraries had
/// not yet been upgraded to use a specific Semantic Convention version.
/// </summary>
/// <remarks>
/// This is the first version to include Semantic Conventions defined in this manner, so it
/// defines string constants for all attributes.
///
/// Future version specific convention classes will only need to define new or changed attributes.
/// </remarks>
private class AWSSemanticConventions_V1_27_0 : AWSSemanticConventionsBase
private class AWSSemanticConventionsLegacy : AWSSemanticConventionsBase
{
// CLOUD Attributes
public override string AttributeCloudAccountID => "cloud.account.id";
Expand Down
8 changes: 4 additions & 4 deletions src/Shared/AWS/AWSSemanticConventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ internal partial class AWSSemanticConventions
/// </summary>
/// <remarks>
/// Per SemanticConventionVersion, default should stay as
/// <see cref="SemanticConventionVersion.V1_27_0_Experimental"/> until next major version bump.
/// <see cref="SemanticConventionVersion.V1_28_0_Experimental"/> until next major version bump.
/// </remarks>
internal const SemanticConventionVersion DefaultSemanticConventionVersion = SemanticConventionVersion.V1_27_0_Experimental;
internal const SemanticConventionVersion DefaultSemanticConventionVersion = SemanticConventionVersion.V1_28_0_Experimental;

private readonly SemanticConventionVersion semanticConventionVersion;

Expand Down Expand Up @@ -485,8 +485,8 @@ private AWSSemanticConventionsBase GetSemanticConventionVersion()
case SemanticConventionVersion.V1_29_0_Experimental:
return new AWSSemanticConventions_V1_29_0();

case SemanticConventionVersion.V1_27_0_Experimental:
return new AWSSemanticConventions_V1_27_0();
case SemanticConventionVersion.V1_28_0_Experimental:
return new AWSSemanticConventions_V1_28_0();

default:
throw new InvalidEnumArgumentException(
Expand Down
55 changes: 55 additions & 0 deletions src/Shared/AWS/AWSSemanticConventions.v1.28.0.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

namespace OpenTelemetry.AWS;

// disable Style Warnings to improve readability of this specific file.
#pragma warning disable SA1124
#pragma warning disable SA1005
#pragma warning disable SA1514
#pragma warning disable SA1201
#pragma warning disable SA1516

internal partial class AWSSemanticConventions
{
/// <summary>
/// Open Telemetry Semantic Conventions as of 1.28.0:
/// https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.28.0.
/// </summary>
private class AWSSemanticConventions_V1_28_0 : AWSSemanticConventionsLegacy
{
public override string AttributeAWSDynamoTableName => "aws.dynamodb.table_names";

// FAAS Attributes
public override string AttributeFaasID => "cloud.resource_id";
public override string AttributeFaasExecution => "faas.invocation_id";

// HTTP Attributes
[Obsolete("Replaced by <c>http.response.status_code</c>.")]
public override string AttributeHttpStatusCode => string.Empty; // value no longer written
[Obsolete("Replaced by <c>url.scheme</c> instead.")]
public override string AttributeHttpScheme => string.Empty; // value no longer written

[Obsolete("Split to <c>url.path</c> and `url.query.")]
public override string AttributeHttpTarget => string.Empty; // value no longer written
[Obsolete("Replaced by <c>http.request.method</c>.")]
public override string AttributeHttpMethod => string.Empty; // value no longer written
public override string AttributeHttpResponseStatusCode => "http.response.status_code";
public override string AttributeHttpRequestMethod => "http.request.method";

// NET Attributes
[Obsolete("Replaced by <c>server.address</c>.")]
public override string AttributeNetHostName => string.Empty; // value no longer written
[Obsolete("Replaced by <c>server.port</c>.")]
public override string AttributeNetHostPort => string.Empty; // value no longer written

// SERVER Attributes
public override string AttributeServerAddress => "server.address";
public override string AttributeServerPort => "server.port";

// URL Attributes
public override string AttributeUrlPath => "url.path";
public override string AttributeUrlQuery => "url.query";
public override string AttributeUrlScheme => "url.scheme";
}
}
35 changes: 1 addition & 34 deletions src/Shared/AWS/AWSSemanticConventions.v1.29.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,9 @@ internal partial class AWSSemanticConventions
/// Open Telemetry Semantic Conventions as of 1.29.0:
/// https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.29.0.
/// </summary>
private class AWSSemanticConventions_V1_29_0 : AWSSemanticConventions_V1_27_0
private class AWSSemanticConventions_V1_29_0 : AWSSemanticConventions_V1_28_0
{
// AWS Attributes
public override string AttributeAWSBedrock => "aws.bedrock";
public override string AttributeAWSDynamoTableName => "aws.dynamodb.table_names";

// FAAS Attributes
public override string AttributeFaasID => "cloud.resource_id";
public override string AttributeFaasExecution => "faas.invocation_id";

// HTTP Attributes
[Obsolete("Replaced by <c>http.response.status_code</c>.")]
public override string AttributeHttpStatusCode => string.Empty; // value no longer written
[Obsolete("Replaced by <c>url.scheme</c> instead.")]
public override string AttributeHttpScheme => string.Empty; // value no longer written

[Obsolete("Split to <c>url.path</c> and `url.query.")]
public override string AttributeHttpTarget => string.Empty; // value no longer written
[Obsolete("Replaced by <c>http.request.method</c>.")]
public override string AttributeHttpMethod => string.Empty; // value no longer written
public override string AttributeHttpResponseStatusCode => "http.response.status_code";
public override string AttributeHttpRequestMethod => "http.request.method";

// NET Attributes
[Obsolete("Replaced by <c>server.address</c>.")]
public override string AttributeNetHostName => string.Empty; // value no longer written
[Obsolete("Replaced by <c>server.port</c>.")]
public override string AttributeNetHostPort => string.Empty; // value no longer written

// SERVER Attributes
public override string AttributeServerAddress => "server.address";
public override string AttributeServerPort => "server.port";

// URL Attributes
public override string AttributeUrlPath => "url.path";
public override string AttributeUrlQuery => "url.query";
public override string AttributeUrlScheme => "url.scheme";
}
}
Loading

0 comments on commit 78587b2

Please sign in to comment.