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

✨ [RUMF-940] implement the replay sample rate option and remove resource sample rate option #931

Merged
merged 12 commits into from
Jul 13, 2021

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Jul 9, 2021

Motivation

Let the customer chose which session plan to use.

Changes

We chose to use the same value as the deprecated "session without resource" to represent "sessions with lite plans" in session cookies. Because of this, replacing the deprecated resourceSampleRate option with the new replaySampleRate option in a single PR made more sense than doing it in separate PRs.

  • remove "session without resource" support
  • replace resourceSampleRate option with replaySampleRate
  • adjust namings
  • implement the "lite plan" restrictions: don't collect long tasks and don't allow recording

Testing

Unit, manual


I have gone over the contributing documentation.

As discussed, the "replaySampleRate" option will replace the
"resourceSampleRate" option since it will re-use the same value in the
session cookie.

As a first step to introduce the "replaySampleRate" option, let's remove
internal code related to resource sample rate.

This commit intentionally keeps the "resourceSampleRate" configuration
option. It will be replaced by the "replaySampleRate" in the next
commit.
This option simply replaces the previous "resourceSampleRate".
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/add-replay-sample-rate-option branch from b14f0bd to eb14cc9 Compare July 9, 2021 16:12
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2021

Codecov Report

Merging #931 (578ab7e) into prerelease-v3 (6875077) will increase coverage by 0.04%.
The diff coverage is 90.74%.

Impacted file tree graph

@@                Coverage Diff                @@
##           prerelease-v3     #931      +/-   ##
=================================================
+ Coverage          89.01%   89.05%   +0.04%     
=================================================
  Files                 82       83       +1     
  Lines               3860     3884      +24     
  Branches             863      865       +2     
=================================================
+ Hits                3436     3459      +23     
- Misses               424      425       +1     
Impacted Files Coverage Δ
packages/rum-core/src/boot/startRum.ts 37.03% <0.00%> (-1.43%) ⬇️
packages/rum-core/test/mockRumSession.ts 92.00% <92.00%> (ø)
packages/core/src/domain/configuration.ts 93.33% <100.00%> (ø)
packages/rum-core/src/boot/rumPublicApi.ts 94.84% <100.00%> (ø)
packages/rum-core/src/domain/assembly.ts 97.82% <100.00%> (ø)
...rumEventsCollection/resource/resourceCollection.ts 97.14% <100.00%> (-0.08%) ⬇️
packages/rum-core/src/domain/rumSession.ts 97.14% <100.00%> (+4.28%) ⬆️
...ages/rum-recorder/src/boot/rumRecorderPublicApi.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6875077...578ab7e. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review July 9, 2021 16:18
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner July 9, 2021 16:18
@BenoitZugmeyer BenoitZugmeyer changed the title ✨ [RUMF-940] implement the replay sample rate option ✨ [RUMF-940] implement the replay sample rate option and remove resource sample rate option Jul 12, 2021
Copy link
Contributor

@webNeat webNeat left a comment

Choose a reason for hiding this comment

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

Good job!

Comment on lines +19 to +23
// Note: the "tracking type" value (stored in the session cookie) does not match the "session
// plan" value (sent in RUM events). This is expected, and was done to keep retrocompatibility
// with active sessions when upgrading the SDK.
TRACKED_REPLAY = '1',
TRACKED_LITE = '2',
Copy link
Contributor

@bcaudan bcaudan Jul 13, 2021

Choose a reason for hiding this comment

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

As TRACKED_WITHOUT_RESOURCES is not strictly equivalent to TRACKED_LITE, we could also consider to perform a new draw or consider the active session as not tracked anymore.
It sounds fine to me but it worth mentioning this behavior to @hdelaby.

packages/rum-core/src/domain/rumSession.ts Outdated Show resolved Hide resolved
packages/rum-core/src/boot/startRum.ts Outdated Show resolved Hide resolved
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/add-replay-sample-rate-option branch from c6f71cf to 7267cf0 Compare July 13, 2021 15:13
packages/rum-core/src/boot/startRum.spec.ts Outdated Show resolved Hide resolved
@BenoitZugmeyer BenoitZugmeyer merged commit d55e9fd into prerelease-v3 Jul 13, 2021
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/add-replay-sample-rate-option branch July 13, 2021 17:19
amortemousque pushed a commit that referenced this pull request Jul 20, 2021
…rce sample rate option (#931)

* 🔥 [RUMF-940] remove session.isTrackedWithResource support

As discussed, the "replaySampleRate" option will replace the
"resourceSampleRate" option since it will re-use the same value in the
session cookie.

As a first step to introduce the "replaySampleRate" option, let's remove
internal code related to resource sample rate.

This commit intentionally keeps the "resourceSampleRate" configuration
option. It will be replaced by the "replaySampleRate" in the next
commit.

* 🚚 [RUMF-940] add the `replaySampleRate` option to the configuration

This option simply replaces the previous "resourceSampleRate".

* 🚚 [RUMF-940] adjust the "Tracking Type" namings to match the "Session Plan"

* ✨ [RUMF-940] collect long tasks only with replay plans

* ♻️ [RUMF-940] use SetupBuilder in rumRecorderPublicApi

* ✨ [RUMF-940] don't start session replay recording for non-replay plans

* remove unneeded TODO comment

* 👌📝 add a bit of documentation on RecorderStatus

* ✅ add mocking utility for Rum sessions

* 👌 replace getPlan with hasReplayPlan/hasLitePlan

* remove double slash in module path

Co-authored-by: Bastien Caudan <[email protected]>

Co-authored-by: Bastien Caudan <[email protected]>
amortemousque pushed a commit that referenced this pull request Jul 21, 2021
…rce sample rate option (#931)

* 🔥 [RUMF-940] remove session.isTrackedWithResource support

As discussed, the "replaySampleRate" option will replace the
"resourceSampleRate" option since it will re-use the same value in the
session cookie.

As a first step to introduce the "replaySampleRate" option, let's remove
internal code related to resource sample rate.

This commit intentionally keeps the "resourceSampleRate" configuration
option. It will be replaced by the "replaySampleRate" in the next
commit.

* 🚚 [RUMF-940] add the `replaySampleRate` option to the configuration

This option simply replaces the previous "resourceSampleRate".

* 🚚 [RUMF-940] adjust the "Tracking Type" namings to match the "Session Plan"

* ✨ [RUMF-940] collect long tasks only with replay plans

* ♻️ [RUMF-940] use SetupBuilder in rumRecorderPublicApi

* ✨ [RUMF-940] don't start session replay recording for non-replay plans

* remove unneeded TODO comment

* 👌📝 add a bit of documentation on RecorderStatus

* ✅ add mocking utility for Rum sessions

* 👌 replace getPlan with hasReplayPlan/hasLitePlan

* remove double slash in module path

Co-authored-by: Bastien Caudan <[email protected]>

Co-authored-by: Bastien Caudan <[email protected]>
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.

5 participants