Skip to content

Commit

Permalink
fixing Apache Camel instrumentation propagation order (#2052)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-wu committed Jan 15, 2021
1 parent 72a4b9a commit c16967d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ private void onExchangeSending(ExchangeSendingEvent ese) {
sd.getOperationName(ese.getExchange(), ese.getEndpoint(), CamelDirection.OUTBOUND);
Span span = CamelTracer.TRACER.startSpan(name, sd.getInitiatorSpanKind());
sd.pre(span, ese.getExchange(), ese.getEndpoint(), CamelDirection.OUTBOUND);
CamelPropagationUtil.injectParent(Context.current(), ese.getExchange().getIn().getHeaders());
ActiveSpanManager.activate(ese.getExchange(), span, CamelDirection.OUTBOUND);
CamelPropagationUtil.injectParent(Context.current(), ese.getExchange().getIn().getHeaders());

LOG.debug("[Exchange sending] Initiator span started: {}", span);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class RestCamelTest extends AgentTestRunner {
it.span(1) {
name "GET"
kind CLIENT
parentSpanId(span(0).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "GET"
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
Expand All @@ -84,6 +85,7 @@ class RestCamelTest extends AgentTestRunner {
it.span(2) {
name "/api/{module}/unit/{unitId}"
kind SERVER
parentSpanId(span(1).spanId)
attributes {
"$SemanticAttributes.HTTP_URL.key" "http:https://localhost:$port/api/firstModule/unit/unitOne"
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
Expand All @@ -98,6 +100,7 @@ class RestCamelTest extends AgentTestRunner {
it.span(3) {
name "/api/{module}/unit/{unitId}"
kind INTERNAL
parentSpanId(span(2).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "GET"
"$SemanticAttributes.HTTP_URL.key" "http:https://localhost:$port/api/firstModule/unit/unitOne"
Expand All @@ -107,6 +110,7 @@ class RestCamelTest extends AgentTestRunner {
it.span(4) {
name "moduleUnit"
kind INTERNAL
parentSpanId(span(3).spanId)
attributes {
"apache-camel.uri" "direct:https://moduleUnit"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
it.span(1) {
name "POST"
kind CLIENT
parentSpanId(span(0).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "POST"
"$SemanticAttributes.HTTP_URL.key" "http:https://localhost:$portOne/serviceOne"
Expand All @@ -97,6 +98,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
it.span(2) {
name "/serviceOne"
kind SERVER
parentSpanId(span(1).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "POST"
"$SemanticAttributes.HTTP_URL.key" "http:https://localhost:$portOne/serviceOne"
Expand All @@ -107,6 +109,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
it.span(3) {
name "POST"
kind CLIENT
parentSpanId(span(2).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "POST"
"$SemanticAttributes.HTTP_URL.key" "http:https://0.0.0.0:$portTwo/serviceTwo"
Expand All @@ -117,6 +120,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
it.span(4) {
name "/serviceTwo"
kind SERVER
parentSpanId(span(3).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "POST"
"$SemanticAttributes.HTTP_STATUS_CODE.key" 200
Expand All @@ -132,6 +136,7 @@ class TwoServicesWithDirectClientCamelTest extends AgentTestRunner {
it.span(5) {
name "/serviceTwo"
kind INTERNAL
parentSpanId(span(4).spanId)
attributes {
"$SemanticAttributes.HTTP_METHOD.key" "POST"
"$SemanticAttributes.HTTP_URL.key" "http:https://0.0.0.0:$portTwo/serviceTwo"
Expand Down

0 comments on commit c16967d

Please sign in to comment.