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

Added telemetry event type to test locally (For CI to pass, need to add in RumEventsFormat PR)

Added FF: START_STOP_ACTION

Expanded ActionType

Created expanded startActionCollection, created startCustomActionInternal and stopCustomActionInternal

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 164.35 KiB 166.38 KiB +2.04 KiB +1.24%
Rum Profiler 4.33 KiB 4.33 KiB 0 B 0.00%
Rum Recorder 20.04 KiB 20.04 KiB 0 B 0.00%
Logs 56.14 KiB 56.18 KiB +40 B +0.07%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 121.57 KiB 123.43 KiB +1.86 KiB +1.53%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.0048 0.0045 -6.25%
RUM - add action 0.0146 0.0124 -15.07%
RUM - add error 0.0134 0.0125 -6.72%
RUM - add timing 0.0031 0.0028 -9.68%
RUM - start view 0.0036 0.0034 -5.56%
RUM - start/stop session replay recording 0.0008 0.0007 -12.50%
Logs - log message 0.0151 0.0135 -10.60%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 26.64 KiB 26.48 KiB -160 B
RUM - add action 50.13 KiB 49.52 KiB -624 B
RUM - add timing 26.76 KiB 26.69 KiB -66 B
RUM - add error 56.21 KiB 54.87 KiB -1.34 KiB
RUM - start/stop session replay recording 25.57 KiB 25.49 KiB -84 B
RUM - start view 424.67 KiB 425.59 KiB +946 B
Logs - log message 47.45 KiB 45.89 KiB -1.56 KiB

🔗 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.87%
Overall Coverage: 77.36% (+0.07%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 66ce586 | 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 marked this pull request as ready for review January 12, 2026 14:33
@BeltranBulbarellaDD BeltranBulbarellaDD requested a review from a team as a code owner January 12, 2026 14:33
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: 80850cfddb

ℹ️ 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 BeltranBulbarellaDD force-pushed the beltran.bulbarella/start-stopAction branch 2 times, most recently from 0cdbbeb to ee43b93 Compare January 13, 2026 09:14
@BeltranBulbarellaDD
Copy link
Contributor Author

@codex pls review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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 BeltranBulbarellaDD marked this pull request as draft January 13, 2026 13:20
@BeltranBulbarellaDD BeltranBulbarellaDD marked this pull request as ready for review January 13, 2026 14:05
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: 1b690e5e49

ℹ️ 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".

Comment on lines 304 to 305
function getActionLookupKey(name: string, actionKey?: string): string {
return JSON.stringify({ name, actionKey })
Copy link
Member

Choose a reason for hiding this comment

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

thought: I'm not sure we need to care if the same action key is used with different name... do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, I added it just to be safe. But agreed to remove it.

return duration
},
get counts() {
const { errorCount, longTaskCount, resourceCount } = eventCountsSubscription.eventCounts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to ask an agent how to try to reduce bundle size. For example here.

@BeltranBulbarellaDD
Copy link
Contributor Author

@codex can you give a review and suggest where we could save on bundle size? Is there room for improvement?

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: 20019e376c

ℹ️ 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".

HookNames.AssembleTelemetry,
({ startTime }): DefaultTelemetryEventAttributes => ({
action: { id: actionContexts.findActionId(startTime) as string },
})

Choose a reason for hiding this comment

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

P2 Badge Avoid array action.id in telemetry events

With start/stop actions, multiple concurrent custom actions are supported (via actionKey), so actionContexts.findActionId() can return a string[]. In AssembleTelemetry this value is written directly to action.id, but telemetry schemas define action.id as a single string (see packages/core/src/domain/telemetry/telemetryEvent.types.ts). During overlapping actions, any telemetry event emitted in that window will carry an array and can be rejected or dropped by downstream validation. Consider selecting one id (e.g., most recent) or omitting the action context when multiple ids are active.

Useful? React with 👍 / 👎.

Comment on lines 61 to 63
const customActions = trackCustomActions(lifeCycle, actionTracker, (action) => {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action))
})

Choose a reason for hiding this comment

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

P3 Badge Gate custom action tracking to avoid bundle/runtime overhead

Custom action tracking is instantiated unconditionally, even when START_STOP_ACTION is disabled or never used. This means the extra tracker code and lifecycle subscriptions are included and executed for all builds, increasing bundle size and baseline work. If this feature is meant to be experimental/opt‑in, consider lazily initializing trackCustomActions (and its shared tracker) behind the feature flag or on first startAction call to keep the default bundle smaller.

Useful? React with 👍 / 👎.

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.

3 participants