Open fabianfett opened 4 years ago
In such a case library authors will need to write their own Extractor and Injector that are specialized towards a tracing solution (in this case XRay) and therefore can ignore the name passed by the tracing lib.
I would like to understand the problem. I am not sure which name needs to be ignored,
the (X-Ray) context in the baggage can be changed either using custom Extractor
and Injector
implementations (swift-tracing
implements HTTPHeadersExtractor
), example from https://github.com/pokryfka/aws-xray-sdk-swift/blob/857c1c3bc12717a847b15f48eaa2bff4094854a3/Examples/Sources/AWSXRayInstrumentExample/main.swift#L43 using https://github.com/pokryfka/aws-xray-sdk-swift/blob/857c1c3bc12717a847b15f48eaa2bff4094854a3/Sources/AWSXRayInstrument/Instrument.swift#L24:
// extract the context from HTTP headers
let headers = HTTPHeaders([
("X-Amzn-Trace-Id", tracingHeader),
])
var baggage = BaggageContext()
tracer.extract(headers, into: &baggage, using: HTTPHeadersExtractor())
or even explicitly updating the baggage, this will affect just one tracer (but it might make sense in case of an AWS Service):
baggage.xRayContext = newContext
(xRayContext
will be renamed to xRay
)
BTW please note that in case of AWS Lambda the XRay context (tracing header value) is also passed differently:
in Lambda-Runtime-Trace-Id
header, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-next
The AWS SQS service propagates context between sender and consumer over SQSMessageAttributes. The identifier for the message attribute that is used for context propagation "AWSTraceHeader" is different than the one normally used for HTTP based propagation: "X-Amzn-Trace-Id".
In such a case library authors will need to write their own
Extractor
andInjector
that are specialized towards a tracing solution (in this case XRay) and therefore can ignore the name passed by the tracing lib.Documentation: https://docs.aws.amazon.com/xray/latest/devguide/xray-services-sqs.html