POTEL 29 - Partially fix bootstrap class loading #3543
Merged
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.
📜 Description
Partially fix bootstrap class loading by actually loading
sentry-opentelemetry-bootstrapinto the bootstrap classloader which wasn't the case before as it was loaded into the agent class loader by accident (implementationdependency insentry-opentelemetry-agentcustomizationwhich was supposed to becompileOnly).We now added a
sentry-opentelemetry-extramodule which should ideally be loaded into bootstrap classloader but isn't for now since loading the classes into bootstrap classloader would causeClassNotFoundExceptionfor OpenTelemetry classes likeReadWriteSpanwhich aren't available in bootstrap classloader.Since we haven't found a way to fix the
ClassNotFoundExceptionso far, we're continuing to load theextraclasses into the agent classloader.💡 Motivation and Context
Without this
Contextmanipulation is incorrect as there are multiple SentryScopesentries due to the key being loaded into separate class loaders andContextending up with one entry per classloader used.This also means access to
Contextreturns a different scope depending on what classloader is used when retrieving via key.💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps