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

Hubs/Scopes Merge 40 - Scopes.isEnabled now checks getClient().isEnabled() #3385

Merged
merged 48 commits into from
May 2, 2024

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Apr 24, 2024

#skip-changelog

📜 Description

💡 Motivation and Context

Since Scopes are forked much more frequently than Hub was, we can no longer store isEnabled as a property on Scopes as it would only affect a very limited scope (:D). By asking client we should by default now have the same state globally unless a customer sets a different client.

💚 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
Copy link
Contributor

github-actions bot commented Apr 24, 2024

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

Generated by 🚫 dangerJS against 4a84978

Copy link
Contributor

github-actions bot commented Apr 24, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 408.63 ms 481.92 ms 73.29 ms
Size 1.70 MiB 2.28 MiB 595.70 KiB

Previous results on branch: feat/hsm-40-enabled-checks-client

Startup times

Revision Plain With Sentry Diff
c16d388 385.02 ms 475.14 ms 90.12 ms

App size

Revision Plain With Sentry Diff
c16d388 1.70 MiB 2.28 MiB 595.70 KiB

val globalScope = Scope(options)
val scopes = Scopes(mock<IScope>(), mock<IScope>(), globalScope, "test")
// verify(integrationMock).register(expected, options)
val scopes = createTestScopes(options)
Copy link
Member Author

Choose a reason for hiding this comment

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

Extracted this into test-support so we can reuse it and not have to set up mocks every time.

@@ -82,17 +89,25 @@ class SentryAppenderTest {

@Test
fun `does not initialize Sentry if Sentry is already enabled`() {
Copy link
Member Author

Choose a reason for hiding this comment

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

afaict this test didn't actually test what it says it does. It used to just initialize Sentry via the log appender then reinitialize using Sentry.init and it asserted that the env from re-init was set.

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.

Left a naming suggestion, otherwise, LGTM 👍

@@ -10,14 +11,14 @@ public final class EventProcessorUtils {

public static List<EventProcessor> unwrap(
final @Nullable List<EventProcessorAndOrder> orderedEventProcessor) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename to eventProcessorsWithOrder, same as in Scope.java to make it clear that these are not ordered, but come with an order.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do in a follow up PR

@@ -2166,6 +2175,24 @@ class ScopesTest {
assertEquals(span.spanContext.parentSpanId, txn.spanContext.spanId)
}

@Test
fun `is considered enabled if client is enabled()`() {
val scopes = generateScopes() as Scopes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cast to Scopes is not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Will change in a follow up PR

}

@Test
fun `is considered disabled if client is disabled()`() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cast to Scopes is not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Will change in a follow up PR

Base automatically changed from feat/hsm-39-review-changes to 8.x.x May 2, 2024 12:32
@adinauer adinauer merged commit aa3cd3e into 8.x.x May 2, 2024
10 of 19 checks passed
@adinauer adinauer deleted the feat/hsm-40-enabled-checks-client branch May 2, 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

3 participants