Skip to content

Latest commit

 

History

History
469 lines (341 loc) · 37.4 KB

messaging-metrics.md

File metadata and controls

469 lines (341 loc) · 37.4 KB

Semantic Conventions for Messaging Client Metrics

Status: Experimental

Warning

Existing messaging instrumentations that are using v1.24.0 of this document (or prior):

  • SHOULD NOT change the version of the messaging conventions that they emit by default until the messaging semantic conventions are marked stable. Conventions include, but are not limited to, attributes, metric and span names, span kind and unit of measure.
  • SHOULD introduce an environment variable OTEL_SEMCONV_STABILITY_OPT_IN in the existing major version which is a comma-separated list of values. The list of values includes:
    • messaging - emit the new, stable messaging conventions, and stop emitting the old experimental messaging conventions that the instrumentation emitted previously.
    • messaging/dup - emit both the old and the stable messaging conventions, allowing for a seamless transition.
    • The default behavior (in the absence of one of these values) is to continue emitting whatever version of the old experimental messaging conventions the instrumentation was emitting previously.
    • Note: messaging/dup has higher precedence than messaging in case both values are present
  • SHOULD maintain (security patching at a minimum) the existing major version for at least six months after it starts emitting both sets of conventions.
  • SHOULD drop the environment variable in the next major version.
  • SHOULD emit the new, stable values for span name, span kind and similar "single" valued concepts when messaging/dup is present in the list.

Common metrics

Metric: messaging.client.operation.duration

When this metric is reported alongside a messaging span, the metric value SHOULD be the same as the corresponding span duration.

This metric is required.

This metric SHOULD be specified with ExplicitBucketBoundaries of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

Name Instrument Type Unit (UCUM) Description Stability
messaging.client.operation.duration Histogram s Duration of messaging operation initiated by a producer or consumer client. [1] Experimental

[1]: This metric SHOULD NOT be used to report processing duration - processing duration is reported in messaging.process.duration metric.

Attribute Type Description Examples Requirement Level Stability
messaging.operation.name string The system-specific name of the messaging operation. send; receive; ack Required Experimental
messaging.system string The messaging system as identified by the client instrumentation. [1] activemq; aws_sqs; eventgrid Required Experimental
error.type string Describes a class of error the operation ended with. [2] amqp:decode-error; KAFKA_STORAGE_ERROR; channel-error Conditionally Required If and only if the messaging operation has failed. Stable
messaging.consumer.group.name string The name of the consumer group with which a consumer is associated. [3] my-group; indexer Conditionally Required if applicable. Experimental
messaging.destination.name string The message destination name [4] MyQueue; MyTopic Conditionally Required [5] Experimental
messaging.destination.subscription.name string The name of the destination subscription from which a message is consumed. [6] subscription-a Conditionally Required if applicable. Experimental
messaging.destination.template string Low cardinality representation of the messaging destination name [7] /customers/{customerId} Conditionally Required if available. Experimental
messaging.operation.type string A string identifying the type of the messaging operation. [8] create; send; receive Conditionally Required If applicable. Experimental
server.address string Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [9] example.com; 10.1.2.80; /tmp/my.sock Conditionally Required If available. Stable
messaging.destination.partition.id string The identifier of the partition messages are sent to or received from, unique within the messaging.destination.name. 1 Recommended Experimental
server.port int Server port number. [10] 80; 8080; 443 Recommended Stable

[1] 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.

[2] error.type: The error.type SHOULD be predictable, and SHOULD have low cardinality.

When error.type is set to a type (e.g., an exception type), its canonical class name identifying the type within the artifact SHOULD be used.

Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low. Telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time when no additional filters are applied.

If the operation has completed successfully, instrumentations SHOULD NOT set error.type.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), it's RECOMMENDED to:

  • Use a domain-specific attribute
  • Set error.type to capture all errors, regardless of whether they are defined within the domain-specific set or not.

[3] 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.

[4] 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.

[5] messaging.destination.name: if and only if messaging.destination.name is known to have low cardinality. Otherwise, messaging.destination.template MAY be populated.

[6] 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.

[7] 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.

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

[9] server.address: Server domain name of the broker if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

[10] 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.


error.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
_OTHER A fallback error value to be used when the instrumentation doesn't define a custom value. Stable

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. Experimental
process One or more messages are processed by a consumer. Experimental
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. Experimental
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. Experimental
settle One or more messages are settled. Experimental

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 Experimental
aws_sqs Amazon Simple Queue Service (SQS) Experimental
eventgrid Azure Event Grid Experimental
eventhubs Azure Event Hubs Experimental
gcp_pubsub Google Cloud Pub/Sub Experimental
jms Java Message Service Experimental
kafka Apache Kafka Experimental
pulsar Apache Pulsar Experimental
rabbitmq RabbitMQ Experimental
rocketmq Apache RocketMQ Experimental
servicebus Azure Service Bus Experimental

