Amazon SQS: Transactions and Distributed Tracing Headers for receiveMessage
#2012
Labels
agent-nodejs
Make available for APM Agents project planning.
receiveMessage
#2012
The current SQS implementation does not automatically generate transactions or handle the distributed tracing
traceparent
/tracecontext
headers for thereceiveMessage
API method. We currently recommend users use thestartTransaction
API to decide when/how they want transactions started for this use case.We should consider implementing automatic handling of both the transaction creation and distributed tracing headers for SQS queues.
Problems to Solve
Where to set the
traceparent
header.traceparent
might not be a "safe" value (this is unlike HTTP wheretraceparent
is considered safe since it's a W3C standard that's designed to be shared by multiple vendors.When to Create a Transaction
There's no clear/ideal place to start/stop a transaction. The
receiveMessage
method is a polling style API with a callback. Users callreceiveMessage
, passing in a callback. The SQS SDK will call this callback once it's finished fetching data and can return between 1 and 10 messagesMessages
property that contains an array of Message objects -- but the message objects are just native javascript objects. Wrapping either the iteration or access of these message is a non-trivial task.In addition to the challenges of where to set a distributing tracing header, there's also the question of how transaction parenting should work with this polling-via-callback style API. A single call to
receiveMessage
can return messages that may have started in different transactions. We don't have an implementation for anything like span links (which would allow a spans to have multiple parent-like spans), and attempting to link via a transaction for each message runs into the previously mention problem of not being able to wrap either the iteration or access to native message array.The text was updated successfully, but these errors were encountered: