-
Notifications
You must be signed in to change notification settings - Fork 167
⚗ [RUM-11393] Add Start/StopAction API #4038
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
⚗ [RUM-11393] Add Start/StopAction API #4038
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 27d07cf | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
|
Thanks for the ping—current CI is all green and bundle size deltas are small (≈+0.8% on Rum/Rum Slim, others unchanged). Patch coverage on the new lines is ~85% with overall coverage unchanged aside from reported delta. Let me know if you want me to tackle any follow-ups. |
|
@codex pls review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review pls |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review pls |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8725bad56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| configuration: RumConfiguration | ||
| ) { | ||
| const customActionHistory = createValueHistory<string>({ expireDelay: ACTION_CONTEXT_TIME_OUT_DELAY }) | ||
| const activeCustomActions = new Map<string, ActiveCustomAction>() |
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.
I wonder if this should be a weakMap like in VitalCollection so it gets garbage collected
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.
You can't have a weakmap with primitive types like string as key. So no, that won't be an option. This is why FeatureOperation uses an object as "key" instead of a string.
|
@codex review pls |
| trackedAction: TrackedAction | ||
| } | ||
|
|
||
| export function trackCustomActions( |
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 we used to call a custom action had the custom type, but in this module it can be any action type. We could rename it to trackManualActions to separate it from automatic click tracking.
- It would also help to collocate the addAction API in this module.
- FMU, we don’t handle frustration signals yet. I’m thinking in particular about error actions mentioned in the RFC.
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.
FMU, we don’t handle frustration signals yet. I’m thinking in particular about error actions mentioned in the RFC.
Yeah, what do you think about leaving it for a next PR?
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.
Yeah, but it might require changing your current approach. It would be good to anticipate, at least a bit, how you’d handle it.
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.
Adding ERROR_CLICK would not be a challenge and I could add it now. But the others could wait as they are much harder and mobile does not send them. 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.
I was only thinking of covering ERROR_CLICK. So nice ;)
| }, | ||
|
|
||
| startAction: monitor((name, options) => { | ||
| // Check feature flag only after init; pre-init calls should be buffered |
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.
Important for the e2e test
| stop: () => void | ||
| } | ||
|
|
||
| export function startActionTracker(lifeCycle: LifeCycle): ActionTracker { |
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: With this implementation, custom actions can have a duration and be linked to other events. I think it’s a good direction, but we should check with Product to get their view. We should also align with Frontend to make sure they can handle these new action types coming from the browser.
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in Use ⏳ Processing |
Motivation
Discussed in this RFC
Tldr:
addEventdoes not cover all the cases needed for complete action collection in frameworks like Flutter.This PR adds Start and Stop action.
Changes
New Experimental Feature
START_STOP_ACTIONfeature flagNew Public APIs
startAction(name, options?)andstopAction(name, options?)to RumPublicApiExpanded ActionType
TAP,SCROLL,SWIPE,APPLICATION_START,BACKArchitecture Refactoring
ActionTracker(trackAction.ts), shared infrastructure for tracking actionstrackCustomActions.ts, manages start/stop custom action lifecycletrackClickActions.tsto use the sharedActionTrackerTest instructions
I used this HTML file to test locally.
Should be able to start an action, generate events and stop the action. When in RUM explorer Attributes for each Event should have the Action.ID.
Example action with error, long_task and resource.
Example in Flutter web.
Checklist