netty 4.1: do not modify headers in aws request

This commit is contained in:
Nikolay Martynov 2019-01-23 22:18:15 -05:00
parent 07d10e2374
commit cb1313ea9a
1 changed files with 6 additions and 3 deletions

View File

@ -53,9 +53,12 @@ public class HttpClientRequestTracingHandler extends ChannelOutboundHandlerAdapt
.withTag(DDTags.SPAN_TYPE, DDSpanTypes.HTTP_CLIENT)
.start();
GlobalTracer.get()
.inject(
span.context(), Format.Builtin.HTTP_HEADERS, new NettyResponseInjectAdapter(request));
// AWS calls are often signed, so we can't add headers without breaking the signature.
if (!request.headers().contains("amz-sdk-invocation-id")) {
GlobalTracer.get()
.inject(
span.context(), Format.Builtin.HTTP_HEADERS, new NettyResponseInjectAdapter(request));
}
ctx.channel().attr(AttributeKeys.CLIENT_ATTRIBUTE_KEY).set(span);