Repository navigation
[Hackweek] Add explain plan to db spans. - #2315
Conversation
There was a problem hiding this comment.
One nit: if we add the new experiment to
sentry-python/sentry_sdk/consts.py
Lines 35 to 49 in 692c0e9
And one thing regarding the cache. If I read it right, once a key is in the cache, it'll never get deleted if it's never accessed again. Is this what we want? Let's say my app does 50 one-time SELECTs at startup which I'm not that interested in, but they'll then occupy the cache, so this will always apply for any future SELECTS
if len(EXPLAIN_CACHE.keys()) >= explain_cache_size:
return Falseand we won't run any additional explains.
|
You are right about the cache! Good catch. (how did I pass our coding interviews? ;-) ) |
sentrivana
left a comment
There was a problem hiding this comment.
LGTM, left a couple of comments.
Co-authored-by: Ivana Kellyerova <[email protected]>
Co-authored-by: Ivana Kellyerova <[email protected]>
This is a proof of concept of adding the explain plan to db spans. The explain plan will be added to the span in the
db.explain_plandata item.There is a cache to make sure that the explain plan for each db query is only executed ever X seconds and there is also a max number of elements that are cached. To make sure we do not put to much strain on CPU or memory.
Usage:
If you then look at the
dbspan in Sentry.io it looks like this: