Remove trace injection into AWS requests
I don’t think these are helping us and we may still risk messing up the signed request if this happens too late.
This commit is contained in:
parent
bb7923571e
commit
ca708db5da
|
@ -8,8 +8,6 @@ import com.amazonaws.Response;
|
||||||
import com.amazonaws.handlers.HandlerContextKey;
|
import com.amazonaws.handlers.HandlerContextKey;
|
||||||
import com.amazonaws.handlers.RequestHandler2;
|
import com.amazonaws.handlers.RequestHandler2;
|
||||||
import io.opentracing.Scope;
|
import io.opentracing.Scope;
|
||||||
import io.opentracing.propagation.Format;
|
|
||||||
import io.opentracing.propagation.TextMapInjectAdapter;
|
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
|
|
||||||
/** Tracing Request Handler */
|
/** Tracing Request Handler */
|
||||||
|
@ -31,15 +29,6 @@ public class TracingRequestHandler extends RequestHandler2 {
|
||||||
final Scope scope = GlobalTracer.get().buildSpan("aws.command").startActive(true);
|
final Scope scope = GlobalTracer.get().buildSpan("aws.command").startActive(true);
|
||||||
DECORATE.afterStart(scope.span());
|
DECORATE.afterStart(scope.span());
|
||||||
DECORATE.onRequest(scope.span(), request);
|
DECORATE.onRequest(scope.span(), request);
|
||||||
|
|
||||||
// We inject headers at aws-client level because aws requests may be signed and adding headers
|
|
||||||
// on http-client level may break signature.
|
|
||||||
GlobalTracer.get()
|
|
||||||
.inject(
|
|
||||||
scope.span().context(),
|
|
||||||
Format.Builtin.HTTP_HEADERS,
|
|
||||||
new TextMapInjectAdapter(request.getHeaders()));
|
|
||||||
|
|
||||||
request.addHandlerContext(SCOPE_CONTEXT_KEY, scope);
|
request.addHandlerContext(SCOPE_CONTEXT_KEY, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,8 @@ class AWSClientTest extends AgentTestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.lastRequest.headers.get("x-datadog-trace-id") == TEST_WRITER[0][0].traceId
|
server.lastRequest.headers.get("x-datadog-trace-id") == null
|
||||||
server.lastRequest.headers.get("x-datadog-parent-id") == TEST_WRITER[0][0].spanId
|
server.lastRequest.headers.get("x-datadog-parent-id") == null
|
||||||
|
|
||||||
where:
|
where:
|
||||||
service | operation | method | url | handlerCount | call | body | client
|
service | operation | method | url | handlerCount | call | body | client
|
||||||
|
|
|
@ -142,8 +142,8 @@ class AWSClientTest extends AgentTestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.lastRequest.headers.get("x-datadog-trace-id") == TEST_WRITER[0][0].traceId
|
server.lastRequest.headers.get("x-datadog-trace-id") == null
|
||||||
server.lastRequest.headers.get("x-datadog-parent-id") == TEST_WRITER[0][0].spanId
|
server.lastRequest.headers.get("x-datadog-parent-id") == null
|
||||||
|
|
||||||
where:
|
where:
|
||||||
service | operation | method | url | handlerCount | call | body | client
|
service | operation | method | url | handlerCount | call | body | client
|
||||||
|
|
|
@ -5,8 +5,6 @@ import static datadog.trace.instrumentation.aws.v2.AwsSdkClientDecorator.DECORAT
|
||||||
import datadog.trace.context.TraceScope;
|
import datadog.trace.context.TraceScope;
|
||||||
import io.opentracing.Scope;
|
import io.opentracing.Scope;
|
||||||
import io.opentracing.Span;
|
import io.opentracing.Span;
|
||||||
import io.opentracing.Tracer;
|
|
||||||
import io.opentracing.propagation.Format;
|
|
||||||
import io.opentracing.propagation.TextMap;
|
import io.opentracing.propagation.TextMap;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -49,16 +47,6 @@ public class TracingExecutionInterceptor implements ExecutionInterceptor {
|
||||||
DECORATE.onAttributes(span, executionAttributes);
|
DECORATE.onAttributes(span, executionAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SdkHttpRequest modifyHttpRequest(
|
|
||||||
final Context.ModifyHttpRequest context, final ExecutionAttributes executionAttributes) {
|
|
||||||
final Tracer tracer = GlobalTracer.get();
|
|
||||||
final Span span = executionAttributes.getAttribute(SPAN_ATTRIBUTE);
|
|
||||||
final SdkHttpRequest.Builder builder = context.httpRequest().toBuilder();
|
|
||||||
tracer.inject(span.context(), Format.Builtin.HTTP_HEADERS, new InjectAdapter(builder));
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTransmission(
|
public void beforeTransmission(
|
||||||
final Context.BeforeTransmission context, final ExecutionAttributes executionAttributes) {
|
final Context.BeforeTransmission context, final ExecutionAttributes executionAttributes) {
|
||||||
|
|
|
@ -105,8 +105,8 @@ class AwsClientTest extends AgentTestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.lastRequest.headers.get("x-datadog-trace-id") == TEST_WRITER[0][0].traceId
|
server.lastRequest.headers.get("x-datadog-trace-id") == null
|
||||||
server.lastRequest.headers.get("x-datadog-parent-id") == TEST_WRITER[0][0].spanId
|
server.lastRequest.headers.get("x-datadog-parent-id") == null
|
||||||
|
|
||||||
where:
|
where:
|
||||||
service | operation | method | path | requestId | call | body | builder
|
service | operation | method | path | requestId | call | body | builder
|
||||||
|
@ -202,8 +202,8 @@ class AwsClientTest extends AgentTestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.lastRequest.headers.get("x-datadog-trace-id") == TEST_WRITER[0][0].traceId
|
server.lastRequest.headers.get("x-datadog-trace-id") == null
|
||||||
server.lastRequest.headers.get("x-datadog-parent-id") == TEST_WRITER[0][0].spanId
|
server.lastRequest.headers.get("x-datadog-parent-id") == null
|
||||||
|
|
||||||
where:
|
where:
|
||||||
service | operation | method | path | requestId | call | body | builder
|
service | operation | method | path | requestId | call | body | builder
|
||||||
|
|
Loading…
Reference in New Issue