Prefix custom attributes with instrumentation name (#1784)
This commit is contained in:
parent
f9df981b2e
commit
fa09451aea
|
@ -92,7 +92,7 @@ class BaseSpanDecorator implements SpanDecorator {
|
|||
|
||||
@Override
|
||||
public void pre(Span span, Exchange exchange, Endpoint endpoint, CamelDirection camelDirection) {
|
||||
span.setAttribute("camel.uri", URISupport.sanitizeUri(endpoint.getEndpointUri()));
|
||||
span.setAttribute("apache-camel.uri", URISupport.sanitizeUri(endpoint.getEndpointUri()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,24 +59,24 @@ class KafkaSpanDecorator extends MessagingSpanDecorator {
|
|||
span.setAttribute(SemanticAttributes.MESSAGING_OPERATION, "process");
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic");
|
||||
|
||||
String partition = getValue(exchange, PARTITION, Integer.class);
|
||||
Integer partition = exchange.getIn().getHeader(PARTITION, Integer.class);
|
||||
if (partition != null) {
|
||||
span.setAttribute("partition", partition);
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, partition);
|
||||
}
|
||||
|
||||
String partitionKey = (String) exchange.getIn().getHeader(PARTITION_KEY);
|
||||
if (partitionKey != null) {
|
||||
span.setAttribute("partitionKey", partitionKey);
|
||||
span.setAttribute("apache-camel.kafka.partitionKey", partitionKey);
|
||||
}
|
||||
|
||||
String key = (String) exchange.getIn().getHeader(KEY);
|
||||
if (key != null) {
|
||||
span.setAttribute("key", key);
|
||||
span.setAttribute("apache-camel.kafka.key", key);
|
||||
}
|
||||
|
||||
String offset = getValue(exchange, OFFSET, Long.class);
|
||||
if (offset != null) {
|
||||
span.setAttribute("offset", offset);
|
||||
span.setAttribute("apache-camel.kafka.offset", offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class DirectCamelTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"camel.uri" "direct://input"
|
||||
"apache-camel.uri" "direct://input"
|
||||
}
|
||||
}
|
||||
it.span(1) {
|
||||
|
@ -56,7 +56,7 @@ class DirectCamelTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
parentSpanId parent.span(0).spanId
|
||||
attributes {
|
||||
"camel.uri" "direct://receiver"
|
||||
"apache-camel.uri" "direct://receiver"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"camel.uri" "direct://input"
|
||||
"apache-camel.uri" "direct://input"
|
||||
}
|
||||
}
|
||||
it.span(1) {
|
||||
|
@ -56,7 +56,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
parentSpanId parent.span(0).spanId
|
||||
attributes {
|
||||
"camel.uri" "direct://second"
|
||||
"apache-camel.uri" "direct://second"
|
||||
}
|
||||
}
|
||||
it.span(2) {
|
||||
|
@ -64,7 +64,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
parentSpanId parent.span(0).spanId
|
||||
attributes {
|
||||
"camel.uri" "direct://first"
|
||||
"apache-camel.uri" "direct://first"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class RestCamelTest extends AgentTestRunner {
|
|||
name "start"
|
||||
kind INTERNAL
|
||||
attributes {
|
||||
"camel.uri" "direct://start"
|
||||
"apache-camel.uri" "direct://start"
|
||||
}
|
||||
}
|
||||
it.span(1) {
|
||||
|
@ -78,7 +78,7 @@ class RestCamelTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||
"camel.uri" "rest://get:api/%7Bmodule%7D/unit/%7BunitId%7D"
|
||||
"apache-camel.uri" "rest://get:api/%7Bmodule%7D/unit/%7BunitId%7D"
|
||||
}
|
||||
}
|
||||
it.span(2) {
|
||||
|
@ -101,14 +101,14 @@ class RestCamelTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$port/api/firstModule/unit/unitOne"
|
||||
"camel.uri" String
|
||||
"apache-camel.uri" String
|
||||
}
|
||||
}
|
||||
it.span(4) {
|
||||
name "moduleUnit"
|
||||
kind INTERNAL
|
||||
attributes {
|
||||
"camel.uri" "direct://moduleUnit"
|
||||
"apache-camel.uri" "direct://moduleUnit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class SingleServiceCamelTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||
"$SemanticAttributes.HTTP_URL.key" "${address.resolve("/camelService")}"
|
||||
"camel.uri" "${address.resolve("/camelService")}".replace("localhost", "0.0.0.0")
|
||||
"apache-camel.uri" "${address.resolve("/camelService")}".replace("localhost", "0.0.0.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
|||
name "input"
|
||||
kind INTERNAL
|
||||
attributes {
|
||||
"camel.uri" "direct://input"
|
||||
"apache-camel.uri" "direct://input"
|
||||
}
|
||||
}
|
||||
it.span(1) {
|
||||
|
@ -91,7 +91,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
|||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||
"camel.uri" "http://localhost:$portOne/serviceOne"
|
||||
"apache-camel.uri" "http://localhost:$portOne/serviceOne"
|
||||
}
|
||||
}
|
||||
it.span(2) {
|
||||
|
@ -114,7 +114,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
|||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||
"camel.uri" "http://0.0.0.0:$portOne/serviceOne"
|
||||
"apache-camel.uri" "http://0.0.0.0:$portOne/serviceOne"
|
||||
}
|
||||
}
|
||||
it.span(4) {
|
||||
|
@ -124,7 +124,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
|||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||
"camel.uri" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||
"apache-camel.uri" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||
}
|
||||
}
|
||||
it.span(5) {
|
||||
|
@ -162,7 +162,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||
"camel.uri" "jetty:http://0.0.0.0:$portTwo/serviceTwo?arg=value"
|
||||
"apache-camel.uri" "jetty:http://0.0.0.0:$portTwo/serviceTwo?arg=value"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class CouchbaseNetworkInstrumentation implements TypeInstrumentation {
|
|||
}
|
||||
}
|
||||
|
||||
span.setAttribute("local.address", localSocket);
|
||||
span.setAttribute("couchbase.local.address", localSocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class CouchbaseSpanUtil {
|
|||
}
|
||||
|
||||
// Because of caching, not all requests hit the server so this tag may be absent
|
||||
"local.address" { it == null || String }
|
||||
"couchbase.local.address" { it == null || String }
|
||||
|
||||
// Not all couchbase operations have operation id. Notably, 'ViewQuery's do not
|
||||
// We assign a spanName of 'Bucket.query' and this is shared with n1ql queries
|
||||
|
|
|
@ -139,7 +139,7 @@ public class TracingServerInterceptor implements ServerInterceptor {
|
|||
public void onCancel() {
|
||||
try (Scope ignored = span.makeCurrent()) {
|
||||
delegate().onCancel();
|
||||
span.setAttribute("canceled", true);
|
||||
span.setAttribute("grpc.canceled", true);
|
||||
} catch (Throwable e) {
|
||||
tracer.endExceptionally(span, e);
|
||||
throw e;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class JaxRsAsyncResponseInstrumentation implements TypeInstrumentation {
|
|||
Span span = contextStore.get(asyncResponse);
|
||||
if (span != null) {
|
||||
contextStore.put(asyncResponse, null);
|
||||
span.setAttribute("canceled", true);
|
||||
span.setAttribute("jaxrs.canceled", true);
|
||||
tracer().end(span);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> {
|
|||
childOf((SpanData) parent)
|
||||
attributes {
|
||||
if (isCancelled) {
|
||||
"canceled" true
|
||||
"jaxrs.canceled" true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,11 +59,11 @@ public class KafkaConsumerTracer extends BaseTracer {
|
|||
|
||||
public void onConsume(Span span, long startTimeMillis, ConsumerRecord<?, ?> record) {
|
||||
// TODO should we set topic + offset as messaging.message_id?
|
||||
span.setAttribute("partition", record.partition());
|
||||
span.setAttribute("offset", record.offset());
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, record.partition());
|
||||
span.setAttribute("kafka-clients.offset", record.offset());
|
||||
|
||||
if (record.value() == null) {
|
||||
span.setAttribute("tombstone", true);
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE, true);
|
||||
}
|
||||
|
||||
// don't record a duration if the message was sent from an old Kafka client
|
||||
|
@ -71,7 +71,8 @@ public class KafkaConsumerTracer extends BaseTracer {
|
|||
long produceTime = record.timestamp();
|
||||
// this attribute shows how much time elapsed between the producer and the consumer of this
|
||||
// message, which can be helpful for identifying queue bottlenecks
|
||||
span.setAttribute("record.queue_time_ms", Math.max(0L, startTimeMillis - produceTime));
|
||||
span.setAttribute(
|
||||
"kafka-clients.record.queue_time_ms", Math.max(0L, startTimeMillis - produceTime));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ public class KafkaProducerTracer extends BaseTracer {
|
|||
|
||||
Integer partition = record.partition();
|
||||
if (partition != null) {
|
||||
span.setAttribute("partition", partition);
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, partition);
|
||||
}
|
||||
if (record.value() == null) {
|
||||
span.setAttribute("tombstone", true);
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,9 +96,9 @@ class KafkaClientPropagationDisabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,9 +107,9 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
basicSpan(it, 3, "producer callback", span(0))
|
||||
|
@ -197,9 +197,9 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
basicSpan(it, 3, "producer callback", span(0))
|
||||
|
@ -267,7 +267,7 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
||||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"tombstone" true
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE.key}" true
|
||||
}
|
||||
}
|
||||
// CONSUMER span 0
|
||||
|
@ -282,10 +282,10 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"tombstone" true
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE.key}" true
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
||||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"partition" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -356,9 +356,9 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ public class KafkaStreamsTracer extends BaseTracer {
|
|||
|
||||
public void onConsume(Span span, StampedRecord record) {
|
||||
if (record != null) {
|
||||
span.setAttribute("partition", record.partition());
|
||||
span.setAttribute("offset", record.offset());
|
||||
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, record.partition());
|
||||
span.setAttribute("kafka-streams.offset", record.offset());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,9 +149,9 @@ class KafkaStreamsTest extends AgentTestRunner {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
// STREAMING span 1
|
||||
|
@ -165,8 +165,8 @@ class KafkaStreamsTest extends AgentTestRunner {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" STREAM_PENDING
|
||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-streams.offset" 0
|
||||
"asdf" "testing"
|
||||
}
|
||||
}
|
||||
|
@ -194,9 +194,9 @@ class KafkaStreamsTest extends AgentTestRunner {
|
|||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
"partition" { it >= 0 }
|
||||
"offset" 0
|
||||
"record.queue_time_ms" { it >= 0 }
|
||||
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||
"kafka-clients.offset" 0
|
||||
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||
"testing" 123
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class InstrumentationPoints {
|
|||
if (ex == null) {
|
||||
LettuceDatabaseClientTracer.tracer().end(span);
|
||||
} else if (ex instanceof CancellationException) {
|
||||
span.setAttribute("db.command.cancelled", true);
|
||||
span.setAttribute("lettuce.command.cancelled", true);
|
||||
LettuceDatabaseClientTracer.tracer().end(span);
|
||||
} else {
|
||||
LettuceDatabaseClientTracer.tracer().endExceptionally(span, ex);
|
||||
|
|
|
@ -433,7 +433,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"${SemanticAttributes.DB_SYSTEM.key()}" "redis"
|
||||
"${SemanticAttributes.DB_STATEMENT.key()}" "SADD"
|
||||
"db.command.cancelled" true
|
||||
"lettuce.command.cancelled" true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class LettuceAsyncBiFunction<T, U extends Throwable, R>
|
|||
@Override
|
||||
public R apply(T t, Throwable throwable) {
|
||||
if (throwable instanceof CancellationException) {
|
||||
span.setAttribute("db.command.cancelled", true);
|
||||
span.setAttribute("lettuce.command.cancelled", true);
|
||||
tracer().end(span);
|
||||
} else {
|
||||
tracer().endExceptionally(span, throwable);
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal<?>>, Runn
|
|||
|
||||
private Span span = null;
|
||||
private int numResults = 0;
|
||||
private FluxOnSubscribeConsumer onSubscribeConsumer;
|
||||
private final FluxOnSubscribeConsumer onSubscribeConsumer;
|
||||
|
||||
public LettuceFluxTerminationRunnable(RedisCommand<?, ?, ?> command, boolean finishSpanOnClose) {
|
||||
onSubscribeConsumer = new FluxOnSubscribeConsumer(this, command, finishSpanOnClose);
|
||||
|
@ -32,9 +32,9 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal<?>>, Runn
|
|||
|
||||
private void finishSpan(boolean isCommandCancelled, Throwable throwable) {
|
||||
if (span != null) {
|
||||
span.setAttribute("db.command.results.count", numResults);
|
||||
span.setAttribute("lettuce.command.results.count", numResults);
|
||||
if (isCommandCancelled) {
|
||||
span.setAttribute("db.command.cancelled", true);
|
||||
span.setAttribute("lettuce.command.cancelled", true);
|
||||
}
|
||||
if (throwable == null) {
|
||||
tracer().end(span);
|
||||
|
|
|
@ -437,7 +437,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||
"$SemanticAttributes.DB_STATEMENT.key" "SADD SKEY ? ?"
|
||||
"db.command.cancelled" true
|
||||
"lettuce.command.cancelled" true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
||||
"db.command.results.count" 157
|
||||
"lettuce.command.results.count" 157
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,8 +228,8 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
|||
attributes {
|
||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
||||
"db.command.cancelled" true
|
||||
"db.command.results.count" 2
|
||||
"lettuce.command.cancelled" true
|
||||
"lettuce.command.results.count" 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class RabbitChannelInstrumentation implements TypeInstrumentation {
|
|||
}
|
||||
Integer deliveryMode = props.getDeliveryMode();
|
||||
if (deliveryMode != null) {
|
||||
span.setAttribute("amqp.delivery_mode", deliveryMode);
|
||||
span.setAttribute("rabbitmq.delivery_mode", deliveryMode);
|
||||
}
|
||||
|
||||
// We need to copy the BasicProperties and provide a header map we can modify
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RabbitTracer extends BaseTracer {
|
|||
// or if a plugin is installed on the rabbitmq broker
|
||||
long produceTime = properties.getTimestamp().getTime();
|
||||
long consumeTime = NANOSECONDS.toMillis(startTimeMillis);
|
||||
span.setAttribute("record.queue_time_ms", Math.max(0L, consumeTime - produceTime));
|
||||
span.setAttribute("rabbitmq.record.queue_time_ms", Math.max(0L, consumeTime - produceTime));
|
||||
}
|
||||
|
||||
return span;
|
||||
|
@ -109,10 +109,9 @@ public class RabbitTracer extends BaseTracer {
|
|||
? "<all>"
|
||||
: routingKey.startsWith("amq.gen-") ? "<generated>" : routingKey;
|
||||
span.updateName(exchangeName + " -> " + routing + " send");
|
||||
span.setAttribute("amqp.command", "basic.publish");
|
||||
span.setAttribute("rabbitmq.command", "basic.publish");
|
||||
if (routingKey != null && !routingKey.isEmpty()) {
|
||||
span.setAttribute("messaging.rabbitmq.routing_key", routingKey);
|
||||
span.setAttribute("amqp.routing_key", routingKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,8 +120,8 @@ public class RabbitTracer extends BaseTracer {
|
|||
}
|
||||
|
||||
public void onGet(Span span, String queue) {
|
||||
span.setAttribute("amqp.command", "basic.get");
|
||||
span.setAttribute("amqp.queue", queue);
|
||||
span.setAttribute("rabbitmq.command", "basic.get");
|
||||
span.setAttribute("rabbitmq.queue", queue);
|
||||
}
|
||||
|
||||
public String spanNameOnDeliver(String queue) {
|
||||
|
@ -136,7 +135,7 @@ public class RabbitTracer extends BaseTracer {
|
|||
}
|
||||
|
||||
public void onDeliver(Span span, Envelope envelope) {
|
||||
span.setAttribute("amqp.command", "basic.deliver");
|
||||
span.setAttribute("rabbitmq.command", "basic.deliver");
|
||||
|
||||
if (envelope != null) {
|
||||
String exchange = envelope.getExchange();
|
||||
|
@ -158,7 +157,7 @@ public class RabbitTracer extends BaseTracer {
|
|||
if (!name.equals("basic.publish")) {
|
||||
span.updateName(name);
|
||||
}
|
||||
span.setAttribute("amqp.command", name);
|
||||
span.setAttribute("rabbitmq.command", name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -125,7 +125,7 @@ class RabbitMQTest extends AgentTestRunner {
|
|||
}
|
||||
}
|
||||
|
||||
def "test rabbit consume #messageCount messages"() {
|
||||
def "test rabbit consume #messageCount messages and setTimestamp=#setTimestamp"() {
|
||||
setup:
|
||||
channel.exchangeDeclare(exchangeName, "direct", false)
|
||||
String queueName = (messageCount % 2 == 0) ?
|
||||
|
@ -326,7 +326,7 @@ class RabbitMQTest extends AgentTestRunner {
|
|||
trace.span(index) {
|
||||
name spanName
|
||||
|
||||
switch (trace.span(index).attributes.get(AttributeKey.stringKey("amqp.command"))) {
|
||||
switch (trace.span(index).attributes.get(AttributeKey.stringKey("rabbitmq.command"))) {
|
||||
case "basic.publish":
|
||||
kind PRODUCER
|
||||
break
|
||||
|
@ -369,30 +369,30 @@ class RabbitMQTest extends AgentTestRunner {
|
|||
"${SemanticAttributes.MESSAGING_OPERATION.key}" operation
|
||||
}
|
||||
if (expectTimestamp) {
|
||||
"record.queue_time_ms" { it instanceof Long && it >= 0 }
|
||||
"rabbitmq.record.queue_time_ms" { it instanceof Long && it >= 0 }
|
||||
}
|
||||
|
||||
switch (attribute("amqp.command")) {
|
||||
switch (attribute("rabbitmq.command")) {
|
||||
case "basic.publish":
|
||||
"amqp.command" "basic.publish"
|
||||
"amqp.routing_key" {
|
||||
"rabbitmq.command" "basic.publish"
|
||||
"rabbitmq.routing_key" {
|
||||
it == null || it == "some-routing-key" || it == "some-routing-queue" || it.startsWith("amq.gen-")
|
||||
}
|
||||
"amqp.delivery_mode" { it == null || it == 2 }
|
||||
"rabbitmq.delivery_mode" { it == null || it == 2 }
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
break
|
||||
case "basic.get":
|
||||
"amqp.command" "basic.get"
|
||||
"rabbitmq.command" "basic.get"
|
||||
//TODO why this queue name is not a destination for semantic convention
|
||||
"amqp.queue" { it == "some-queue" || it == "some-routing-queue" || it.startsWith("amq.gen-") }
|
||||
"rabbitmq.queue" { it == "some-queue" || it == "some-routing-queue" || it.startsWith("amq.gen-") }
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" { it == null || it instanceof Long }
|
||||
break
|
||||
case "basic.deliver":
|
||||
"amqp.command" "basic.deliver"
|
||||
"rabbitmq.command" "basic.deliver"
|
||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||
break
|
||||
default:
|
||||
"amqp.command" { it == null || it == resource }
|
||||
"rabbitmq.command" { it == null || it == resource }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Servlet3HttpServerTracer extends ServletHttpServerTracer<HttpServle
|
|||
public void onTimeout(Context context, long timeout) {
|
||||
Span span = Span.fromContext(context);
|
||||
span.setStatus(StatusCode.ERROR);
|
||||
span.setAttribute("timeout", timeout);
|
||||
span.setAttribute("servlet.timeout", timeout);
|
||||
span.end();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class HandlerAdapterAdvice {
|
|||
}
|
||||
|
||||
span.updateName(operationName);
|
||||
span.setAttribute("handler.type", handlerType);
|
||||
span.setAttribute("spring-webflux.handler.type", handlerType);
|
||||
|
||||
spanWithScope = new SpanWithScope(span, context.makeCurrent());
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class RouteOnSuccessOrError implements BiConsumer<HandlerFunction<?>, Thr
|
|||
Context context = (Context) serverRequest.attributes().get(AdviceUtils.CONTEXT_ATTRIBUTE);
|
||||
if (context != null) {
|
||||
Span span = Span.fromContext(context);
|
||||
span.setAttribute("request.predicate", predicateString);
|
||||
span.setAttribute("spring-webflux.request.predicate", predicateString);
|
||||
|
||||
Span serverSpan = context.get(BaseTracer.CONTEXT_SERVER_SPAN_KEY);
|
||||
if (serverSpan != null) {
|
||||
|
|
|
@ -83,13 +83,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
attributes {
|
||||
if (annotatedMethod == null) {
|
||||
// Functional API
|
||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
} else {
|
||||
// Annotation API
|
||||
"handler.type" TestController.getName()
|
||||
"spring-webflux.handler.type" TestController.getName()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,13 +149,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
attributes {
|
||||
if (annotatedMethod == null) {
|
||||
// Functional API
|
||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
} else {
|
||||
// Annotation API
|
||||
"handler.type" TestController.getName()
|
||||
"spring-webflux.handler.type" TestController.getName()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,13 +237,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
attributes {
|
||||
if (annotatedMethod == null) {
|
||||
// Functional API
|
||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
} else {
|
||||
// Annotation API
|
||||
"handler.type" TestController.getName()
|
||||
"spring-webflux.handler.type" TestController.getName()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
errored true
|
||||
errorEvent(ResponseStatusException, String)
|
||||
attributes {
|
||||
"handler.type" "org.springframework.web.reactive.resource.ResourceWebHandler"
|
||||
"spring-webflux.handler.type" "org.springframework.web.reactive.resource.ResourceWebHandler"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,8 +340,8 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
childOf span(0)
|
||||
attributes {
|
||||
"request.predicate" "(POST && /echo)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(POST && /echo)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(EchoHandlerFunction.getName())
|
||||
}
|
||||
}
|
||||
|
@ -399,13 +399,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
attributes {
|
||||
if (annotatedMethod == null) {
|
||||
// Functional API
|
||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
} else {
|
||||
// Annotation API
|
||||
"handler.type" TestController.getName()
|
||||
"spring-webflux.handler.type" TestController.getName()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -455,8 +455,8 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
childOf span(0)
|
||||
attributes {
|
||||
"request.predicate" "(GET && /double-greet-redirect)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && /double-greet-redirect)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return (tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
|| tagVal.contains("Lambda"))
|
||||
}
|
||||
|
@ -484,8 +484,8 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
kind INTERNAL
|
||||
childOf span(0)
|
||||
attributes {
|
||||
"request.predicate" "(GET && /double-greet)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && /double-greet)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
}
|
||||
|
@ -536,13 +536,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
|||
attributes {
|
||||
if (annotatedMethod == null) {
|
||||
// Functional API
|
||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"handler.type" { String tagVal ->
|
||||
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||
"spring-webflux.handler.type" { String tagVal ->
|
||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||
}
|
||||
} else {
|
||||
// Annotation API
|
||||
"handler.type" TestController.getName()
|
||||
"spring-webflux.handler.type" TestController.getName()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ public class SpringWebfluxHttpClientTracer
|
|||
|
||||
public void onCancel(Context context) {
|
||||
Span span = Span.fromContext(context);
|
||||
span.setAttribute("event", "cancelled");
|
||||
span.setAttribute("message", "The subscription was cancelled");
|
||||
span.setAttribute("spring-webflux.event", "cancelled");
|
||||
span.setAttribute("spring-webflux.message", "The subscription was cancelled");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -91,10 +91,10 @@ public class SpringWebMvcTracer extends BaseTracer {
|
|||
}
|
||||
|
||||
private void onRender(Span span, ModelAndView mv) {
|
||||
span.setAttribute("view.name", mv.getViewName());
|
||||
span.setAttribute("spring-webmvc.view.name", mv.getViewName());
|
||||
View view = mv.getView();
|
||||
if (view != null) {
|
||||
span.setAttribute("view.type", spanNameForClass(view.getClass()));
|
||||
span.setAttribute("spring-webmvc.view.type", spanNameForClass(view.getClass()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ class SpringBootBasedTest extends HttpServerTest<ConfigurableApplicationContext>
|
|||
kind INTERNAL
|
||||
errored false
|
||||
attributes {
|
||||
"view.type" RedirectView.simpleName
|
||||
"spring-webmvc.view.type" RedirectView.simpleName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.spy.memcached.MemcachedConnection;
|
|||
|
||||
public abstract class CompletionListener<T> {
|
||||
|
||||
static final String DB_COMMAND_CANCELLED = "db.command.cancelled";
|
||||
static final String MEMCACHED_RESULT = "memcaced.result";
|
||||
static final String DB_COMMAND_CANCELLED = "lettuce.command.cancelled";
|
||||
static final String MEMCACHED_RESULT = "memcached.result";
|
||||
static final String HIT = "hit";
|
||||
static final String MISS = "miss";
|
||||
|
||||
|
|
Loading…
Reference in New Issue