Skip to content

Conversation

@buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Jun 25, 2025

📜 Description

Now that we have sdk lifecycle hooks we can re-factor the beforeSendEvent observer that we added to implement web sessions

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 521.28 ms 563.61 ms 42.33 ms
Size 6.54 MiB 7.70 MiB 1.16 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
79f6b41 469.66 ms 525.90 ms 56.24 ms
2d34233 470.54 ms 558.90 ms 88.36 ms
6f47800 451.04 ms 509.64 ms 58.60 ms
dbd526b 504.88 ms 569.02 ms 64.15 ms
4481076 484.08 ms 505.70 ms 21.61 ms
73a3c38 478.18 ms 526.62 ms 48.44 ms
6ba4675 499.80 ms 632.43 ms 132.63 ms
aeb02f2 373.84 ms 437.00 ms 63.16 ms
73dca78 476.53 ms 522.21 ms 45.68 ms
640ad0c 466.00 ms 552.67 ms 86.67 ms

App size

Revision Plain With Sentry Diff
79f6b41 6.54 MiB 7.69 MiB 1.15 MiB
2d34233 6.54 MiB 7.55 MiB 1.01 MiB
6f47800 6.54 MiB 7.69 MiB 1.15 MiB
dbd526b 6.54 MiB 7.69 MiB 1.15 MiB
4481076 6.54 MiB 7.69 MiB 1.15 MiB
73a3c38 6.54 MiB 7.69 MiB 1.15 MiB
6ba4675 6.54 MiB 7.53 MiB 1015.26 KiB
aeb02f2 6.54 MiB 7.69 MiB 1.15 MiB
73dca78 6.54 MiB 7.69 MiB 1.15 MiB
640ad0c 6.54 MiB 7.69 MiB 1.15 MiB

Previous results on branch: enhancements/use-lifecycle-hook-before-send-event

Startup times

Revision Plain With Sentry Diff
6eda8bd 487.57 ms 567.46 ms 79.89 ms
9d51684 517.34 ms 569.74 ms 52.40 ms
9e774c1 458.33 ms 486.46 ms 28.12 ms
2a3c35f 455.96 ms 541.18 ms 85.22 ms
6650ed5 441.54 ms 516.91 ms 75.37 ms
4e720b9 469.48 ms 517.15 ms 47.67 ms
e052838 457.27 ms 485.24 ms 27.97 ms

App size

Revision Plain With Sentry Diff
6eda8bd 6.54 MiB 7.69 MiB 1.15 MiB
9d51684 6.54 MiB 7.53 MiB 1017.60 KiB
9e774c1 6.54 MiB 7.69 MiB 1.15 MiB
2a3c35f 6.54 MiB 7.70 MiB 1.16 MiB
6650ed5 6.54 MiB 7.70 MiB 1.16 MiB
4e720b9 6.54 MiB 7.53 MiB 1017.60 KiB
e052838 6.54 MiB 7.53 MiB 1017.60 KiB

@buenaflor
Copy link
Contributor Author

@denrase can you have a early look pls

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Approach looking good to me. 👍

  • Missing hint
  • Not sure if we should remove the methods from the options or just deprecate them.
  • CI complains about missing test coverage

@buenaflor
Copy link
Contributor Author

Not sure if we should remove the methods from the options or just deprecate them.

we can remove them, they were never meant to be public

@buenaflor buenaflor mentioned this pull request Jul 22, 2025
6 tasks
@buenaflor
Copy link
Contributor Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@buenaflor buenaflor marked this pull request as ready for review July 23, 2025 10:33
@buenaflor buenaflor requested a review from stefanosiano as a code owner July 23, 2025 10:33
@buenaflor buenaflor requested a review from denrase July 23, 2025 10:33
cursor[bot]

This comment was marked as outdated.

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Nice that you extracted the dispatch functionality out of the client. Just one question regarding missing tests for dispatching log/event, we should add those back if they were removed.

});
});

group('beforeSendEvent observer', () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we not testing if the client dispatches before log/event?

Copy link
Contributor Author

@buenaflor buenaflor Jul 24, 2025

Choose a reason for hiding this comment

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

I updated the tests and moved sdk lifecycle calls to a different test file sentry_client_sdk_lifecycle_test.dart

we should generally consider moving new tests out, the sentry_client test file is already ~2.8k loc

@buenaflor buenaflor merged commit 0a7552c into main Jul 24, 2025
162 checks passed
@buenaflor buenaflor deleted the enhancements/use-lifecycle-hook-before-send-event branch July 24, 2025 11:27
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