POTEL 25 - Workaround for sentry-opentelemetry-agent with SENTRY_AUTO_INIT=false
#3516
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.
#skip-changelog
📜 Description
Using
SentrySpanFactoryHolderwhich is loaded into the bootstrap classloader and is used by the agent to assign aOtelSpanFactoryinstance created in the agent class loader which referencesSentryWeakSpanStoragealso from the agent classloader. Without this workaround the application would be referring toSentryWeakSpanStorage(viaOtelSpanFactory) in the bootstrap classloader which has no data in it (since the span processor writes to the one in the agent class loader).💡 Motivation and Context
Due to a bug around using the wrong classloader for
sentry-opentelemetry-bootstrap(currently loaded via agent classloader; should be bootstrap classloader), we need a workaround when the agent is used without auto init (SENTRY_AUTO_INIT=false).💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps