-
Notifications
You must be signed in to change notification settings - Fork 468
[dbapi2] disable fetchone/fetchmany/fetchall tracing by default #780
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
Conversation
labbati
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR, great work!
One possible future optimisation could be to split configuration per-method, or at least fetchone vs fetch*. With only one config parameter a user having even only one problematic method would have to give up completely on tracing fetch methods.
Again, a possible future optimisation, and only if we find out that users actually require it.
|
Yeah, I thought about that approach as well, wasn't sure if we wanted the ability to over-customize, and I wanted to avoid instrumenting those functions but bailing based on configuration. e.g. def trace_fetchone():
if not config.dbapi2.trace_fetchone:
return wrapped(*args, **kwargs)
# do tracingSince this approach could still cause performance issues. |
In a release
0.17.0we added instrumentation fordbapi2fetchone,fetchmany, andfetchallmethods.While we want to provide instrumentation for these methods tracing them by default has caused issues. The reason being that most database libraries will use
fetchone()when iterating over a cursor. This will cause your application to create an unnecessarily large number of spans when returning back a large number of rows from the database.With this change we are disabling this tracing by default but provide a configuration option for enabling:
It can also be enabled with the environment variable
DD_DBAPI2_TRACE_FETCH_METHODS=true