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

[BUG]: high latency when a trace has 10s of thousands of spans since 2.15.0

Open delfick opened this issue 10 months ago • 4 comments

Tracer Version(s)

2.15.0+

Python Version(s)

Python 3.12

Pip Version(s)

latest/uv

Bug Report

Hello,

In our very large Django app we have some views that manage to get 10s of thousands of spans from the ddtrace django integration wrapping django/forms/widgets/attrs.html and django/forms/widgets/select_option.html.

We upgraded from 2.9.4 to 2.19.3 at the start of the month and we noticed that the latency on these views went from a couple seconds to 25 seconds.

After releasing a number of the intervening versions we discovered that the performance penalty happens when upgrading past 2.14.7.

It is unclear exactly why and it appears we can't selectively not wrap specific templates.

I may need some assistance in figuring out what information you would need that may be helpful to understand what is happening here and what a fix could look like.

Reproduction Code

No response

Error Logs

No response

Libraries in Use

No response

Operating System

python:3.12.9-slim-bullseye docker image Linux 6.1.124 #1 SMP PREEMPT_DYNAMIC Sat Jan 25 00:17:27 UTC 2025 x86_64 GNU/Linux Debian 11.11

delfick avatar Feb 17 '25 03:02 delfick

Hello @delfick ,

Thank you for opening this issue.

Is there any further information you could provide such as:

a) Which integrations are you using with django? b) How are you enabling django tracing? (i.e. are you using ddtrace-run or import ddtrace.auto)? c) Is there any sample reproduction, such as a sample of your app, that you could provide (which might be related to the latency spike)?

Any information would help us to investigate the issue further!

quinna-h avatar Feb 19 '25 21:02 quinna-h

@quinna-h hello, we've created a support case with datadog and we'll answer those questions via that :)

delfick avatar Feb 20 '25 04:02 delfick

We are experiencing the same issue in kubernetes with uvicorn, Problem get worse when enabling more features. Any update on this?

psilveira-forte avatar Apr 09 '25 12:04 psilveira-forte

Hey @psilveira-forte , I don't think we were able to pinpoint the original issue on this thread, but this problem is likely feature and application dependent, would you mind opening a support ticket with details about the application and where you are seeing the spike (including features that you're using)?

If you reference this ticket, we can take a look with the support team.

wantsui avatar Apr 10 '25 21:04 wantsui

This issue has been automatically closed after a period of inactivity. If it's a feature request, it has been added to the maintainers' internal backlog and will be included in an upcoming round of feature prioritization. Please comment or reopen if you think this issue was closed in error.

github-actions[bot] avatar Sep 08 '25 00:09 github-actions[bot]