Skip to content
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

### ⚠️ Breaking changes

- Rename `messaging.system` to `messaging.system.name` (`aws_sqs` becomes `aws.sqs`) and adopt
the system-specific attribute renames from
[semantic-conventions #4250](https://github.com/open-telemetry/semantic-conventions/pull/4250).
Experimental messaging attributes also lose the `messaging.` prefix (for example,
`messaging.kafka.bootstrap.servers` becomes `kafka.bootstrap.servers`).
Comment thread
trask marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

kafka.bootstrap.servers might not be the best sample since I think the idea was to get rid of it and instead use it to fill server.address

- AWS Lambda invocation spans now replace alias suffixes in `cloud.resource_id` with the resolved
function version when available.
- AWS Lambda spans now use `faas.invocation.id` instead of `faas.invocation_id` for invocation IDs.
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ across versions). For example:

```java
// copied from MessagingIncubatingAttributes
private static final AttributeKey<String> MESSAGING_SYSTEM =
AttributeKey.stringKey("messaging.system");
private static final AttributeKey<String> MESSAGING_SYSTEM_NAME =
AttributeKey.stringKey("messaging.system.name");
```

**Javaagent instrumentation**: Use the semconv constants from the semconv artifact directly. The
Expand Down
14 changes: 7 additions & 7 deletions docs/declarative-configuration-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ instrumentation/development:
experimental_span_attributes/development: false
kafka:
# Enables the capture of the experimental consumer attributes `kafka.record.queue_time_ms` and
# `messaging.kafka.bootstrap.servers`.
# `kafka.bootstrap.servers`.
experimental_span_attributes/development: false
producer_propagation:
# Enable context propagation for Kafka message producers.
Expand Down Expand Up @@ -525,16 +525,16 @@ instrumentation/development:
# `scheduling.powerjob.job.type`.
experimental_span_attributes/development: false
pulsar:
# Enables capturing experimental span attribute `messaging.pulsar.message.type` on PRODUCER
# Enables capturing experimental span attribute `pulsar.message.type` on PRODUCER
# spans.
experimental_span_attributes/development: false
quartz:
# Enables the experimental `job.system` span attribute.
experimental_span_attributes/development: false
rabbitmq:
# Enables experimental span attributes `rabbitmq.command`, `rabbitmq.delivery_mode`,
# `rabbitmq.queue`, `rabbitmq.record.queue_time_ms`, `messaging.rabbitmq.vhost.name`, and
# `messaging.rabbitmq.cluster.name`.
# `rabbitmq.queue`, `rabbitmq.record.queue_time_ms`, `rabbitmq.vhost.name`, and
# `rabbitmq.cluster.name`.
experimental_span_attributes/development: false
reactor:
# Enables the capture of the experimental `reactor.canceled` attribute on spans when reactive
Expand All @@ -545,9 +545,9 @@ instrumentation/development:
# Enables the creation of Connect and DNS spans.
enabled: false
rocketmq_client:
# Enables capturing experimental span attributes `messaging.rocketmq.message.tag`,
# `messaging.rocketmq.broker_address`, `messaging.rocketmq.send_result`,
# `messaging.rocketmq.queue_id`, and `messaging.rocketmq.queue_offset`.
# Enables capturing experimental span attributes `rocketmq.message.tag`,
# `rocketmq.broker_address`, `rocketmq.send_result`,
# `rocketmq.queue_id`, and `rocketmq.queue_offset`.
experimental_span_attributes/development: false
message_create_spans:
# Enables per-message Create spans for batch sends. Overrides the common messaging setting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public final class MessagingAttributesExtractor<REQUEST, RESPONSE>
AttributeKey.stringKey("messaging.operation.name");
private static final AttributeKey<String> MESSAGING_OPERATION_TYPE =
AttributeKey.stringKey("messaging.operation.type");
private static final AttributeKey<String> MESSAGING_SYSTEM =
AttributeKey.stringKey("messaging.system");
private static final AttributeKey<String> MESSAGING_SYSTEM_NAME =
AttributeKey.stringKey("messaging.system.name");
Comment on lines +64 to +65

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Keeping the existing schema URL for now, as requested. No published schema includes these renames yet; #21075 tracks aligning it before 3.0 and is assigned to the v3.0.0 milestone. Leaving this finding open because the schema update is deferred, not fixed.


