You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Now the Python process can terminate, with all the spans closed so far sent to Lumigo
195
195
```
196
+
197
+
### Consuming SQS messages with Boto3 receive_message
198
+
199
+
Messaging instrumentations that retrieve messages from queues tend to be counter-intuitive for end-users: when retrivieng one of more messages from the queue, one would natutally expect that all calls done _using data from those messages_, e.g., sending their content to a database or another queue, would result in spans that are children of the describing the retrivieng of those messages.
200
+
201
+
Consider the following scenario, which is supported by the `boto3` SQS `receive_message` instrumentation of the Lumigo OpenTelemetry Distro for Python:
202
+
203
+
```python
204
+
response = client.receive_message(...) # Instrumentation creates a `span_0` span
205
+
206
+
for message in response.get("Messages", []):
207
+
# The SQS.ReceiveMessage span is active in this scope
208
+
with trace.start_as_current_span("span_1"): # span_0 is the parent of span_1
209
+
do_something()
210
+
```
211
+
212
+
Without the scope provided by the iterator over `response["Messages"]`, `span_1` would be without a parent span, and that would result in a separate invocation and a separate transaction in Lumigo.
0 commit comments