Skip to content

Conversation

@BeltranBulbarellaDD
Copy link
Contributor

@BeltranBulbarellaDD BeltranBulbarellaDD commented Dec 17, 2025

Motivation

Discussed in this RFC

Tldr: addEvent does 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

  • Added START_STOP_ACTION feature flag

New Public APIs

  • Added startAction(name, options?) and stopAction(name, options?) to RumPublicApi

Expanded ActionType

  • Added new action types: TAP, SCROLL, SWIPE, APPLICATION_START, BACK

Architecture Refactoring

  • Extracted ActionTracker (trackAction.ts), shared infrastructure for tracking actions
  • Extracted trackCustomActions.ts, manages start/stop custom action lifecycle
  • Refactored trackClickActions.ts to use the shared ActionTracker
  • Both click actions and custom actions now share the same action context, enabling proper child event attribution

Test 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

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Dec 17, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 165.78 KiB 167.75 KiB +1.97 KiB +1.19%
Rum Profiler 4.33 KiB 4.33 KiB 0 B 0.00%
Rum Recorder 24.48 KiB 24.48 KiB 0 B 0.00%
Logs 56.21 KiB 56.25 KiB +40 B +0.07%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 123.05 KiB 124.85 KiB +1.80 KiB +1.46%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
addglobalcontext N/A 0.0052 N/A
addaction N/A 0.0173 N/A
adderror N/A 0.0177 N/A
addtiming N/A 0.0038 N/A
startview N/A 0.0037 N/A
startstopsessionreplayrecording N/A 0.0009 N/A
logmessage N/A 0.0234 N/A
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
addglobalcontext N/A 29.71 KiB N/A
addaction N/A 106.49 KiB N/A
addtiming N/A 28.34 KiB N/A
adderror N/A 106.54 KiB N/A
startstopsessionreplayrecording N/A 27.36 KiB N/A
startview N/A 438.66 KiB N/A
logmessage N/A 48.78 KiB N/A

🔗 RealWorld

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 17, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 89.41%
Overall Coverage: 77.33% (+0.08%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 27d07cf | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex

@chatgpt-codex-connector
Copy link

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.

View task →

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex pls review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex review pls

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex review pls

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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>()
Copy link
Contributor Author

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

Copy link
Member

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.

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex review pls

@BeltranBulbarellaDD BeltranBulbarellaDD changed the title add s/s action ✨ Add Start/StopAction API Jan 15, 2026
@BeltranBulbarellaDD BeltranBulbarellaDD changed the title ✨ Add Start/StopAction API ⚗ Add Start/StopAction API Jan 15, 2026
@BeltranBulbarellaDD BeltranBulbarellaDD changed the title ⚗ Add Start/StopAction API ⚗ [RUM-11393] Add Start/StopAction API Jan 15, 2026
trackedAction: TrackedAction
}

export function trackCustomActions(
Copy link
Collaborator

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.

Copy link
Contributor Author

@BeltranBulbarellaDD BeltranBulbarellaDD Jan 20, 2026

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

@BeltranBulbarellaDD BeltranBulbarellaDD Jan 21, 2026

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?

Copy link
Collaborator

@amortemousque amortemousque Jan 21, 2026

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
Copy link
Contributor Author

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 {
Copy link
Collaborator

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.

@BeltranBulbarellaDD
Copy link
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Jan 21, 2026

View all feedbacks in Devflow UI.

2026-01-21 15:19:17 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-01-21 15:19:52 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 0s (p90).

Use /merge -c to cancel this operation!


⏳ Processing

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit dce5217 into main Jan 21, 2026
22 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the beltran.bulbarella/start-stopAction branch January 21, 2026 15:45
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants