sentry-python
sentry-python copied to clipboard
asynpc support?
Would it be possible to add support for asyncpg in the performance monitoring? I notice that SQLAlchemy for example is automatically set up, so I was wondering if this support could be extended to convert asyncpg. Hopefully this is the right place to ask this, thanks
This would be super useful. Is there any appetite to do this in the next few months?
@JamesTimms I'll run it through the team, but don't think it's on our prio list. If you want it sooner, PRs are always welcome!
You can look at the existing integrations as a rough guide on what you need to do, but basically you need to monkeypatch the query execution and do a start_span so that you instrument queries.
Hey :wave:
I know this issue is a bit older, but I'd be happy to work on this if this is still open :slightly_smiling_face:
I've already implement an integration (see #2154). All I need to know is what is expected from the integration to avoid fitting it to close to my own needs :slightly_smiling_face:
Hey @mimre25 Sorry for the late response, this kind of slipped through the cracks and the last couple of weeks I was on vacation.
If you are still willing to give it a go: It would be AMAZING if you could create an integrations for asyncpg.
In general the first implementation of the integrations should create spans for all the SQL requests to the database. See the record_sql_queries context manager we use in the Django ORM integration: https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/django/init.py#L606-L616
The span should have the op=OP.DB and also make sure that the description has the parameterized version of SQL query so we do not leak sensitive data (so alter table my_user set pwd = % instead of alter table my_user set pwd = "super_secrect_pwd")
I've started working on it and have a very basic implementation -> I've left some questions in the Draft PR.
Second round of review is done. Please have a look @mimre25 (but no pressure, I know you have probably tons of other things to do.)