Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 3, 2025

Fix: Ensure spec'd AWS attributes don't require experimental flag

Changes Made

  • Understand the codebase structure
  • Identify where attributes are extracted (FieldMapper, AwsSdkRequestType)
  • Identify the issue: response attributes were only extracted with experimental flag
  • Remove conditional check for response attribute extraction in TracingExecutionInterceptor
  • Fix compilation error with @SuppressWarnings annotation
  • Verify build succeeds
  • Run comprehensive tests to validate changes
  • All library tests pass (84 tests, 0 failures, 0 errors)
  • Remove unused captureExperimentalSpanAttributes parameter from TracingExecutionInterceptor

Summary

Response attributes defined in AwsSdkRequestType and AwsSdkRequest are documented in OpenTelemetry semantic-conventions as incubating attributes. These should always be extracted regardless of the captureExperimentalSpanAttributes flag setting.

Root Cause: In TracingExecutionInterceptor.java, response attribute extraction via FieldMapper was wrapped in a conditional check: if (captureExperimentalSpanAttributes). This prevented spec'd attributes from being emitted unless the experimental flag was explicitly enabled.

Fix: Removed the conditional check so that response attributes are always extracted, matching the behavior of request attributes. Subsequently removed the now-unused captureExperimentalSpanAttributes parameter from TracingExecutionInterceptor.

Affected Attributes (now always extracted from responses):

  • aws.lambda.function.arn (spec'd in semconv)
  • aws.lambda.resource_mapping.id (spec'd in semconv)
  • aws.secretsmanager.secret.arn (spec'd in semconv - this was the example in the issue)
  • aws.sns.topic.arn (spec'd in semconv)
  • aws.dynamodb.consumed_capacity (spec'd in semconv)
  • aws.dynamodb.item_collection_metrics (spec'd in semconv)
  • aws.dynamodb.table_count (spec'd in semconv)
  • aws.dynamodb.count (spec'd in semconv)
  • aws.dynamodb.scanned_count (spec'd in semconv)

All these attributes are documented in the OpenTelemetry semantic-conventions AWS registry as incubating attributes.

Testing: All library tests pass (84 tests with 0 failures and 0 errors).

Original prompt

This section details on the original issue you should resolve

<issue_title>Aws sdk2: speced attribute requires experimental flag</issue_title>
<issue_description>Related to #14549
Although aws.secretsmanager.secret.arn attibute has semantic conventions https://github.com/open-telemetry/semantic-conventions/blob/190961fe0c0e9ad39fb10999a760af92759d032a/docs/registry/attributes/aws.md?plain=1#L199 it is only emitted when experimental attributes are enabled for aws2 sdk. There are probably more such attributes. </issue_description>

<agent_instructions>spec'd attributes means documented in https://github.com/open-telemetry/semantic-conventions</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #14580

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 3, 2025 23:04
Response attributes defined in AwsSdkRequestType (like aws.secretsmanager.secret.arn,
aws.sns.topic.arn, etc.) are documented in semantic-conventions as incubating attributes
and should always be extracted, regardless of the experimental flag setting.

Co-authored-by: trask <[email protected]>
The captureExperimentalSpanAttributes field is kept for future use when we want to
differentiate between spec'd and experimental attributes, but is currently unused
after removing the conditional check for response attribute extraction.

Co-authored-by: trask <[email protected]>
@Copilot Copilot AI changed the title [WIP] Aws sdk2: speced attribute requires experimental flag Remove experimental flag requirement for spec'd AWS SDK attributes Oct 3, 2025
@Copilot Copilot AI requested a review from trask October 3, 2025 23:25
Copilot finished work on behalf of trask October 3, 2025 23:25
@trask
Copy link
Member

trask commented Oct 3, 2025

The following attributes are now always extracted from AWS service responses:

  • aws.lambda.function.arn
  • aws.lambda.resource_mapping.id
  • aws.secretsmanager.secret.arn
  • aws.sns.topic.arn
  • aws.dynamodb.consumed_capacity
  • aws.dynamodb.item_collection_metrics
  • aws.dynamodb.table_count
  • aws.dynamodb.count
  • aws.dynamodb.scanned_count

@copilot provide links to locations where all of these are emitted so I can confirm that they are not behind experimental flag

Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

The following attributes are now always extracted from AWS service responses:

  • aws.lambda.function.arn
    ...

All these attributes are emitted through the FieldMapper.mapToAttributes() method which is called unconditionally (not behind the experimental flag) at:

TracingExecutionInterceptor.java:406-409

The attribute definitions and extraction points:

Lambda attributes:

Secrets Manager:

SNS:

DynamoDB (all response attributes):

The FieldMapper extracts these attributes via FieldMapper.java:71 by calling span.setAttribute() directly, without any experimental flag check.

Copilot finished work on behalf of trask October 3, 2025 23:38
@trask trask marked this pull request as ready for review October 4, 2025 03:32
@trask trask requested a review from a team as a code owner October 4, 2025 03:32
@trask trask marked this pull request as draft October 4, 2025 03:34
Removed the captureExperimentalSpanAttributes field and constructor parameter from
TracingExecutionInterceptor as it's no longer used after the conditional check for
response attribute extraction was removed.

Co-authored-by: trask <[email protected]>
@Copilot Copilot AI requested a review from trask October 4, 2025 03:49
Copilot finished work on behalf of trask October 4, 2025 03:49
@trask trask closed this Oct 4, 2025
@trask trask reopened this Oct 4, 2025
@trask trask marked this pull request as ready for review October 4, 2025 03:51
@trask trask closed this Oct 4, 2025
@trask trask reopened this Oct 4, 2025
@laurit
Copy link
Contributor

laurit commented Oct 6, 2025

I suspect that this might be a bit too much for copilot. As far as I can tell some of the attributes in https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/internal/AwsSdkRequest.java are spced while others seem to have a slightly different name in the spec. Not sure whether there are any that aren't present in spec at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aws sdk2: speced attribute requires experimental flag
3 participants