-
Notifications
You must be signed in to change notification settings - Fork 525
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
Support psycopg 3 #2427
Comments
Note: For the solution, I'm not aware of all the implication, but maybe we can also just implement this as an opentelemetry-python-contrib integration (they have psycopg2 but not psycopg3 yet (cf open-telemetry/opentelemetry-python-contrib#1751). But I did not manage to make the sentry OTEL integration work and send performance report to sentry 😅 |
Hey @antoine-de! Thanks for writing in! We have no integrations for the low level psycopg lib but for higher level database access libs like Django ORM or SQLAlchemy or asyncpg. In my test application I have How do you connect to your database? |
I only use psycopg directly, no ORM, so I do things like: with psycopg.connect("url") as conn:
conn.execute("some sql") # or use a cursor |
In that case it's expected behavior that nothing shows up in Sentry @antoine-de -- we'd need an integration specifically for psycopg, which doesn't exist at the moment. We don't have any concrete plans to add it in the near future. However, if you or someone else feels like contributing it, please go ahead! We have this checklist that might be helpful and one can also get inspired by the existing DB integrations (e.g. asyncpg). It also doesn't have to be perfect, we can iron out the details during PR review. |
Hey @sentrivana, I wanted to work on creating this integration. As psycopg2 (v2) and psycopg (v3) are different packages, my first idea is I can just develop it for v2 because v2 has got lot more user community than v3. Should this new integration be for version V2.9.9 which is the latest version ? Also should this be the place to ask any questions I might have in regards to this ? |
As described in my comment above (#2427 (comment)) we do not need a dedicated psycopg3 integrations, because we hook into sqlalchemy and django. So please do not create an integration @vagi8 ! (and also thanks for patience with the django pr you supplied) |
I'm not sure I understand @antonpirker , don't sentry also need a psycopg3 integration for users using psycopg3 without sqlalchemy or django? For my use case, I added a simple spycopg3 integration directly in my project to iterate quickly (here), but I can try to send a PR if you think this can be useful to others. |
Yes for the case that you do not use SQLAlchemy or Django a distinct integration would be useful. I just meant if you use SQLAlchemy or Django, then psycopg3 should "just work". In this case a distinct integration would definitely make sense. (I honestly was not thinking about people using a postgres db without ORM) |
No problem, I might be a weird one for not liking ORMs too much 😁 I'll try to find the time to open a PR with what I have. |
Problem Statement
Hi, I'm not sure if I'm missing something but I cannot find sentry's support for psycopg v3 (well, named psycopg ) and If I try a simple test I cannot find sql query information in sentry when using psycopg3.
Am I missing something ? I feel like I'm missing something since I cannot also find the psycopg2 integration, but I'm not very familiar with sentry's code, so maybe I'm looking in the wrong places.
And if it's not yet supported, do you plan to support it?
Thanks for this great project!
Solution Brainstorm
I guess, we would have to add a specific integration for psycopg3. I'm not sure I feel confident to do a correct and clean implementation of this, but I can try if you want.
The text was updated successfully, but these errors were encountered: