diff --git a/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqConsumerExperimentalAttributeExtractor.java b/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqConsumerExperimentalAttributeExtractor.java index b4e29dd18e64..5b4f5b5b86ff 100644 --- a/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqConsumerExperimentalAttributeExtractor.java +++ b/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqConsumerExperimentalAttributeExtractor.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.net.SocketAddress; import javax.annotation.Nullable; import org.apache.rocketmq.common.message.MessageExt; @@ -17,8 +18,6 @@ enum RocketMqConsumerExperimentalAttributeExtractor implements AttributesExtractor { INSTANCE; - private static final AttributeKey MESSAGING_ROCKETMQ_TAGS = - AttributeKey.stringKey("messaging.rocketmq.tags"); private static final AttributeKey MESSAGING_ROCKETMQ_QUEUE_ID = AttributeKey.longKey("messaging.rocketmq.queue_id"); private static final AttributeKey MESSAGING_ROCKETMQ_QUEUE_OFFSET = @@ -30,7 +29,7 @@ enum RocketMqConsumerExperimentalAttributeExtractor public void onStart(AttributesBuilder attributes, Context parentContext, MessageExt msg) { String tags = msg.getTags(); if (tags != null) { - attributes.put(MESSAGING_ROCKETMQ_TAGS, tags); + attributes.put(SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG, tags); } attributes.put(MESSAGING_ROCKETMQ_QUEUE_ID, msg.getQueueId()); attributes.put(MESSAGING_ROCKETMQ_QUEUE_OFFSET, msg.getQueueOffset()); diff --git a/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqProducerExperimentalAttributeExtractor.java b/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqProducerExperimentalAttributeExtractor.java index 95e90132318d..459a408e06d2 100644 --- a/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqProducerExperimentalAttributeExtractor.java +++ b/instrumentation/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmq/RocketMqProducerExperimentalAttributeExtractor.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import javax.annotation.Nullable; import org.apache.rocketmq.client.hook.SendMessageContext; @@ -16,8 +17,6 @@ enum RocketMqProducerExperimentalAttributeExtractor implements AttributesExtractor { INSTANCE; - private static final AttributeKey MESSAGING_ROCKETMQ_TAGS = - AttributeKey.stringKey("messaging.rocketmq.tags"); private static final AttributeKey MESSAGING_ROCKETMQ_BROKER_ADDRESS = AttributeKey.stringKey("messaging.rocketmq.broker_address"); private static final AttributeKey MESSAGING_ROCKETMQ_SEND_RESULT = @@ -29,7 +28,7 @@ public void onStart( if (request.getMessage() != null) { String tags = request.getMessage().getTags(); if (tags != null) { - attributes.put(MESSAGING_ROCKETMQ_TAGS, tags); + attributes.put(SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG, tags); } } String brokerAddr = request.getBrokerAddr(); diff --git a/instrumentation/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmq/AbstractRocketMqClientTest.groovy b/instrumentation/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmq/AbstractRocketMqClientTest.groovy index c111c384a06e..3c9c9fb71943 100644 --- a/instrumentation/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmq/AbstractRocketMqClientTest.groovy +++ b/instrumentation/rocketmq-client-4.8/testing/src/main/groovy/io/opentelemetry/instrumentation/rocketmq/AbstractRocketMqClientTest.groovy @@ -102,7 +102,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_DESTINATION" sharedTopic "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.send_result" "SEND_OK" } @@ -118,7 +118,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.queue_id" Long "messaging.rocketmq.queue_offset" Long @@ -158,7 +158,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_DESTINATION" sharedTopic "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.send_result" "SEND_OK" } @@ -174,7 +174,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.queue_id" Long "messaging.rocketmq.queue_offset" Long @@ -261,7 +261,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.queue_id" Long "messaging.rocketmq.queue_offset" Long @@ -279,7 +279,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagB" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagB" "messaging.rocketmq.broker_address" String "messaging.rocketmq.queue_id" Long "messaging.rocketmq.queue_offset" Long @@ -323,7 +323,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_DESTINATION" sharedTopic "$SemanticAttributes.MESSAGING_DESTINATION_KIND" "topic" "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.send_result" "SEND_OK" "messaging.header.test_message_header" { it == ["test"] } @@ -340,7 +340,7 @@ abstract class AbstractRocketMqClientTest extends InstrumentationSpecification { "$SemanticAttributes.MESSAGING_OPERATION" "process" "$SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES" Long "$SemanticAttributes.MESSAGING_MESSAGE_ID" String - "messaging.rocketmq.tags" "TagA" + "$SemanticAttributes.MESSAGING_ROCKETMQ_MESSAGE_TAG" "TagA" "messaging.rocketmq.broker_address" String "messaging.rocketmq.queue_id" Long "messaging.rocketmq.queue_offset" Long