Skip to content

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)

@linux-foundation-easycla
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 xrmx moved this to Ready for review in @xrmx's Python PR digest Feb 27, 2025
@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

@xrmx xrmx moved this from Ready for review to Reviewed PR that needs fixing in @xrmx's Python PR digest Feb 27, 2025
@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

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

2 participants