getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.92k stars 507 forks source link

FastAPI Performance Improvements #2173

Closed antonpirker closed 1 year ago

antonpirker commented 1 year ago

https://www.notion.so/sentry/Performance-Issues-Span-Detectors-and-SDK-Audit-44c8d61f3b7d4c0e8421b89912887485?pvs=4#a45e0f37bada4cc1bfdc859b94750583

antonpirker commented 1 year ago

According to the Notion Doc:

FastAPI: 13% no db.* OR http.* spans

db spans:

Relational databases:

We cover the two big ORMs in Python land DjangoORM and SQLAlchemy. Devs use those to connect to Postgresql, MySQL, SQLite, Oracle, Microsoft SQL Server)

In SQLAlchemy there was a new major release (2.0) we do not support yet, we should!

There are other ORMs like Peewee, Tortoise ORM, Pony ORM we do not support. See: https://www.libhunt.com/l/python/topic/orm

We should probably support Peewee at some point.

Document based databases:

We support MongoDB There is an ORM for MongoDB called MongoEngine. We do not support this. We do not support ElasticSearch

What should be done:

http spans:

In the Python world we automatically patch those http libs: Requests, AIOHTTP, HTTPX and the low level http.client and its predecessor httplib (on python 2.7). With these libaries we cover the vast amount of the Python world. (There are other libs like grequests, uplink, httplib2, treq out there but they are either in a tiny nieche, very know, or never "made it" and stayed in the shadows) We cover (guesstimate) well over 90% of all HTTP code out there.

All libs except HTTPX are auto-enabled. HTTPX (according to github is used by 91k people) We should make HTTPX auto-enabled

What should be done:

HazAT commented 1 year ago

I think we should support SQLAlchemy and auto-enable HTTPX for now. Shouldn't be a lot of work ™️

smeubank commented 1 year ago

Of the others mentioned I think it would be worth creating discussions or issues to see if people are interested. ElasticSearch and MongoEngine are both very popular, Peewee then the most at least of the initial 3 mentioned

antonpirker commented 1 year ago

We updated the SQLAlchemy integration to work with 2.0 and also auto enable HTTPX integrations. So this issue can be closed.