Producer metrics

Metric: messaging.client.sent.messages

This metric is required.

Name Instrument Type Unit (UCUM) Description Stability
messaging.client.sent.messages Counter {message} Number of messages producer attempted to send to the broker. [1] Experimental

[1]: This metric MUST NOT count messages that were created but haven't yet been sent.

Attribute Type Description Examples Requirement Level Stability
messaging.operation.name string The system-specific name of the messaging operation. send; schedule; enqueue Required Experimental
messaging.system string The messaging system as identified by the client instrumentation. [1] activemq; aws_sqs; eventgrid Required Experimental
error.type string Describes a class of error the operation ended with. [2] amqp:decode-error; KAFKA_STORAGE_ERROR; channel-error Conditionally Required If and only if the messaging operation has failed. Stable
messaging.destination.name string The message destination name [3] MyQueue; MyTopic Conditionally Required [4] Experimental
messaging.destination.template string Low cardinality representation of the messaging destination name [5] /customers/{customerId} Conditionally Required if available. Experimental
server.address string Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [6] example.com; 10.1.2.80; /tmp/my.sock Conditionally Required If available. Stable
messaging.destination.partition.id string The identifier of the partition messages are sent to or received from, unique within the messaging.destination.name. 1 Recommended Experimental
server.port int Server port number. [7] 80; 8080; 443 Recommended Stable

[1] 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.

[2] error.type: The error.type SHOULD be predictable, and SHOULD have low cardinality.

When error.type is set to a type (e.g., an exception type), its canonical class name identifying the type within the artifact SHOULD be used.

Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low. Telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time when no additional filters are applied.

If the operation has completed successfully, instrumentations SHOULD NOT set error.type.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), it's RECOMMENDED to:

  • Use a domain-specific attribute
  • Set error.type to capture all errors, regardless of whether they are defined within the domain-specific set or not.

[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.name: if and only if messaging.destination.name is known to have low cardinality. Otherwise, messaging.destination.template MAY be populated.

[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] server.address: Server domain name of the broker if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

[7] 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.


error.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
_OTHER A fallback error value to be used when the instrumentation doesn't define a custom value. Stable

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 Experimental
aws_sqs Amazon Simple Queue Service (SQS) Experimental
eventgrid Azure Event Grid Experimental
eventhubs Azure Event Hubs Experimental
gcp_pubsub Google Cloud Pub/Sub Experimental
jms Java Message Service Experimental
kafka Apache Kafka Experimental
pulsar Apache Pulsar Experimental
rabbitmq RabbitMQ Experimental
rocketmq Apache RocketMQ Experimental
servicebus Azure Service Bus Experimental

Consumer metrics

Metric: messaging.client.consumed.messages

This metric is required.

Name Instrument Type Unit (UCUM) Description Stability
messaging.client.consumed.messages Counter {message} Number of messages that were delivered to the application. [1] Experimental

[1]: Records the number of messages pulled from the broker or number of messages dispatched to the application in push-based scenarios. The metric SHOULD be reported once per message delivery. For example, if receiving and processing operations are both instrumented for a single message delivery, this counter is incremented when the message is received and not reported when it is processed.

Attribute Type Description Examples Requirement Level Stability
messaging.operation.name string The system-specific name of the messaging operation. receive; peek; poll; consume Required Experimental
messaging.system string The messaging system as identified by the client instrumentation. [1] activemq; aws_sqs; eventgrid Required Experimental
error.type string Describes a class of error the operation ended with. [2] amqp:decode-error; KAFKA_STORAGE_ERROR; channel-error Conditionally Required If and only if the messaging operation has failed. Stable
messaging.consumer.group.name string The name of the consumer group with which a consumer is associated. [3] my-group; indexer Conditionally Required if applicable. Experimental
messaging.destination.name string The message destination name [4] MyQueue; MyTopic Conditionally Required [5] Experimental
messaging.destination.subscription.name string The name of the destination subscription from which a message is consumed. [6] subscription-a Conditionally Required if applicable. Experimental
messaging.destination.template string Low cardinality representation of the messaging destination name [7] /customers/{customerId} Conditionally Required if available. Experimental
server.address string Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [8] example.com; 10.1.2.80; /tmp/my.sock Conditionally Required If available. Stable
messaging.destination.partition.id string The identifier of the partition messages are sent to or received from, unique within the messaging.destination.name. 1 Recommended Experimental
server.port int Server port number. [9] 80; 8080; 443 Recommended Stable

[1] 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.

[2] error.type: The error.type SHOULD be predictable, and SHOULD have low cardinality.

When error.type is set to a type (e.g., an exception type), its canonical class name identifying the type within the artifact SHOULD be used.

Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low. Telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time when no additional filters are applied.

If the operation has completed successfully, instrumentations SHOULD NOT set error.type.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), it's RECOMMENDED to:

  • Use a domain-specific attribute
  • Set error.type to capture all errors, regardless of whether they are defined within the domain-specific set or not.

