Open miketheman opened 3 months ago
I also noticed that the majority of the tests in https://github.com/DataDog/dd-trace-py/blob/e9d838bd358d29b59b9906eb9bb564109743c7b8/tests/contrib/botocore/test.py assert whether the _datadog
key either exists or doesn't, but doesn't evaluate whether any of the other custom MessageAttributes make it through?
Hi @miketheman thanks for reaching out.
Spans for aws.sqs.sendmessage to have an extra attribute named task_name with the associated string value and can be viewed/searched/excluded for in the Datadog Trace UI.
This is an interesting feature request! So we'd take all the k/v pairs from message_attributes
and make them span tags?
We can probably do that, I'll see what the team says. In the meantime you can grab the active span and set them yourself if you'd like.
Thanks!
So we'd take all the k/v pairs from
message_attributes
and make them span tags?
Exactly!
In the meantime you can grab the active span and set them yourself if you'd like.
That could be interesting, however since I'm using Celery's apply_async
on the producer side, I'm not certain I have access to set metadata on spans.
Summary of problem
Using ddtrace and botocore, we do not see custom
MessageAttributes
being added to the ddtrace spans.We added setting custom message attributes via celery kwargs, and can confirm the custom attributed are being emitted to botocore, but are not being expanded or attached to the spans.
Which version of dd-trace-py are you using?
ddtrace==2.10.3
https://github.com/pypi/warehouse/blob/754886cb4e49226dfe75171d2cfec8aff0052ff4/requirements/deploy.txt#L25
Which version of pip are you using?
24.2
Which libraries and their versions are you using?
See https://github.com/pypi/warehouse/blob/754886cb4e49226dfe75171d2cfec8aff0052ff4/requirements/main.txt for full list
How can we reproduce your problem?
Set custom
MessageAttributes
on a call while being traced https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/client/send_message.htmlFor example,
"MessageAttributes": {"task_name": {"StringValue": "example_task_name", "DataType": "String"}
What is the result that you get?
Custom MessageAttributes are emitted - but only the
_datadog
ones get handled.Here's an example of a logged debug call from botocore in a local development environment:
We can see that both
task_name
and_datadog
keys are added to theMessageAttributes
dictionary - so the mechanics to emit them is correct.What is the result that you expected?
Spans for
aws.sqs.sendmessage
to have an extra attribute namedtask_name
with the associated string value and can be viewed/searched/excluded for in the Datadog Trace UI.