parent
de63ac7c74
commit
527bf612f6
|
@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributeKey;
|
|||
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<MessageExt, Void> {
|
||||
INSTANCE;
|
||||
|
||||
private static final AttributeKey<String> MESSAGING_ROCKETMQ_TAGS =
|
||||
AttributeKey.stringKey("messaging.rocketmq.tags");
|
||||
private static final AttributeKey<Long> MESSAGING_ROCKETMQ_QUEUE_ID =
|
||||
AttributeKey.longKey("messaging.rocketmq.queue_id");
|
||||
private static final AttributeKey<Long> 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());
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributeKey;
|
|||
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<SendMessageContext, Void> {
|
||||
INSTANCE;
|
||||
|
||||
private static final AttributeKey<String> MESSAGING_ROCKETMQ_TAGS =
|
||||
AttributeKey.stringKey("messaging.rocketmq.tags");
|
||||
private static final AttributeKey<String> MESSAGING_ROCKETMQ_BROKER_ADDRESS =
|
||||
AttributeKey.stringKey("messaging.rocketmq.broker_address");
|
||||
private static final AttributeKey<String> MESSAGING_ROCKETMQ_SEND_RESULT =
|
||||
|
@ -29,7 +28,7 @@ enum RocketMqProducerExperimentalAttributeExtractor
|
|||
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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue