sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

[SR] Add session replay envelope and events

Open romtsn opened this issue 1 year ago • 1 comments

#skip-changelog

:scroll: Description

You can read up more about the new envelope spec here https://github.com/getsentry/rfcs/pull/129

It has a good chunk of work that you've done during the hackweek, but with several enhancements:

  • RRWeb events are now typed
  • Properly capture replay events with recordings in SentryClient and record client reports if e.g. an event is dropped by an event processor
  • Also have a separate method for applying scope as replay events don't have everything as regular events (e.g. no breadcrumbs)
  • I had to introduce a new MapObjectReader and extract an ObjectReader interface from JsonObjectReader but I made a separate PR for this (this one will be failing until the other one is merged)

:bulb: Motivation and Context

Closes #3213

:green_heart: How did you test it?

With tests

:pencil: Checklist

  • [x] I reviewed the submitted code.
  • [x] I added tests to verify the changes.
  • [x] 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.

:crystal_ball: Next steps

Glue recording and envelopes together

romtsn avatar Feb 20 '24 23:02 romtsn

@markushi @stefanosiano I'll wait with merging #3215 otherwise it'll be hell to review this

romtsn avatar Feb 22 '24 10:02 romtsn

and stopped at some point adding final and @NotNull annotations

thank you! I will revise that myself and add where necessary

romtsn avatar Feb 27 '24 13:02 romtsn

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 374.76 ms 457.26 ms 82.50 ms
Size 1.70 MiB 2.28 MiB 591.02 KiB

Previous results on branch: rz/feat/session-replay-envelopes

Startup times

Revision Plain With Sentry Diff
6650dc9e0272a03257501a087b6fe208beb3a97f 424.67 ms 506.40 ms 81.73 ms
8aeeb6b123478f27a25c877b034922901cfc8c53 364.00 ms 434.31 ms 70.31 ms

App size

Revision Plain With Sentry Diff
6650dc9e0272a03257501a087b6fe208beb3a97f 1.70 MiB 2.28 MiB 591.02 KiB
8aeeb6b123478f27a25c877b034922901cfc8c53 1.70 MiB 2.28 MiB 591.02 KiB

github-actions[bot] avatar Feb 28 '24 11:02 github-actions[bot]