Skip to content

Commit 11d43a3

Browse files
committed
feat(aws): Refactor AWS instrumentation around Context
1 parent 84745b0 commit 11d43a3

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

dd-java-agent/instrumentation/aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsClientInstrumentation.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public String[] helperClassNames() {
4242
@Override
4343
public Map<String, String> contextStore() {
4444
return Collections.singletonMap(
45-
"com.amazonaws.AmazonWebServiceRequest",
46-
"datadog.trace.bootstrap.instrumentation.api.AgentSpan");
45+
"com.amazonaws.AmazonWebServiceRequest", "datadog.context.Context");
4746
}
4847

4948
public static class HandlerChainAdvice {
@@ -57,8 +56,7 @@ public static void addHandler(@Advice.Return final List<RequestHandler2> handler
5756
handlers.add(
5857
new SnsInterceptor(
5958
InstrumentationContext.get(
60-
"com.amazonaws.AmazonWebServiceRequest",
61-
"datadog.trace.bootstrap.instrumentation.api.AgentSpan")));
59+
"com.amazonaws.AmazonWebServiceRequest", "datadog.context.Context")));
6260
}
6361
}
6462
}

dd-java-agent/instrumentation/aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsInterceptor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
public class SnsInterceptor extends RequestHandler2 {
2727

28-
private final ContextStore<AmazonWebServiceRequest, AgentSpan> contextStore;
28+
private final ContextStore<AmazonWebServiceRequest, Context> contextStore;
2929

30-
public SnsInterceptor(ContextStore<AmazonWebServiceRequest, AgentSpan> contextStore) {
30+
public SnsInterceptor(ContextStore<AmazonWebServiceRequest, Context> contextStore) {
3131
this.contextStore = contextStore;
3232
}
3333

@@ -108,6 +108,7 @@ private AgentSpan newSpan(AmazonWebServiceRequest request) {
108108
final AgentSpan span = AgentTracer.startSpan("aws.sns.send");
109109
// pass the span to TracingRequestHandler in the sdk instrumentation where it'll be enriched &
110110
// activated
111+
// TODO If DSM is enabled, add DSM context here too
111112
contextStore.put(request, span);
112113
return span;
113114
}

0 commit comments

Comments
 (0)