-
Notifications
You must be signed in to change notification settings - Fork 142
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-1209] introduce "dead" and "error" frustration types #1487
Conversation
49f663c
to
284ba68
Compare
It makes no sense anymore to split trackActions into two `describe`, since the `newAction` function does not exist anymore, and tests are mostly similar. Let's merge the two `describe` and reorder a few test.
This commit changes the design of `trackActions` to prepare for frustration detection. In particular, it re-introduce the concept of "potential action" that will be used when generating rage clicks. It also introduces a concept of `TrackActionState` to be able to split the implementation into multiple functions, as the `trackActions` implementation will grow a bit.
284ba68
to
176d6d3
Compare
Codecov Report
@@ Coverage Diff @@
## main #1487 +/- ##
==========================================
+ Coverage 89.91% 89.94% +0.03%
==========================================
Files 111 111
Lines 4322 4346 +24
Branches 961 968 +7
==========================================
+ Hits 3886 3909 +23
- Misses 436 437 +1
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
176d6d3
to
4ec2927
Compare
Like you said in the PR description, the design seems a bit convoluted for what it does currently. |
You can always have a look to the next PR: #1488 |
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.spec.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
// Else complete the action at the end of the page activity | ||
singleClickPotentialAction.complete(idleEvent.end) |
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.
💭 thought: not related to the PR, I find my self not really integrating the idle page
concept and like here, prefer to think of it as the page activity end
.
It could be interesting to rename "idle page" occurrences then, wdyt?
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.
Let's do it in a separate PR
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackActions.ts
Outdated
Show resolved
Hide resolved
historyEntry.close(getRelativeTime(endTime)) | ||
eventCountsSubscription.stop() | ||
if (eventCountsSubscription.eventCounts.errorCount > 0) { | ||
frustrations.add(FrustrationType.ERROR) |
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.
💬 suggestion: Here you flag with FrustrationType.ERROR inside PotentialAction while for FrustrationType.DEAD you do it outside. Could be nice to do it in a single place.
01b7c28
to
c50f02b
Compare
* Merge `notifyIfComplete` and `complete` into a new `validate` method * Remove unneeded `finalState` * Factorize cleanup code to a `stop` function * Remove unused `base` property * Implement a `addFrustration` method
c50f02b
to
4c59a4e
Compare
action -> click action potential action -> potential click action
packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts
Outdated
Show resolved
Hide resolved
validate: (endTime?: TimeStamp) => { | ||
if (isStopped) { | ||
return | ||
} | ||
stop(endTime) |
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.
💬 suggestion: What about moving the isStopped
check inside the stop
method?
it should allow us to:
- not perform this check for both
validate
anddiscard
- allow next PR to call
stop
beforevalidate
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.
Mmh if we move the isStopped
check inside the stop
function, how would we ensure that validate
code is not run twice?
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.
Anyway, isStopped
is replaced with a more advanced state in the next PR, because we need to store additional data, so I don't think it matters too much.
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.
how would we ensure that validate code is not run twice?
FMU, it was not checked before, can it happen?
packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.ts
Outdated
Show resolved
Hide resolved
We now use Set to track actions, and it appears in module type definitions (.d.ts). By default, TS does not include the type definition for Set, so we need to use the `ES2015` lib. This should not be a breaking change, since we already used Set in other places of the SDK.
Motivation
This is the first PR to implement
action.frustration_type
field. It has a bit of groundworks, so it might look weird or overkill at some places because subsequent PRs will iterate over this new design, but feel free to challenge the design and we'll talk.This PR will be followed by #1488
Changes
Groundwork on
trackActions
and implement "dead" and "error" frustration types.Testing
I have gone over the contributing documentation.