Skip to content

Conversation

@austindrenski
Copy link

aws.sqs.*

From the OTel semantic conventions docs for aws.sqs.*:

Amazon SQS Attributes

This document defines attributes for AWS SQS.

Attributes:

Key Stability Value Type Description Example Values
aws.sqs.queue.url Development string The URL of the AWS SQS Queue. It's a unique identifier for a queue in Amazon Simple Queue Service (SQS) and is used to access the queue and perform actions on it. https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue

messaging.*

From the OTel semantic conventions docs for messaging.*:

General Messaging Attributes

Attributes describing telemetry around messaging systems and messaging activities.

Attributes:

Key Stability Value Type Description Example Values
messaging.batch.message_count Development int The number of messages sent, received, or processed in the scope of the batching operation. [1] 0; 1; 2
messaging.client.id Development string A unique identifier for the client that consumes or produces a message. client-5; myhost@8742@s8083jm
messaging.consumer.group.name Development string The name of the consumer group with which a consumer is associated. [2] my-group; indexer
messaging.destination.anonymous Development boolean A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).
messaging.destination.name Development string The message destination name [3] MyQueue; MyTopic
messaging.destination.partition.id Development string The identifier of the partition messages are sent to or received from, unique within the messaging.destination.name. 1
messaging.destination.subscription.name Development string The name of the destination subscription from which a message is consumed. [4] subscription-a
messaging.destination.template Development string Low cardinality representation of the messaging destination name [5] /customers/{customerId}
messaging.destination.temporary Development boolean A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.
messaging.message.body.size Development int The size of the message body in bytes. [6] 1439
messaging.message.conversation_id Development string The conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". MyConversationId
messaging.message.envelope.size Development int The size of the message body and metadata in bytes. [7] 2738
messaging.message.id Development string A value used by the messaging system as an identifier for the message, represented as a string. 452a7c7c7c7048c2f887f61572b18fc2
messaging.operation.name Development string The system-specific name of the messaging operation. ack; nack; send
messaging.operation.type Development string A string identifying the type of the messaging operation. [8] create; send; receive
messaging.system Development string The messaging system as identified by the client instrumentation. [9] activemq; aws.sns; aws_sqs

[1] messaging.batch.message_count: Instrumentations SHOULD NOT set messaging.batch.message_count on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations SHOULD use messaging.batch.message_count for batching APIs and SHOULD NOT use it for single-message APIs.

[2] messaging.consumer.group.name: Semantic conventions for individual messaging systems SHOULD document whether messaging.consumer.group.name is applicable and what it means in the context of that system.

[3] messaging.destination.name: Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If
the broker doesn't have such notion, the destination name SHOULD uniquely identify the broker.

[4] messaging.destination.subscription.name: Semantic conventions for individual messaging systems SHOULD document whether messaging.destination.subscription.name is applicable and what it means in the context of that system.

[5] messaging.destination.template: Destination names could be constructed from templates. An example would be a destination name involving a user name or product id. Although the destination name in this case is of high cardinality, the underlying template is of low cardinality and can be effectively used for grouping and aggregation.

[6] messaging.message.body.size: This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed
body size should be used.

[7] messaging.message.envelope.size: This can refer to both the compressed or uncompressed size. If both sizes are known, the uncompressed
size should be used.

[8] messaging.operation.type: If a custom value is used, it MUST be of low cardinality.

[9] messaging.system: The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the messaging.system is set to kafka based on the instrumentation's best knowledge.


messaging.operation.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

Value Description Stability
create A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch sending scenarios. Development
process One or more messages are processed by a consumer. Development
receive One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages. Development
send One or more messages are provided for sending to an intermediary. If a single message is sent, the context of the "Send" span can be used as the creation context and no "Create" span needs to be created. Development
settle One or more messages are settled. Development

messaging.system has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

Value Description Stability
activemq Apache ActiveMQ Development
aws.sns Amazon Simple Notification Service (SNS) Development
aws_sqs Amazon Simple Queue Service (SQS) Development
eventgrid Azure Event Grid Development
eventhubs Azure Event Hubs Development
gcp_pubsub Google Cloud Pub/Sub Development
jms Java Message Service Development
kafka Apache Kafka Development
pulsar Apache Pulsar Development
rabbitmq RabbitMQ Development
rocketmq Apache RocketMQ Development
servicebus Azure Service Bus Development

server.*

From the OTel semantic conventions docs for server.*:

Server

Server Attributes

These attributes may be used to describe the server in a connection-based network interaction where there is one side that initiates the connection (the client is the side that initiates the connection). This covers all TCP network interactions since TCP is connection-based and one side initiates the connection (an exception is made for peer-to-peer communication over TCP where the "user-facing" surface of the protocol / API doesn't expose a clear notion of client and server). This also covers UDP network interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS.

Attributes:

Key Stability Value Type Description Example Values
server.address Stable string Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [1] example.com; 10.1.2.80; /tmp/my.sock
server.port Stable int Server port number. [2] 80; 8080; 443

[1] server.address: When observed from the client side, and when communicating through an intermediary, server.address SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.

[2] server.port: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.

Related

Copilot AI review requested due to automatic review settings December 20, 2025 03:32
@austindrenski austindrenski requested a review from a team as a code owner December 20, 2025 03:32
@github-actions github-actions bot requested a review from akats7 December 20, 2025 03:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes AWS SQS instrumentation to correctly use OpenTelemetry semantic conventions for messaging attributes. The changes align the implementation with the official OTel semconv specifications for AWS SQS and messaging systems.

Key Changes:

  • Added proper AWS SQS-specific attributes (aws.sqs.queue.url) alongside messaging semantic conventions
  • Implemented queue name extraction from SQS queue URLs to populate messaging.destination.name
  • Added operation-specific attributes (messaging.operation.type) for send, receive, and settle operations
  • Enhanced attribute extraction to include server.address and optionally server.port from queue URLs

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
sqsattributes.go Implements the core attribute builder logic with new queueUrlAttrs helper function to extract server address, port, and queue name from SQS URLs; adds messaging operation types and batch message counts
sqsattributes_test.go Updates all test cases to verify the new semantic convention attributes including queue URL, destination name, operation types, and server address
attributes_test.go Updates the default attribute builder test to use the new test fixtures and verify the expanded set of attributes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant