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
|
@Override
|
||||||
public void pre(Span span, Exchange exchange, Endpoint endpoint, CamelDirection camelDirection) {
|
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
|
@Override
|
||||||
|
|
|
@ -59,24 +59,24 @@ class KafkaSpanDecorator extends MessagingSpanDecorator {
|
||||||
span.setAttribute(SemanticAttributes.MESSAGING_OPERATION, "process");
|
span.setAttribute(SemanticAttributes.MESSAGING_OPERATION, "process");
|
||||||
span.setAttribute(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic");
|
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) {
|
if (partition != null) {
|
||||||
span.setAttribute("partition", partition);
|
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
String partitionKey = (String) exchange.getIn().getHeader(PARTITION_KEY);
|
String partitionKey = (String) exchange.getIn().getHeader(PARTITION_KEY);
|
||||||
if (partitionKey != null) {
|
if (partitionKey != null) {
|
||||||
span.setAttribute("partitionKey", partitionKey);
|
span.setAttribute("apache-camel.kafka.partitionKey", partitionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
String key = (String) exchange.getIn().getHeader(KEY);
|
String key = (String) exchange.getIn().getHeader(KEY);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
span.setAttribute("key", key);
|
span.setAttribute("apache-camel.kafka.key", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
String offset = getValue(exchange, OFFSET, Long.class);
|
String offset = getValue(exchange, OFFSET, Long.class);
|
||||||
if (offset != null) {
|
if (offset != null) {
|
||||||
span.setAttribute("offset", offset);
|
span.setAttribute("apache-camel.kafka.offset", offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,50 +16,50 @@ import spock.lang.Shared
|
||||||
|
|
||||||
class DirectCamelTest extends AgentTestRunner {
|
class DirectCamelTest extends AgentTestRunner {
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
ConfigurableApplicationContext server
|
ConfigurableApplicationContext server
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
def app = new SpringApplication(DirectConfig)
|
def app = new SpringApplication(DirectConfig)
|
||||||
server = app.run()
|
server = app.run()
|
||||||
}
|
|
||||||
|
|
||||||
def cleanupSpec() {
|
|
||||||
if (server != null) {
|
|
||||||
server.close()
|
|
||||||
server = null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
def "simple direct to a single services"() {
|
def cleanupSpec() {
|
||||||
setup:
|
if (server != null) {
|
||||||
def camelContext = server.getBean(CamelContext)
|
server.close()
|
||||||
ProducerTemplate template = camelContext.createProducerTemplate()
|
server = null
|
||||||
|
}
|
||||||
when:
|
}
|
||||||
template.sendBody("direct:input", "Example request")
|
|
||||||
|
def "simple direct to a single services"() {
|
||||||
then:
|
setup:
|
||||||
assertTraces(1) {
|
def camelContext = server.getBean(CamelContext)
|
||||||
trace(0, 2) {
|
ProducerTemplate template = camelContext.createProducerTemplate()
|
||||||
def parent = it
|
|
||||||
it.span(0) {
|
when:
|
||||||
name "input"
|
template.sendBody("direct:input", "Example request")
|
||||||
kind INTERNAL
|
|
||||||
hasNoParent()
|
then:
|
||||||
attributes {
|
assertTraces(1) {
|
||||||
"camel.uri" "direct://input"
|
trace(0, 2) {
|
||||||
}
|
def parent = it
|
||||||
|
it.span(0) {
|
||||||
|
name "input"
|
||||||
|
kind INTERNAL
|
||||||
|
hasNoParent()
|
||||||
|
attributes {
|
||||||
|
"apache-camel.uri" "direct://input"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.span(1) {
|
||||||
|
name "receiver"
|
||||||
|
kind INTERNAL
|
||||||
|
parentSpanId parent.span(0).spanId
|
||||||
|
attributes {
|
||||||
|
"apache-camel.uri" "direct://receiver"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
it.span(1) {
|
|
||||||
name "receiver"
|
|
||||||
kind INTERNAL
|
|
||||||
parentSpanId parent.span(0).spanId
|
|
||||||
attributes {
|
|
||||||
"camel.uri" "direct://receiver"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
hasNoParent()
|
hasNoParent()
|
||||||
attributes {
|
attributes {
|
||||||
"camel.uri" "direct://input"
|
"apache-camel.uri" "direct://input"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.span(1) {
|
it.span(1) {
|
||||||
|
@ -56,7 +56,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
parentSpanId parent.span(0).spanId
|
parentSpanId parent.span(0).spanId
|
||||||
attributes {
|
attributes {
|
||||||
"camel.uri" "direct://second"
|
"apache-camel.uri" "direct://second"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.span(2) {
|
it.span(2) {
|
||||||
|
@ -64,7 +64,7 @@ class MulticastDirectCamelTest extends AgentTestRunner {
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
parentSpanId parent.span(0).spanId
|
parentSpanId parent.span(0).spanId
|
||||||
attributes {
|
attributes {
|
||||||
"camel.uri" "direct://first"
|
"apache-camel.uri" "direct://first"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class RestCamelTest extends AgentTestRunner {
|
||||||
name "start"
|
name "start"
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
attributes {
|
attributes {
|
||||||
"camel.uri" "direct://start"
|
"apache-camel.uri" "direct://start"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.span(1) {
|
it.span(1) {
|
||||||
|
@ -78,7 +78,7 @@ class RestCamelTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
"$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) {
|
it.span(2) {
|
||||||
|
@ -101,14 +101,14 @@ class RestCamelTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$port/api/firstModule/unit/unitOne"
|
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$port/api/firstModule/unit/unitOne"
|
||||||
"camel.uri" String
|
"apache-camel.uri" String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.span(4) {
|
it.span(4) {
|
||||||
name "moduleUnit"
|
name "moduleUnit"
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
attributes {
|
attributes {
|
||||||
"camel.uri" "direct://moduleUnit"
|
"apache-camel.uri" "direct://moduleUnit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class SingleServiceCamelTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
"$SemanticAttributes.HTTP_URL.key" "${address.resolve("/camelService")}"
|
"$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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,149 +23,149 @@ import spock.lang.Shared
|
||||||
|
|
||||||
class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
int portOne
|
int portOne
|
||||||
@Shared
|
@Shared
|
||||||
int portTwo
|
int portTwo
|
||||||
@Shared
|
@Shared
|
||||||
ConfigurableApplicationContext server
|
ConfigurableApplicationContext server
|
||||||
@Shared
|
@Shared
|
||||||
CamelContext clientContext
|
CamelContext clientContext
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
withRetryOnAddressAlreadyInUse({
|
withRetryOnAddressAlreadyInUse({
|
||||||
setupSpecUnderRetry()
|
setupSpecUnderRetry()
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
def setupSpecUnderRetry() {
|
|
||||||
portOne = PortUtils.randomOpenPort()
|
|
||||||
portTwo = PortUtils.randomOpenPort()
|
|
||||||
def app = new SpringApplication(TwoServicesConfig)
|
|
||||||
app.setDefaultProperties(ImmutableMap.of("service.one.port", portOne, "service.two.port", portTwo))
|
|
||||||
server = app.run()
|
|
||||||
}
|
|
||||||
|
|
||||||
def createAndStartClient() {
|
|
||||||
clientContext = new DefaultCamelContext()
|
|
||||||
clientContext.addRoutes(new RouteBuilder() {
|
|
||||||
void configure() {
|
|
||||||
from("direct:input")
|
|
||||||
.log("SENT Client request")
|
|
||||||
.to("http://localhost:$portOne/serviceOne")
|
|
||||||
.log("RECEIVED Client response")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
clientContext.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
def cleanupSpec() {
|
|
||||||
if (server != null) {
|
|
||||||
server.close()
|
|
||||||
server = null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
def "two camel service spans"() {
|
def setupSpecUnderRetry() {
|
||||||
setup:
|
portOne = PortUtils.randomOpenPort()
|
||||||
createAndStartClient()
|
portTwo = PortUtils.randomOpenPort()
|
||||||
ProducerTemplate template = clientContext.createProducerTemplate()
|
def app = new SpringApplication(TwoServicesConfig)
|
||||||
|
app.setDefaultProperties(ImmutableMap.of("service.one.port", portOne, "service.two.port", portTwo))
|
||||||
when:
|
server = app.run()
|
||||||
template.sendBody("direct:input", "Example request")
|
}
|
||||||
|
|
||||||
then:
|
def createAndStartClient() {
|
||||||
assertTraces(1) {
|
clientContext = new DefaultCamelContext()
|
||||||
trace(0, 8) {
|
clientContext.addRoutes(new RouteBuilder() {
|
||||||
it.span(0) {
|
void configure() {
|
||||||
name "input"
|
from("direct:input")
|
||||||
kind INTERNAL
|
.log("SENT Client request")
|
||||||
attributes {
|
.to("http://localhost:$portOne/serviceOne")
|
||||||
"camel.uri" "direct://input"
|
.log("RECEIVED Client response")
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
it.span(1) {
|
clientContext.start()
|
||||||
name "POST"
|
}
|
||||||
kind CLIENT
|
|
||||||
attributes {
|
def cleanupSpec() {
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
if (server != null) {
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
server.close()
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
server = null
|
||||||
"camel.uri" "http://localhost:$portOne/serviceOne"
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
it.span(2) {
|
def "two camel service spans"() {
|
||||||
name "HTTP POST"
|
setup:
|
||||||
kind CLIENT
|
createAndStartClient()
|
||||||
attributes {
|
ProducerTemplate template = clientContext.createProducerTemplate()
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
when:
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
template.sendBody("direct:input", "Example request")
|
||||||
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
|
|
||||||
"$SemanticAttributes.NET_PEER_PORT.key" portOne
|
then:
|
||||||
"$SemanticAttributes.NET_TRANSPORT.key" "IP.TCP"
|
assertTraces(1) {
|
||||||
"$SemanticAttributes.HTTP_FLAVOR.key" "1.1"
|
trace(0, 8) {
|
||||||
}
|
it.span(0) {
|
||||||
}
|
name "input"
|
||||||
it.span(3) {
|
kind INTERNAL
|
||||||
name "/serviceOne"
|
attributes {
|
||||||
kind SERVER
|
"apache-camel.uri" "direct://input"
|
||||||
attributes {
|
}
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
}
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
it.span(1) {
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
name "POST"
|
||||||
"camel.uri" "http://0.0.0.0:$portOne/serviceOne"
|
kind CLIENT
|
||||||
}
|
attributes {
|
||||||
}
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
it.span(4) {
|
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
||||||
name "POST"
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
kind CLIENT
|
"apache-camel.uri" "http://localhost:$portOne/serviceOne"
|
||||||
attributes {
|
}
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
}
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
it.span(2) {
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
name "HTTP POST"
|
||||||
"camel.uri" "http://0.0.0.0:$portTwo/serviceTwo"
|
kind CLIENT
|
||||||
}
|
attributes {
|
||||||
}
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
it.span(5) {
|
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
||||||
name "HTTP POST"
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
kind CLIENT
|
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
|
||||||
attributes {
|
"$SemanticAttributes.NET_PEER_PORT.key" portOne
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
"$SemanticAttributes.NET_TRANSPORT.key" "IP.TCP"
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
"$SemanticAttributes.HTTP_FLAVOR.key" "1.1"
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
}
|
||||||
"$SemanticAttributes.NET_PEER_NAME.key" "0.0.0.0"
|
}
|
||||||
"$SemanticAttributes.NET_PEER_PORT.key" portTwo
|
it.span(3) {
|
||||||
"$SemanticAttributes.NET_TRANSPORT.key" "IP.TCP"
|
name "/serviceOne"
|
||||||
"$SemanticAttributes.HTTP_FLAVOR.key" "1.1"
|
kind SERVER
|
||||||
"$SemanticAttributes.HTTP_USER_AGENT.key" "Jakarta Commons-HttpClient/3.1"
|
attributes {
|
||||||
}
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
}
|
"$SemanticAttributes.HTTP_URL.key" "http://localhost:$portOne/serviceOne"
|
||||||
it.span(6) {
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
name "/serviceTwo"
|
"apache-camel.uri" "http://0.0.0.0:$portOne/serviceOne"
|
||||||
kind SERVER
|
}
|
||||||
attributes {
|
}
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
it.span(4) {
|
||||||
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
name "POST"
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
kind CLIENT
|
||||||
"$SemanticAttributes.NET_PEER_PORT.key" Number
|
attributes {
|
||||||
"$SemanticAttributes.NET_PEER_IP.key" InetAddress.getLocalHost().getHostAddress().toString()
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
"$SemanticAttributes.HTTP_USER_AGENT.key" "Jakarta Commons-HttpClient/3.1"
|
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||||
"$SemanticAttributes.HTTP_FLAVOR.key" "HTTP/1.1"
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
"$SemanticAttributes.HTTP_CLIENT_IP.key" InetAddress.getLocalHost().getHostAddress().toString()
|
"apache-camel.uri" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
it.span(5) {
|
||||||
it.span(7) {
|
name "HTTP POST"
|
||||||
name "/serviceTwo"
|
kind CLIENT
|
||||||
kind INTERNAL
|
attributes {
|
||||||
attributes {
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||||
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
"camel.uri" "jetty:http://0.0.0.0:$portTwo/serviceTwo?arg=value"
|
"$SemanticAttributes.NET_PEER_NAME.key" "0.0.0.0"
|
||||||
}
|
"$SemanticAttributes.NET_PEER_PORT.key" portTwo
|
||||||
}
|
"$SemanticAttributes.NET_TRANSPORT.key" "IP.TCP"
|
||||||
}
|
"$SemanticAttributes.HTTP_FLAVOR.key" "1.1"
|
||||||
|
"$SemanticAttributes.HTTP_USER_AGENT.key" "Jakarta Commons-HttpClient/3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.span(6) {
|
||||||
|
name "/serviceTwo"
|
||||||
|
kind SERVER
|
||||||
|
attributes {
|
||||||
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
|
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
|
||||||
|
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||||
|
"$SemanticAttributes.NET_PEER_PORT.key" Number
|
||||||
|
"$SemanticAttributes.NET_PEER_IP.key" InetAddress.getLocalHost().getHostAddress().toString()
|
||||||
|
"$SemanticAttributes.HTTP_USER_AGENT.key" "Jakarta Commons-HttpClient/3.1"
|
||||||
|
"$SemanticAttributes.HTTP_FLAVOR.key" "HTTP/1.1"
|
||||||
|
"$SemanticAttributes.HTTP_CLIENT_IP.key" InetAddress.getLocalHost().getHostAddress().toString()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.span(7) {
|
||||||
|
name "/serviceTwo"
|
||||||
|
kind INTERNAL
|
||||||
|
attributes {
|
||||||
|
"$SemanticAttributes.HTTP_METHOD.key" "POST"
|
||||||
|
"$SemanticAttributes.HTTP_URL.key" "http://0.0.0.0:$portTwo/serviceTwo"
|
||||||
|
"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
|
// 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
|
// 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
|
// 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() {
|
public void onCancel() {
|
||||||
try (Scope ignored = span.makeCurrent()) {
|
try (Scope ignored = span.makeCurrent()) {
|
||||||
delegate().onCancel();
|
delegate().onCancel();
|
||||||
span.setAttribute("canceled", true);
|
span.setAttribute("grpc.canceled", true);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
tracer.endExceptionally(span, e);
|
tracer.endExceptionally(span, e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class JaxRsAsyncResponseInstrumentation implements TypeInstrumentation {
|
||||||
Span span = contextStore.get(asyncResponse);
|
Span span = contextStore.get(asyncResponse);
|
||||||
if (span != null) {
|
if (span != null) {
|
||||||
contextStore.put(asyncResponse, null);
|
contextStore.put(asyncResponse, null);
|
||||||
span.setAttribute("canceled", true);
|
span.setAttribute("jaxrs.canceled", true);
|
||||||
tracer().end(span);
|
tracer().end(span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> {
|
||||||
childOf((SpanData) parent)
|
childOf((SpanData) parent)
|
||||||
attributes {
|
attributes {
|
||||||
if (isCancelled) {
|
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) {
|
public void onConsume(Span span, long startTimeMillis, ConsumerRecord<?, ?> record) {
|
||||||
// TODO should we set topic + offset as messaging.message_id?
|
// TODO should we set topic + offset as messaging.message_id?
|
||||||
span.setAttribute("partition", record.partition());
|
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, record.partition());
|
||||||
span.setAttribute("offset", record.offset());
|
span.setAttribute("kafka-clients.offset", record.offset());
|
||||||
|
|
||||||
if (record.value() == null) {
|
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
|
// 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();
|
long produceTime = record.timestamp();
|
||||||
// this attribute shows how much time elapsed between the producer and the consumer of this
|
// this attribute shows how much time elapsed between the producer and the consumer of this
|
||||||
// message, which can be helpful for identifying queue bottlenecks
|
// 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();
|
Integer partition = record.partition();
|
||||||
if (partition != null) {
|
if (partition != null) {
|
||||||
span.setAttribute("partition", partition);
|
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, partition);
|
||||||
}
|
}
|
||||||
if (record.value() == null) {
|
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_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 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_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 0 }
|
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
basicSpan(it, 3, "producer callback", span(0))
|
basicSpan(it, 3, "producer callback", span(0))
|
||||||
|
@ -197,9 +197,9 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 0 }
|
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
basicSpan(it, 3, "producer callback", span(0))
|
basicSpan(it, 3, "producer callback", span(0))
|
||||||
|
@ -267,7 +267,7 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
||||||
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"tombstone" true
|
"${SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE.key}" true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CONSUMER span 0
|
// CONSUMER span 0
|
||||||
|
@ -282,10 +282,10 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"${SemanticAttributes.MESSAGING_KAFKA_TOMBSTONE.key}" true
|
||||||
"record.queue_time_ms" { it >= 0 }
|
"kafka-clients.offset" 0
|
||||||
"tombstone" true
|
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
||||||
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
"${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka"
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
"${SemanticAttributes.MESSAGING_DESTINATION.key}" SHARED_TOPIC
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span(1) {
|
span(1) {
|
||||||
|
@ -356,9 +356,9 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 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) {
|
public void onConsume(Span span, StampedRecord record) {
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
span.setAttribute("partition", record.partition());
|
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, record.partition());
|
||||||
span.setAttribute("offset", record.offset());
|
span.setAttribute("kafka-streams.offset", record.offset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,9 +149,9 @@ class KafkaStreamsTest extends AgentTestRunner {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 0 }
|
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// STREAMING span 1
|
// STREAMING span 1
|
||||||
|
@ -165,8 +165,8 @@ class KafkaStreamsTest extends AgentTestRunner {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION.key}" STREAM_PENDING
|
"${SemanticAttributes.MESSAGING_DESTINATION.key}" STREAM_PENDING
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-streams.offset" 0
|
||||||
"asdf" "testing"
|
"asdf" "testing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,9 +194,9 @@ class KafkaStreamsTest extends AgentTestRunner {
|
||||||
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
"${SemanticAttributes.MESSAGING_DESTINATION_KIND.key}" "topic"
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" "process"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
"partition" { it >= 0 }
|
"${SemanticAttributes.MESSAGING_KAFKA_PARTITION.key}" { it >= 0 }
|
||||||
"offset" 0
|
"kafka-clients.offset" 0
|
||||||
"record.queue_time_ms" { it >= 0 }
|
"kafka-clients.record.queue_time_ms" { it >= 0 }
|
||||||
"testing" 123
|
"testing" 123
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public final class InstrumentationPoints {
|
||||||
if (ex == null) {
|
if (ex == null) {
|
||||||
LettuceDatabaseClientTracer.tracer().end(span);
|
LettuceDatabaseClientTracer.tracer().end(span);
|
||||||
} else if (ex instanceof CancellationException) {
|
} else if (ex instanceof CancellationException) {
|
||||||
span.setAttribute("db.command.cancelled", true);
|
span.setAttribute("lettuce.command.cancelled", true);
|
||||||
LettuceDatabaseClientTracer.tracer().end(span);
|
LettuceDatabaseClientTracer.tracer().end(span);
|
||||||
} else {
|
} else {
|
||||||
LettuceDatabaseClientTracer.tracer().endExceptionally(span, ex);
|
LettuceDatabaseClientTracer.tracer().endExceptionally(span, ex);
|
||||||
|
|
|
@ -433,7 +433,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"${SemanticAttributes.DB_SYSTEM.key()}" "redis"
|
"${SemanticAttributes.DB_SYSTEM.key()}" "redis"
|
||||||
"${SemanticAttributes.DB_STATEMENT.key()}" "SADD"
|
"${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
|
@Override
|
||||||
public R apply(T t, Throwable throwable) {
|
public R apply(T t, Throwable throwable) {
|
||||||
if (throwable instanceof CancellationException) {
|
if (throwable instanceof CancellationException) {
|
||||||
span.setAttribute("db.command.cancelled", true);
|
span.setAttribute("lettuce.command.cancelled", true);
|
||||||
tracer().end(span);
|
tracer().end(span);
|
||||||
} else {
|
} else {
|
||||||
tracer().endExceptionally(span, throwable);
|
tracer().endExceptionally(span, throwable);
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal<?>>, Runn
|
||||||
|
|
||||||
private Span span = null;
|
private Span span = null;
|
||||||
private int numResults = 0;
|
private int numResults = 0;
|
||||||
private FluxOnSubscribeConsumer onSubscribeConsumer;
|
private final FluxOnSubscribeConsumer onSubscribeConsumer;
|
||||||
|
|
||||||
public LettuceFluxTerminationRunnable(RedisCommand<?, ?, ?> command, boolean finishSpanOnClose) {
|
public LettuceFluxTerminationRunnable(RedisCommand<?, ?, ?> command, boolean finishSpanOnClose) {
|
||||||
onSubscribeConsumer = new FluxOnSubscribeConsumer(this, command, 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) {
|
private void finishSpan(boolean isCommandCancelled, Throwable throwable) {
|
||||||
if (span != null) {
|
if (span != null) {
|
||||||
span.setAttribute("db.command.results.count", numResults);
|
span.setAttribute("lettuce.command.results.count", numResults);
|
||||||
if (isCommandCancelled) {
|
if (isCommandCancelled) {
|
||||||
span.setAttribute("db.command.cancelled", true);
|
span.setAttribute("lettuce.command.cancelled", true);
|
||||||
}
|
}
|
||||||
if (throwable == null) {
|
if (throwable == null) {
|
||||||
tracer().end(span);
|
tracer().end(span);
|
||||||
|
|
|
@ -437,7 +437,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||||
"$SemanticAttributes.DB_STATEMENT.key" "SADD SKEY ? ?"
|
"$SemanticAttributes.DB_STATEMENT.key" "SADD SKEY ? ?"
|
||||||
"db.command.cancelled" true
|
"lettuce.command.cancelled" true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||||
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
||||||
"db.command.results.count" 157
|
"lettuce.command.results.count" 157
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,8 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||||
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
||||||
"db.command.cancelled" true
|
"lettuce.command.cancelled" true
|
||||||
"db.command.results.count" 2
|
"lettuce.command.results.count" 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class RabbitChannelInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
Integer deliveryMode = props.getDeliveryMode();
|
Integer deliveryMode = props.getDeliveryMode();
|
||||||
if (deliveryMode != null) {
|
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
|
// 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
|
// or if a plugin is installed on the rabbitmq broker
|
||||||
long produceTime = properties.getTimestamp().getTime();
|
long produceTime = properties.getTimestamp().getTime();
|
||||||
long consumeTime = NANOSECONDS.toMillis(startTimeMillis);
|
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;
|
return span;
|
||||||
|
@ -109,10 +109,9 @@ public class RabbitTracer extends BaseTracer {
|
||||||
? "<all>"
|
? "<all>"
|
||||||
: routingKey.startsWith("amq.gen-") ? "<generated>" : routingKey;
|
: routingKey.startsWith("amq.gen-") ? "<generated>" : routingKey;
|
||||||
span.updateName(exchangeName + " -> " + routing + " send");
|
span.updateName(exchangeName + " -> " + routing + " send");
|
||||||
span.setAttribute("amqp.command", "basic.publish");
|
span.setAttribute("rabbitmq.command", "basic.publish");
|
||||||
if (routingKey != null && !routingKey.isEmpty()) {
|
if (routingKey != null && !routingKey.isEmpty()) {
|
||||||
span.setAttribute("messaging.rabbitmq.routing_key", routingKey);
|
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) {
|
public void onGet(Span span, String queue) {
|
||||||
span.setAttribute("amqp.command", "basic.get");
|
span.setAttribute("rabbitmq.command", "basic.get");
|
||||||
span.setAttribute("amqp.queue", queue);
|
span.setAttribute("rabbitmq.queue", queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String spanNameOnDeliver(String queue) {
|
public String spanNameOnDeliver(String queue) {
|
||||||
|
@ -136,7 +135,7 @@ public class RabbitTracer extends BaseTracer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeliver(Span span, Envelope envelope) {
|
public void onDeliver(Span span, Envelope envelope) {
|
||||||
span.setAttribute("amqp.command", "basic.deliver");
|
span.setAttribute("rabbitmq.command", "basic.deliver");
|
||||||
|
|
||||||
if (envelope != null) {
|
if (envelope != null) {
|
||||||
String exchange = envelope.getExchange();
|
String exchange = envelope.getExchange();
|
||||||
|
@ -158,7 +157,7 @@ public class RabbitTracer extends BaseTracer {
|
||||||
if (!name.equals("basic.publish")) {
|
if (!name.equals("basic.publish")) {
|
||||||
span.updateName(name);
|
span.updateName(name);
|
||||||
}
|
}
|
||||||
span.setAttribute("amqp.command", name);
|
span.setAttribute("rabbitmq.command", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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:
|
setup:
|
||||||
channel.exchangeDeclare(exchangeName, "direct", false)
|
channel.exchangeDeclare(exchangeName, "direct", false)
|
||||||
String queueName = (messageCount % 2 == 0) ?
|
String queueName = (messageCount % 2 == 0) ?
|
||||||
|
@ -326,7 +326,7 @@ class RabbitMQTest extends AgentTestRunner {
|
||||||
trace.span(index) {
|
trace.span(index) {
|
||||||
name spanName
|
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":
|
case "basic.publish":
|
||||||
kind PRODUCER
|
kind PRODUCER
|
||||||
break
|
break
|
||||||
|
@ -369,30 +369,30 @@ class RabbitMQTest extends AgentTestRunner {
|
||||||
"${SemanticAttributes.MESSAGING_OPERATION.key}" operation
|
"${SemanticAttributes.MESSAGING_OPERATION.key}" operation
|
||||||
}
|
}
|
||||||
if (expectTimestamp) {
|
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":
|
case "basic.publish":
|
||||||
"amqp.command" "basic.publish"
|
"rabbitmq.command" "basic.publish"
|
||||||
"amqp.routing_key" {
|
"rabbitmq.routing_key" {
|
||||||
it == null || it == "some-routing-key" || it == "some-routing-queue" || it.startsWith("amq.gen-")
|
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
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
break
|
break
|
||||||
case "basic.get":
|
case "basic.get":
|
||||||
"amqp.command" "basic.get"
|
"rabbitmq.command" "basic.get"
|
||||||
//TODO why this queue name is not a destination for semantic convention
|
//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 }
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" { it == null || it instanceof Long }
|
||||||
break
|
break
|
||||||
case "basic.deliver":
|
case "basic.deliver":
|
||||||
"amqp.command" "basic.deliver"
|
"rabbitmq.command" "basic.deliver"
|
||||||
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
"${SemanticAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES.key}" Long
|
||||||
break
|
break
|
||||||
default:
|
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) {
|
public void onTimeout(Context context, long timeout) {
|
||||||
Span span = Span.fromContext(context);
|
Span span = Span.fromContext(context);
|
||||||
span.setStatus(StatusCode.ERROR);
|
span.setStatus(StatusCode.ERROR);
|
||||||
span.setAttribute("timeout", timeout);
|
span.setAttribute("servlet.timeout", timeout);
|
||||||
span.end();
|
span.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class HandlerAdapterAdvice {
|
||||||
}
|
}
|
||||||
|
|
||||||
span.updateName(operationName);
|
span.updateName(operationName);
|
||||||
span.setAttribute("handler.type", handlerType);
|
span.setAttribute("spring-webflux.handler.type", handlerType);
|
||||||
|
|
||||||
spanWithScope = new SpanWithScope(span, context.makeCurrent());
|
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);
|
Context context = (Context) serverRequest.attributes().get(AdviceUtils.CONTEXT_ATTRIBUTE);
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
Span span = Span.fromContext(context);
|
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);
|
Span serverSpan = context.get(BaseTracer.CONTEXT_SERVER_SPAN_KEY);
|
||||||
if (serverSpan != null) {
|
if (serverSpan != null) {
|
||||||
|
|
|
@ -83,13 +83,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
if (annotatedMethod == null) {
|
if (annotatedMethod == null) {
|
||||||
// Functional API
|
// Functional API
|
||||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Annotation API
|
// Annotation API
|
||||||
"handler.type" TestController.getName()
|
"spring-webflux.handler.type" TestController.getName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,13 +149,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
if (annotatedMethod == null) {
|
if (annotatedMethod == null) {
|
||||||
// Functional API
|
// Functional API
|
||||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Annotation API
|
// Annotation API
|
||||||
"handler.type" TestController.getName()
|
"spring-webflux.handler.type" TestController.getName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,13 +237,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
if (annotatedMethod == null) {
|
if (annotatedMethod == null) {
|
||||||
// Functional API
|
// Functional API
|
||||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Annotation API
|
// Annotation API
|
||||||
"handler.type" TestController.getName()
|
"spring-webflux.handler.type" TestController.getName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
errored true
|
errored true
|
||||||
errorEvent(ResponseStatusException, String)
|
errorEvent(ResponseStatusException, String)
|
||||||
attributes {
|
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
|
kind INTERNAL
|
||||||
childOf span(0)
|
childOf span(0)
|
||||||
attributes {
|
attributes {
|
||||||
"request.predicate" "(POST && /echo)"
|
"spring-webflux.request.predicate" "(POST && /echo)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(EchoHandlerFunction.getName())
|
return tagVal.contains(EchoHandlerFunction.getName())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,13 +399,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
if (annotatedMethod == null) {
|
if (annotatedMethod == null) {
|
||||||
// Functional API
|
// Functional API
|
||||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Annotation API
|
// Annotation API
|
||||||
"handler.type" TestController.getName()
|
"spring-webflux.handler.type" TestController.getName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,8 +455,8 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
childOf span(0)
|
childOf span(0)
|
||||||
attributes {
|
attributes {
|
||||||
"request.predicate" "(GET && /double-greet-redirect)"
|
"spring-webflux.request.predicate" "(GET && /double-greet-redirect)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return (tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return (tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
|| tagVal.contains("Lambda"))
|
|| tagVal.contains("Lambda"))
|
||||||
}
|
}
|
||||||
|
@ -484,8 +484,8 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
kind INTERNAL
|
kind INTERNAL
|
||||||
childOf span(0)
|
childOf span(0)
|
||||||
attributes {
|
attributes {
|
||||||
"request.predicate" "(GET && /double-greet)"
|
"spring-webflux.request.predicate" "(GET && /double-greet)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,13 +536,13 @@ class SpringWebfluxTest extends AgentTestRunner {
|
||||||
attributes {
|
attributes {
|
||||||
if (annotatedMethod == null) {
|
if (annotatedMethod == null) {
|
||||||
// Functional API
|
// Functional API
|
||||||
"request.predicate" "(GET && $urlPathWithVariables)"
|
"spring-webflux.request.predicate" "(GET && $urlPathWithVariables)"
|
||||||
"handler.type" { String tagVal ->
|
"spring-webflux.handler.type" { String tagVal ->
|
||||||
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
return tagVal.contains(INNER_HANDLER_FUNCTION_CLASS_TAG_PREFIX)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Annotation API
|
// Annotation API
|
||||||
"handler.type" TestController.getName()
|
"spring-webflux.handler.type" TestController.getName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ public class SpringWebfluxHttpClientTracer
|
||||||
|
|
||||||
public void onCancel(Context context) {
|
public void onCancel(Context context) {
|
||||||
Span span = Span.fromContext(context);
|
Span span = Span.fromContext(context);
|
||||||
span.setAttribute("event", "cancelled");
|
span.setAttribute("spring-webflux.event", "cancelled");
|
||||||
span.setAttribute("message", "The subscription was cancelled");
|
span.setAttribute("spring-webflux.message", "The subscription was cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -91,10 +91,10 @@ public class SpringWebMvcTracer extends BaseTracer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRender(Span span, ModelAndView mv) {
|
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();
|
View view = mv.getView();
|
||||||
if (view != null) {
|
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
|
kind INTERNAL
|
||||||
errored false
|
errored false
|
||||||
attributes {
|
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> {
|
public abstract class CompletionListener<T> {
|
||||||
|
|
||||||
static final String DB_COMMAND_CANCELLED = "db.command.cancelled";
|
static final String DB_COMMAND_CANCELLED = "lettuce.command.cancelled";
|
||||||
static final String MEMCACHED_RESULT = "memcaced.result";
|
static final String MEMCACHED_RESULT = "memcached.result";
|
||||||
static final String HIT = "hit";
|
static final String HIT = "hit";
|
||||||
static final String MISS = "miss";
|
static final String MISS = "miss";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue