dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

aiobotocore integration: spans are not tagged with service = `aws.<endpoint>`, but with the value of `DD_SERVICE`

Open Neki opened this issue 3 years ago • 0 comments

Which version of dd-trace-py are you using?

0.47

Which version of the libraries are you using?

aiobotocore 1.1.2

How can we reproduce your problem?

Set the environment variables DD_SERVICE="something", DD_TRACE_AIOBOTOCORE_ENABLED="true" . Instrument any application using aiobotocore with ddtrace-run.

What is the result that you get?

Spans resulting from aiobotocore are tagged with service="something".

What is the result that you expected?

I expected that such spans would be tagged with service="aws.<endpoint>" (such as aws.s3, aws.lambda...).

The behavior is different between the aiobotocore and botocore integrations. The botocore integration always uses aws.<endpoint> (https://github.com/DataDog/dd-trace-py/blob/0.47/ddtrace/contrib/botocore/patch.py#L116), while the aiobotocore integration uses config.service as the service name (https://github.com/DataDog/dd-trace-py/blob/0.47/ddtrace/contrib/aiobotocore/patch.py#L36).

I prefer the behavior of the botocore integration. Out of the box, seeing how much time is spent in AWS calls is made much easier by having a separate service for S3 calls.

As a workaround, I added to the application code this snippet:

import aiobotocore
from ddtrace.pin import Pin

Pin("aws", app="aws").onto(aiobotocore.client.AioBaseClient)

and it seems to work, but I'm wondering if there's an official way to do that, or even if the integration base behavior should be changed to match what is done for botocore.

Neki avatar Mar 08 '21 16:03 Neki