Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camel instrumentation - SNS propagation impl + tests #2562

Merged
merged 2 commits into from Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ dependencies {
testImplementation group: 'org.spockframework', name: 'spock-spring', version: "$versions.spock"
testImplementation 'javax.xml.bind:jaxb-api:2.3.1'
testImplementation group: 'org.elasticmq', name: 'elasticmq-rest-sqs_2.12', version: '1.0.0'
/**
* Temporarily using emq instead of localstack till the latter supports AWS trace propagation
*
* testImplementation deps.testcontainers
* testImplementation "org.testcontainers:localstack:${versions.testcontainers}
**/

testImplementation deps.testcontainers
testImplementation "org.testcontainers:localstack:${versions.testcontainers}"

latestDepTestLibrary group: 'org.apache.camel', name: 'camel-core', version: '2.+'
latestDepTestLibrary group: 'org.apache.camel', name: 'camel-spring-boot-starter', version: '2.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ final class CamelPropagationUtil {

private CamelPropagationUtil() {}

private static boolean isAwsPropagated(Endpoint endpoint) {
return endpoint.getClass().getName().endsWith("SqsEndpoint");
}

static Context extractParent(final Map<String, Object> exchangeHeaders, Endpoint endpoint) {
return (isAwsPropagated(endpoint)
? extractAwsPropagationParent(exchangeHeaders)
: extractHttpPropagationParent(exchangeHeaders));
}

private static boolean isAwsPropagated(Endpoint endpoint) {
return endpoint.getClass().getName().endsWith("SqsEndpoint");
}

private static Context extractAwsPropagationParent(final Map<String, Object> exchangeHeaders) {
return AwsXrayPropagator.getInstance()
.extract(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ protected String getDestination(Exchange exchange, Endpoint endpoint) {
@Override
public SpanKind getInitiatorSpanKind() {
switch (component) {
case "aws-sns":
case "aws-sqs":
return SpanKind.INTERNAL;
default:
Expand All @@ -105,6 +106,7 @@ public SpanKind getInitiatorSpanKind() {
@Override
public SpanKind getReceiverSpanKind() {
switch (component) {
case "aws-sns":
case "aws-sqs":
return SpanKind.INTERNAL;
default:
Expand Down
Loading