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

[BUG]: Document more differences between ddtrace.auto and patch_all #11865

Closed
amacfie-tc opened this issue Jan 6, 2025 · 3 comments · Fixed by #11868
Closed

[BUG]: Document more differences between ddtrace.auto and patch_all #11865

amacfie-tc opened this issue Jan 6, 2025 · 3 comments · Fixed by #11868
Assignees
Labels

Comments

@amacfie-tc
Copy link

Tracer Version(s)

2.18

Python Version(s)

3.12

Pip Version(s)

24.3.1

Bug Report

The docs say that ddtrace.auto or patch_all can be used for instrumentation but there's no hint that exception replay only works for ddtrace.auto, not patch_all. This was a big time waster. Additionally, it would be nice to enable exception replay for patch_all.

Reproduction Code

No response

Error Logs

No response

Libraries in Use

No response

Operating System

No response

@mabdinur
Copy link
Contributor

mabdinur commented Jan 7, 2025

Hi @amacfie-tc,

Sorry about the confusion. ddtrace.patch_all(..) was introduced 8 years ago. Back then the ddtrace library only supported tracing and patch_all was designed to enable tracing integrations (ex: automatic tracing for fastapi, django, postgres, ...). ddtrace.auto was introduced in v2.2.0, it's primary purpose was to provide a programmatic way to configure/load all ddtrace products (tracing integrations via ddtrace.patch_all(...), exception replay, profiling, dynamic instrumentation, application security monitoring, etc.).

In all most all cases either ddtrace-run or import ddtrace.auto should be used. I will update the docs to make this more clear. We are currently considering deprecating ddtrace.patch_all(....). I will share this feedback with the team.

@mabdinur mabdinur self-assigned this Jan 7, 2025
@amacfie-tc
Copy link
Author

Hi @amacfie-tc,

Sorry about the confusion. ddtrace.patch_all(..) was introduced 8 years ago. Back then the ddtrace library only supported tracing and patch_all was designed to enable tracing integrations (ex: automatic tracing for fastapi, django, postgres, ...). ddtrace.auto was introduced in v2.2.0, it's primary purpose was to provide a programmatic way to configure/load all ddtrace products (tracing integrations via ddtrace.patch_all(...), exception replay, profiling, dynamic instrumentation, application security monitoring, etc.).

In all most all cases either ddtrace-run or import ddtrace.auto should be used. I will update the docs to make this more clear. We are currently considering deprecating ddtrace.patch_all(....). I will share this feedback with the team.

If we use ddtrace.auto, the way to exclude a library from instrumentation is via the DD_TRACE_<INTEGRATION>_ENABLED environment variables?

@mabdinur
Copy link
Contributor

mabdinur commented Jan 8, 2025

This map shows which integrations are enabled/disabled when patch_all is called by ddtrace-run or import ddtrace.auto:

PATCH_MODULES = {
.

To override these defaults you can use DD_TRACE_<INTEGRATION>_ENABLED or DD_PATCH_MODULES if you would like to override multiple integrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants