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
feat(tracing): Track PerformanceObserver interactions as spans #7331
Conversation
I know this is still in draft - but please make sure to add an integration test for this! You can model it after the existing interactions one: https://github.com/getsentry/sentry-javascript/tree/develop/packages/integration-tests/suites/tracing/browsertracing/interactions |
size-limit report 📦
|
@AbhiPrasad Would it be sufficient to modify that existing test so it also tests for the new interaction spans? It's already failing as is, so this will add coverage. I'm going to add a new test as well, but I'm unsure whether it would be necessary. |
That sounds reasonable to me! |
Hmmm I'm noticing the tests I added are flaky because sometimes the interaction spans are not getting created. This might be because of https://github.com/getsentry/sentry-javascript/pull/7331/files#diff-fa6ad17b9fe7cfcdf6f7ed76dd841d944709b7bc4abab6499db60a52d35b6681R92 I'm guessing that in these tests, the duration of these spans is sometimes below 10ms. Gonna look to see if I can get around this somehow |
Can we add an event listener on click that is purposefully slow? |
@AbhiPrasad That's worth a try, although I've tried setting |
Tests have been fixed, looks like the main issue was that the script for adding the click event listener was being loaded before the DOM lol 😅 Ready for review now! @AbhiPrasad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a screenshot of a transaction with these new spans attached to the PR description?
Feel free to merge after tests pass - we can cut a release with this tommorow so y'all can try it out.
Going to merge this in so we can cut a release! |
Hi @AbhiPrasad @0Calories, |
Hey @hckhanh, Yes, please be careful with this feature as it will count towards your transaction quota! I've responded to your PR with instructions on how you can take advantage of this feature while discarding transactions that you don't want to send. |
Summary
We hypothesize that there is a 1:1 mapping of
PerformanceObserver
Interactions -> Interaction Transactions. This PR will allow us to confirm whether this hypothesis is true, so we can decide our next steps for refining interaction transactions. To elaborate, we're unsure whether interaction transactions that have no child spans are worth keeping or not, and there are a lot of transactions like this in prod.Enhances the existing interaction transactions by adding the ability to track interaction events exposed by the
PerformanceObserver
API. Note that this is still hidden under an experimental flag along with interaction transactions.For now, we are only tracking
click
interactions, but we can expand this functionality later as needed.Example: