Skip to content

opentelemetry-instrumentation-boto3sqs: migrate to current messaging semantic conventions - #4920

Open
anneheartrecord wants to merge 3 commits into
open-telemetry:mainfrom
anneheartrecord:fix/boto3sqs-semconv
Open

opentelemetry-instrumentation-boto3sqs: migrate to current messaging semantic conventions#4920
anneheartrecord wants to merge 3 commits into
open-telemetry:mainfrom
anneheartrecord:fix/boto3sqs-semconv

Conversation

@anneheartrecord

Copy link
Copy Markdown
Contributor

Description

Migrates the boto3sqs instrumentation off the deprecated opentelemetry.semconv.trace.SpanAttributes (schema 1.11.0) onto the current incubating messaging attributes, following the pattern already used by the aiokafka instrumentation:

  • messaging.system: aws.sqsaws_sqs (MessagingSystemValues.AWS_SQS)
  • messaging.destinationmessaging.destination.name
  • messaging.operationmessaging.operation.name (send/receive/process) + messaging.operation.type; send spans now carry operation attributes too
  • dropped messaging.destination_kind and messaging.url (removed from the spec)
  • dropped messaging.conversation_id, which was being set to the send_message_batch entry Id (not a conversation/message-group id per spec)
  • tracer schema_url: 1.11.0 → Schemas.V1_27_0 (same as aiokafka)

Span names are intentionally left as {queue} {operation} to match the existing aiokafka naming and avoid an extra breaking change; happy to adjust if you'd rather move to {operation} {queue} here as well.

Fixes #1639

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — emitted span attribute names/values change

How Has This Been Tested?

  • Updated tests/test_boto3sqs_instrumentation.py to assert the new attributes; full suite passes locally (16 passed) with boto3/botocore 1.34.44 (the pinned test versions), plus ruff check / ruff format --check.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@anneheartrecord
anneheartrecord requested a review from a team as a code owner August 3, 2026 05:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 778f72b085

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +140 to +141
operation_name: str,
operation_type: MessagingOperationTypeValues,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the SQS endpoint in the new convention

Removing queue_url from _enrich_span drops the previous endpoint information without replacing it with the current convention's server.address (and server.port for non-default ports), even though every instrumented call already supplies the queue URL. As a result, spans for AWS endpoints and especially LocalStack/custom endpoints can no longer identify the server that handled the operation, and the declared v1.27 messaging telemetry is incomplete; retain and parse the URL using the generated server attribute constants.

AGENTS.md reference: AGENTS.md:L84-L87

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — added server.address (and server.port when the URL carries an explicit port, e.g. LocalStack) parsed from the queue URL in _enrich_span, replacing the endpoint info the old messaging.url attribute provided. Covered by the updated default-attrs assertions plus a new custom-endpoint test. 5804e8c

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5804e8c649

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +162 to +163
if parsed_url.port:
span.set_attribute(SERVER_PORT, parsed_url.port)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle malformed queue URLs without changing application errors

When a custom QueueUrl contains a nonnumeric or out-of-range port, accessing parsed_url.port raises ValueError before the wrapped botocore operation runs. Previously this value was forwarded so botocore could produce its own validation or request error; the instrumentation now changes application behavior instead of preserving the underlying exception. Skip the server attributes when URL parsing fails.

AGENTS.md reference: AGENTS.md:L80-L82

Useful? React with 👍 / 👎.

Comment on lines +162 to +163
if parsed_url.port:
span.set_attribute(SERVER_PORT, parsed_url.port)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Omit default ports from server.port

When a valid queue URL explicitly includes its scheme's default port, such as https://host:443/... or http://host:80/..., this truthiness check emits server.port. The current server semantic convention requires omitting the attribute for the default port, so the newly added endpoint enrichment produces nonconforming telemetry for these URLs; compare the parsed scheme and only set non-default ports.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Make sure boto3sqs instrumentation follows semantic conventions

1 participant