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-bootstrap
into the bootstrap classloader which wasn't the case before as it was loaded into the agent class loader by accident (implementation
dependency insentry-opentelemetry-agentcustomization
which was supposed to becompileOnly
).We now added a
sentry-opentelemetry-extra
module which should ideally be loaded into bootstrap classloader but isn't for now since loading the classes into bootstrap classloader would causeClassNotFoundException
for OpenTelemetry classes likeReadWriteSpan
which aren't available in bootstrap classloader.Since we haven't found a way to fix the
ClassNotFoundException
so far, we're continuing to load theextra
classes into the agent classloader.💡 Motivation and Context
Without this
Context
manipulation is incorrect as there are multiple SentryScopes
entries due to the key being loaded into separate class loaders andContext
ending up with one entry per classloader used.This also means access to
Context
returns a different scope depending on what classloader is used when retrieving via key.💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps