Description
Runtime:
All of them
Is your feature request related to a problem? Please describe
SQS Supports XRay but since Lambda execution is done as batch the lambda function consuming the queue starts a new trace. To work around this the consuming lambda needs to over write the traceid with the AWSTraceHeader value.
`func handler(ctx context.Context, event events.SQSEvent) {
if trcHdrStr, ok := event.Records[0].Attributes["AWSTraceHeader"]; ok {
traceHeader := header.FromString(trcHdrStr)
var seg *xray.Segment
ctx, seg = xray.BeginSegment(ctx, "YOUR-SEGMENT-NAME")
seg.TraceID = traceHeader.TraceID
seg.ParentID = traceHeader.ParentID
seg.Sampled = traceHeader.SamplingDecision == header.Sampled
defer seg.Close(nil)
}
}`
This is described at length here https://medium.com/@filiplubniewski/distributed-tracing-in-serverless-with-x-ray-lambda-sqs-and-golang-f38616cbd79b
Describe the solution you'd like
This would be perfect to have as an annotation
Describe alternatives you've considered
Its obivously an annotation ;)
If you provide guidance, is this something you'd like to contribute?
Additional context