Skip to content

Conversation

@adinauer
Copy link
Member

📜 Description

UseSentryOptions from rootScopes for SentryClient constructor in Sentry.init.

💡 Motivation and Context

If replaceOptions noops, the new SentryOptions aren't actually used which means SentryClient and the rest of the SDK have different SentryOptions in use.

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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

adinauer and others added 30 commits March 27, 2024 16:30
@github-actions
Copy link
Contributor

github-actions bot commented Jun 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 18 - Use correct `SentryOptions` for `SentryClient` constructor ([#3490](https://github.com/getsentry/sentry-java/pull/3490))

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 c509fdb

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 386.23 ms 450.61 ms 64.38 ms
Size 1.70 MiB 2.28 MiB 596.88 KiB

Baseline results on branch: feat/potel-17-noop-span-factory-by-default

Startup times

Revision Plain With Sentry Diff
570f679 392.87 ms 480.78 ms 87.91 ms

App size

Revision Plain With Sentry Diff
570f679 1.70 MiB 2.28 MiB 596.86 KiB

Base automatically changed from feat/potel-17-noop-span-factory-by-default to 8.x.x June 24, 2024 05:21
final IScope rootIsolationScope = new Scope(options);

scopes.close(true);
globalScope.replaceOptions(options);
Copy link
Member Author

@adinauer adinauer Jun 24, 2024

Choose a reason for hiding this comment

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

This diff looks like there was an auto-merge fail on a previous merge. It's just the options that are used for the SentryClient ctor that should be different.

}

@Test
fun `current scope returns obj when scopes is active`() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these tests now testing something different? Should they be additions instead of replacements?

Copy link
Member Author

Choose a reason for hiding this comment

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

With Sentry.close() in test setup, InternalSentrySdk.getCurrentScope() doesn't work correctly afair, so I used the actual setup code. Tests should still test the same thing now.

I just retested with the old code and it seems to work so maybe this was just an interim thing. I do however think the new code should be closer to real world usage, so I'd keep it this way.

wdyt?

@adinauer adinauer merged commit 738c5fa into 8.x.x Jun 24, 2024
@adinauer adinauer deleted the feat/potel-18-use-correct-options-for-client-ctor branch June 24, 2024 12:11
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