Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default dd-trace django Configuration = Results in Duplicate Spans for DB Queries #10833

Open
colinbjohnson opened this issue Sep 26, 2024 · 0 comments

Comments

@colinbjohnson
Copy link

Summary of problem

When using a default install of the dd-trace module and running django requests to a backend database will be duplicated.

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

ddtrace==2.13.0

Which version of pip are you using?

pip 24.2

Which libraries and their versions are you using?

asgiref==3.8.1
bytecode==0.15.1
ddtrace==2.13.0
Deprecated==1.2.14
Django==5.1.1
envier==0.5.2
importlib_metadata==8.4.0
opentelemetry-api==1.27.0
protobuf==5.28.2
psycopg2-binary==2.9.9
sqlparse==0.5.1
typing_extensions==4.12.2
wrapt==1.16.0
xmltodict==0.13.0
zipp==3.20.2

How can we reproduce your problem?

  1. Checkout the repository and directory here: https://github.com/DataDog/trace-examples/tree/master/python/django/django-tutorial
  2. Run the command DD_API_KEY=... docker compose up --build -d
  3. Login to DataDog and from the left-hand navigation select APM -> Traces -> Explorer

What is the result that you get?

We get nearly duplicate spans - one span is under the service defaultdb and one span is under the service postgres. A screenshot is provided below:

dd-trace - Duplicate Spans

What is the result that you expected?

We expect, by default, to have only one span provided.

Other Notes:

  1. We are aware that we can use a configuration line config.django['instrument_databases'] = False to remove the duplicate spans.
  2. We do feel that the default behavior of a tracing library would be to somehow avoid the duplication of spans as this creates additional data that is not useful - this:
  • creates a distraction for APM users (needing to filter through duplicates)
  • increases DataDog APM costs for ingested spans
  • likely increases network usage and slightly increases resource usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant