Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Use OTel for performance instrumentation (PoC) #2272
Use OTel for performance instrumentation (PoC) #2272
Changes from 23 commits
e7452f1
c6585a7
b8a0339
f044604
9ca2add
628af21
fcd44cf
ee4d016
7609159
c402deb
1d5b6ad
4c6e310
dc01799
1629463
8eabfff
91b65c8
b748978
2acbef6
d22bb6a
f71d43e
cd68f99
686d9ef
a6ac7f9
ce097af
6333c89
30446eb
2faa56f
a3659bd
5f88fc8
6341ae7
8ee0f5f
c1514bb
69dc6b7
b991755
3192771
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the outermost loop here, why do we need to go through
sys.modules
and thenoriginal_classes
in each of them? Can you explain with a simple flask example?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So imagine a user has something like this:
The OTel autoinstrumentation runs during
sentry_sdk.init()
, patching theFlask
class with its own_InstrumentedFlask
, but since the user importedFlask
before, inapp.py
it is still the old unpatchedFlask
, and so isapp
.The loop goes through all modules loaded so far via
sys.modules
and does the following for each of the original classes:vars
of eachsys.module
and checks whether the original type is in scope, and if so, replaces it with the patched type.So in the above example, it would find the
app.py
module insys.modules
, it would check it for occurrences of the originalFlask
type, and replace them with_InstrumentedFlask
.