Skip to content
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

POTEL 60 - Replace OTel ContextStorage wrapper with ContextStorageProvider #3938

Merged
merged 8 commits into from
Nov 29, 2024

Conversation

adinauer
Copy link
Member

📜 Description

Replace OTel ContextStorage wrapper with ContextStorageProvider by using SPI.

💡 Motivation and Context

Bumping OTel instrumentation to 2.10.0 causes issues with our "no agent" use case where a logging appender causes early access to Context and thus prevents us from registering the ContextStorage wrapper (since we try it too late and storage has already been marked as initialized). This gets rid of the ordering requirement and removes this brittleness from the SDK. It also allows us to upgrade OTel.

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Sorry, something went wrong.

Copy link
Contributor

github-actions bot commented Nov 29, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against c7271bb

Copy link
Contributor

github-actions bot commented Nov 29, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 429.54 ms 445.38 ms 15.84 ms
Size 1.65 MiB 2.31 MiB 676.03 KiB

Previous results on branch: feat/otel-storage-provider

Startup times

Revision Plain With Sentry Diff
e408b0f 404.26 ms 412.82 ms 8.56 ms

App size

Revision Plain With Sentry Diff
e408b0f 1.65 MiB 2.31 MiB 676.03 KiB

@lbloder lbloder mentioned this pull request Nov 29, 2024
7 tasks
Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

public final class SentryContextStorageProvider implements ContextStorageProvider {
@Override
public ContextStorage get() {
System.out.println("hello from SentryContextStorageProvider");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

Comment on lines 26 to +30
* should try to use OTels StorageProvider mechanism instead.
*/
// ContextStorage.addWrapper((storage) -> new SentryContextStorage(storage));
ContextStorage.addWrapper(
(storage) -> new SentryContextStorage(new SentryOtelThreadLocalStorage()));
// ContextStorage.addWrapper(
// (storage) -> new SentryContextStorage(new SentryOtelThreadLocalStorage()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the code in place just in case we need to restore. We can release this way for rc.1 and remove it before GA.

Base automatically changed from feat/bump-otel-2-10-0 to 8.x.x November 29, 2024 12:10
An error occurred while trying to automatically change base from feat/bump-otel-2-10-0 to 8.x.x November 29, 2024 12:10
@adinauer adinauer merged commit 8a31bb4 into 8.x.x Nov 29, 2024
35 checks passed
@adinauer adinauer deleted the feat/otel-storage-provider branch November 29, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants