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

Add optional traceback as spanattribute for psycopg2 instrumentation #3296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adilbenameur
Copy link

Description

To help debug bad performance, I thought it would be useful to have the traceback of a call to a database. Especially for ORMs like Django's that make a lot of call that might not be wanted in the first place, it could help to find the code responsible for the calls.
The changes are non breaking.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I hadded tests to check that traceback would be indeed provided in the span (and not if the option is set to False).

  • test_enable_traceback (line 298 in instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py)
  • test_disabled_traceback (line 329 in instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py)

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated (not sure there is one for psycopg2 ?)
  • Unit tests have been added
  • Documentation has been updated (didn't found the doc to fill but I would happy to to)

Copy link

linux-foundation-easycla bot commented Feb 24, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: adilbenameur / name: Adil Benameur (8f4b497)

@adilbenameur adilbenameur force-pushed the add-optinal-traceback-to-psycopg2 branch from 26993ff to a938258 Compare February 24, 2025 19:10
@adilbenameur adilbenameur force-pushed the add-optinal-traceback-to-psycopg2 branch from a938258 to 8f4b497 Compare February 24, 2025 19:11
@xrmx
Copy link
Contributor

xrmx commented Feb 27, 2025

I understand the issue but it doesn't feel right to to add something ad-hoc per instrumentation

@adilbenameur
Copy link
Author

Would it be better if the PR also add support for the other database instrumention libs ? The implementation for psycopg2 was just for my use case but I understand that the libs must be uniform.

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

Successfully merging this pull request may close these issues.

2 participants