Skip to content

POTEL 68 - Add SentryOpenTelemetryMode.OFF #3995

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

Merged
merged 19 commits into from
Dec 20, 2024
Merged

POTEL 68 - Add SentryOpenTelemetryMode.OFF #3995

merged 19 commits into from
Dec 20, 2024

Conversation

adinauer
Copy link
Member

📜 Description

Add SentryOpenTelemetryMode.OFF

💡 Motivation and Context

Allows customers to completely disable usage of OpenTelemetry by Sentry, even if it is present.

💚 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

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- POTEL 68 - Add `SentryOpenTelemetryMode.OFF` ([#3995](https://github.com/getsentry/sentry-java/pull/3995))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against bca42bf

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 400.73 ms 410.76 ms 10.03 ms
Size 1.65 MiB 2.31 MiB 677.12 KiB

Previous results on branch: feat/otel-mode-off

Startup times

Revision Plain With Sentry Diff
20d57f2 437.12 ms 511.13 ms 74.00 ms
00de25b 401.31 ms 417.12 ms 15.81 ms
b3cddf5 415.88 ms 477.86 ms 61.99 ms
b4a5c82 435.04 ms 490.67 ms 55.63 ms
de275f3 393.22 ms 453.75 ms 60.53 ms

App size

Revision Plain With Sentry Diff
20d57f2 1.65 MiB 2.31 MiB 677.05 KiB
00de25b 1.65 MiB 2.31 MiB 677.07 KiB
b3cddf5 1.65 MiB 2.31 MiB 677.05 KiB
b4a5c82 1.65 MiB 2.31 MiB 677.05 KiB
de275f3 1.65 MiB 2.31 MiB 677.05 KiB

if (SentryOpenTelemetryMode.OFF == options.getOpenTelemetryMode()) {
options.setSpanFactory(new DefaultSpanFactory());
// } else {
// enabling this causes issues with agentless where OTel spans seem to be randomly ended
Copy link
Member Author

Choose a reason for hiding this comment

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

We have to keep using SpanFactoryFactory in the SentryOptions ctor for now as setting the OtelSpanFactory here causes OpenTelemetry spans to be ended in the agentless sample.

I haven't investigated yet why that's happening.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, let's keep this for now and maybe create a separate issue to investigate

Copy link
Member Author

Choose a reason for hiding this comment

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

Created #4005 to track

if (SentryOpenTelemetryMode.OFF == options.getOpenTelemetryMode()) {
options.setSpanFactory(new DefaultSpanFactory());
// } else {
// enabling this causes issues with agentless where OTel spans seem to be randomly ended
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, let's keep this for now and maybe create a separate issue to investigate

OpenTelemetryUtil.applyIgnoredSpanOrigins(options, new LoadClass());
}

@SuppressWarnings("UnusedMethod")
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
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 👍

Base automatically changed from feat/add-opentelemetry-mode-option to 8.x.x December 20, 2024 10:44
@adinauer adinauer merged commit 5a15f74 into 8.x.x Dec 20, 2024
27 of 28 checks passed
@adinauer adinauer deleted the feat/otel-mode-off branch December 20, 2024 10:47
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.

3 participants