/**
* Creates the messaging attributes extractor for the given operation type.
Expand Down Expand Up @@ -138,7 +138,7 @@ public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST, R

@Override
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
attributes.put(MESSAGING_SYSTEM, getter.getSystem(request));
attributes.put(MESSAGING_SYSTEM_NAME, getter.getSystem(request));
boolean isTemporaryDestination = getter.isTemporaryDestination(request);
if (isTemporaryDestination) {
attributes.put(MESSAGING_DESTINATION_TEMPORARY, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ final class MessagingMetricsAdvice {
asList(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0));

// copied from MessagingIncubatingAttributes
private static final AttributeKey<String> MESSAGING_SYSTEM =
AttributeKey.stringKey("messaging.system");
private static final AttributeKey<String> MESSAGING_SYSTEM_NAME =
AttributeKey.stringKey("messaging.system.name");
private static final AttributeKey<String> MESSAGING_DESTINATION_NAME =
AttributeKey.stringKey("messaging.destination.name");
private static final AttributeKey<Boolean> MESSAGING_DESTINATION_ANONYMOUS =
Expand Down Expand Up @@ -62,7 +62,7 @@ private static List<AttributeKey<?>> buildAttributes(
boolean includeConsumerAttributes, boolean includeOperationType, boolean includeErrorType) {
List<AttributeKey<?>> attributes = new ArrayList<>();
attributes.add(MESSAGING_OPERATION_NAME);
attributes.add(MESSAGING_SYSTEM);
attributes.add(MESSAGING_SYSTEM_NAME);
if (includeErrorType) {
attributes.add(ERROR_TYPE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;

import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static io.opentelemetry.semconv.ErrorAttributes.ERROR_TYPE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_BATCH_MESSAGE_COUNT;
Expand All @@ -17,7 +18,6 @@
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_NAME;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand Down Expand Up @@ -93,7 +93,7 @@ void shouldExtractAllAvailableAttributes(

// then
List<MapEntry<AttributeKey<?>, Object>> expectedEntries = new ArrayList<>();
expectedEntries.add(entry(MESSAGING_SYSTEM, "myQueue"));
expectedEntries.add(entry(stringKey("messaging.system.name"), "myQueue"));
if (temporary) {
expectedEntries.add(entry(MESSAGING_DESTINATION_TEMPORARY, true));
expectedEntries.add(entry(MESSAGING_DESTINATION_NAME, destination));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;

import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingOperationType.RECEIVE;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetrySignal.CLIENT_OPERATION_DURATION;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetrySignal.CONSUMED_MESSAGES;
Expand All @@ -20,7 +21,6 @@
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_DESTINATION_TEMPLATE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_NAME;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.junit.jupiter.params.provider.Arguments.argumentSet;

Expand Down Expand Up @@ -56,7 +56,7 @@ void collectsMetricsAndCountsBatchOnce() {

Attributes requestAttributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_DESTINATION_NAME, "topic")
.put(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}")
.put(MESSAGING_OPERATION_NAME, "receive")
Expand Down Expand Up @@ -94,7 +94,7 @@ void collectsMetricsAndCountsBatchOnce() {
.hasBucketBoundaries(DURATION_BUCKETS)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "receive"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(MESSAGING_CONSUMER_GROUP_NAME, "group"),
equalTo(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}"),
equalTo(
Expand All @@ -117,7 +117,7 @@ void collectsMetricsAndCountsBatchOnce() {
.hasValue(3)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "receive"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(
ERROR_TYPE, IllegalStateException.class.getName()),
equalTo(MESSAGING_CONSUMER_GROUP_NAME, "group"),
Expand All @@ -137,7 +137,7 @@ void outerReceivePreventsDuplicateNestedMetrics() {
OperationListener inner = MessagingConsumerMetrics.get().create(meterProvider.get("inner"));
Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "receive")
.put(MESSAGING_OPERATION_TYPE, "receive")
.put(MESSAGING_BATCH_MESSAGE_COUNT, 3)
Expand Down Expand Up @@ -259,7 +259,7 @@ void failedReceiveWithoutBatchCountCountsNoConsumedMessages() {

Attributes requestAttributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_OPERATION_NAME, "receive")
.put(MESSAGING_OPERATION_TYPE, "receive")
.build();
Expand All @@ -286,7 +286,7 @@ void consumedMessagesOnlyCountsFailedDelivery() {

Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_DESTINATION_NAME, "topic")
.put(MESSAGING_OPERATION_NAME, "process")
.put(MESSAGING_OPERATION_TYPE, "process")
Expand All @@ -309,7 +309,7 @@ void consumedMessagesOnlyCountsFailedDelivery() {
.hasValue(1)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "process"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(MESSAGING_DESTINATION_NAME, "topic"),
equalTo(
ERROR_TYPE,
Expand All @@ -327,7 +327,7 @@ void clientOperationDurationOnlyDoesNotCountConsumedMessages() {

Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "poll")
.put(MESSAGING_OPERATION_TYPE, "receive")
.put(MESSAGING_BATCH_MESSAGE_COUNT, 3)
Expand Down Expand Up @@ -436,7 +436,7 @@ void successfulReceiveWithoutBatchCountCountsOneConsumedMessage() {

Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_OPERATION_NAME, "receive")
.put(MESSAGING_OPERATION_TYPE, "receive")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;

import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingOperationType.PROCESS;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetrySignal.PROCESS_DURATION;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetryState.contains;
Expand All @@ -16,7 +17,6 @@
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_DESTINATION_TEMPLATE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_NAME;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

import io.opentelemetry.api.common.Attributes;
Expand Down Expand Up @@ -47,7 +47,7 @@ void emitsProcessDurationAccordingToConfiguration() {

Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_DESTINATION_NAME, "topic")
.put(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}")
.put(MESSAGING_OPERATION_NAME, "process")
Expand Down Expand Up @@ -77,7 +77,7 @@ void emitsProcessDurationAccordingToConfiguration() {
.hasBucketBoundaries(DURATION_BUCKETS)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "process"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}"),
equalTo(
ERROR_TYPE,
Expand All @@ -94,7 +94,7 @@ void outerOperationPreventsDuplicateNestedProcessDuration() {
OperationListener inner = MessagingProcessMetrics.get().create(meterProvider.get("inner"));
Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "process")
.put(MESSAGING_OPERATION_TYPE, "process")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;

import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingOperationType.SEND;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetrySignal.CLIENT_OPERATION_DURATION;
import static io.opentelemetry.instrumentation.api.incubator.semconv.messaging.internal.MessagingTelemetrySignal.SENT_MESSAGES;
Expand All @@ -21,7 +22,6 @@
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_DESTINATION_TEMPLATE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_NAME;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE;
import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

import io.opentelemetry.api.common.Attributes;
Expand Down Expand Up @@ -56,7 +56,7 @@ void collectsMetrics() {

Attributes requestAttributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "pulsar")
.put(stringKey("messaging.system.name"), "pulsar")
.put(MESSAGING_DESTINATION_NAME, "topic")
.put(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}")
.put(MESSAGING_OPERATION_NAME, "send")
Expand Down Expand Up @@ -106,7 +106,7 @@ void collectsMetrics() {
.hasBucketBoundaries(DURATION_BUCKETS)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "send"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}"),
equalTo(MESSAGING_OPERATION_TYPE, "send"),
equalTo(
Expand All @@ -133,7 +133,7 @@ void collectsMetrics() {
.hasValue(2)
.hasAttributesSatisfyingExactly(
equalTo(MESSAGING_OPERATION_NAME, "send"),
equalTo(MESSAGING_SYSTEM, "pulsar"),
equalTo(stringKey("messaging.system.name"), "pulsar"),
equalTo(
ERROR_TYPE, IllegalStateException.class.getName()),
equalTo(MESSAGING_DESTINATION_TEMPLATE, "topic-{id}"),
Expand All @@ -152,7 +152,7 @@ void outerOperationPreventsDuplicateNestedMetrics() {
OperationListener inner = MessagingProducerMetrics.get().create(meterProvider.get("inner"));
Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "send")
.put(MESSAGING_OPERATION_TYPE, "send")
.build();
Expand Down Expand Up @@ -204,7 +204,7 @@ void completedOperationDoesNotSuppressSibling() {
OperationListener listener = MessagingProducerMetrics.get().create(meterProvider.get("test"));
Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "send")
.put(MESSAGING_OPERATION_TYPE, "send")
.build();
Expand Down Expand Up @@ -279,7 +279,7 @@ void sentMessagesOnlyDoesNotRecordDuration() {

Attributes attributes =
Attributes.builder()
.put(MESSAGING_SYSTEM, "kafka")
.put(stringKey("messaging.system.name"), "kafka")
.put(MESSAGING_OPERATION_NAME, "send")
.put(MESSAGING_OPERATION_TYPE, "send")
.build();
Expand Down
Loading
Loading