[3] 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.

[4] 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.

[5] messaging.destination.name: if and only if messaging.destination.name is known to have low cardinality. Otherwise, messaging.destination.template MAY be populated.

[6] 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.

[7] 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.

[8] server.address: Server domain name of the broker if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

[9] 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.


error.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
_OTHER A fallback error value to be used when the instrumentation doesn't define a custom value. Stable

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 Experimental
aws_sqs Amazon Simple Queue Service (SQS) Experimental
eventgrid Azure Event Grid Experimental
eventhubs Azure Event Hubs Experimental
gcp_pubsub Google Cloud Pub/Sub Experimental
jms Java Message Service Experimental
kafka Apache Kafka Experimental
pulsar Apache Pulsar Experimental
rabbitmq RabbitMQ Experimental
rocketmq Apache RocketMQ Experimental
servicebus Azure Service Bus Experimental

Metric: messaging.process.duration

When this metric is reported alongside a messaging process span, the metric value SHOULD be the same as the corresponding span duration.

This metric is required for push-based message delivery and is recommended for processing operations instrumented for pull-based scenarios.

This metric SHOULD be specified with ExplicitBucketBoundaries of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

Name Instrument Type Unit (UCUM) Description Stability
messaging.process.duration Histogram s Duration of processing operation. [1] Experimental

[1]: This metric MUST be reported for operations with messaging.operation.type that matches process.

Attribute Type Description Examples Requirement Level Stability
messaging.operation.name string The system-specific name of the messaging operation. process; consume; handle Required Experimental
messaging.system string The messaging system as identified by the client instrumentation. [1] activemq; aws_sqs; eventgrid Required Experimental
error.type string Describes a class of error the operation ended with. [2] amqp:decode-error; KAFKA_STORAGE_ERROR; channel-error Conditionally Required If and only if the messaging operation has failed. Stable
messaging.consumer.group.name string The name of the consumer group with which a consumer is associated. [3] my-group; indexer Conditionally Required if applicable. Experimental
messaging.destination.name string The message destination name [4] MyQueue; MyTopic Conditionally Required [5] Experimental
messaging.destination.subscription.name string The name of the destination subscription from which a message is consumed. [6] subscription-a Conditionally Required if applicable. Experimental
messaging.destination.template string Low cardinality representation of the messaging destination name [7] /customers/{customerId} Conditionally Required if available. Experimental
server.address string Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [8] example.com; 10.1.2.80; /tmp/my.sock Conditionally Required If available. Stable
messaging.destination.partition.id string The identifier of the partition messages are sent to or received from, unique within the messaging.destination.name. 1 Recommended Experimental
server.port int Server port number. [9] 80; 8080; 443 Recommended Stable

[1] 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.

[2] error.type: The error.type SHOULD be predictable, and SHOULD have low cardinality.

When error.type is set to a type (e.g., an exception type), its canonical class name identifying the type within the artifact SHOULD be used.

Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low. Telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time when no additional filters are applied.

If the operation has completed successfully, instrumentations SHOULD NOT set error.type.

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), it's RECOMMENDED to:

  • Use a domain-specific attribute
  • Set error.type to capture all errors, regardless of whether they are defined within the domain-specific set or not.

[3] 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.

[4] 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.

[5] messaging.destination.name: if and only if messaging.destination.name is known to have low cardinality. Otherwise, messaging.destination.template MAY be populated.

[6] 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.

[7] 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.

[8] server.address: Server domain name of the broker if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.

[9] 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.


error.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
_OTHER A fallback error value to be used when the instrumentation doesn't define a custom value. Stable

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 Experimental
aws_sqs Amazon Simple Queue Service (SQS) Experimental
eventgrid Azure Event Grid Experimental
eventhubs Azure Event Hubs Experimental
gcp_pubsub Google Cloud Pub/Sub Experimental
jms Java Message Service Experimental
kafka Apache Kafka Experimental
pulsar Apache Pulsar Experimental
rabbitmq RabbitMQ Experimental
rocketmq Apache RocketMQ Experimental
servicebus Azure Service Bus Experimental