Skip to content

♻️ Replace longTaskRegistry by longTaskContexts#4013

Merged
amortemousque merged 7 commits intomainfrom
aymeric/profiler-use-history
Dec 15, 2025
Merged

♻️ Replace longTaskRegistry by longTaskContexts#4013
amortemousque merged 7 commits intomainfrom
aymeric/profiler-use-history

Conversation

@amortemousque
Copy link
Collaborator

@amortemousque amortemousque commented Dec 9, 2025

Motivation

Remove longTaskRegistry and use a new longTaskContext exposed by longTaskCollection. This keeps the codebase consistent and preserves the bundle size.

Changes

  • Move longAnimationFrameCollection into longTaskCollection, since long tasks act as the fallback for LOAF.
  • Expose longTaskContexts from longTaskCollection.
  • Replace longTaskRegistry with longTaskContexts in profiling.
  • Delete longTaskRegistry and profilingCorrelation modules.

Checklist

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

@amortemousque amortemousque requested a review from a team as a code owner December 9, 2025 10:21
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".

@datadog-datadog-prod-us1
Copy link

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

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 92.68% (+0.05%)

View detailed report

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

@amortemousque amortemousque force-pushed the aymeric/profiler-use-history branch from aef5b24 to 55c710a Compare December 10, 2025 09:01
@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Dec 10, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 164.30 KiB 164.32 KiB +17 B +0.01%
Rum Profiler 5.21 KiB 4.32 KiB -909 B -17.05%
Rum Recorder 19.74 KiB 19.74 KiB +1 B +0.00%
Logs 56.14 KiB 56.14 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 121.57 KiB 121.60 KiB +33 B +0.03%
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.0058 0.0041 -29.31%
RUM - add action 0.0175 0.0126 -28.00%
RUM - add error 0.0159 0.0133 -16.35%
RUM - add timing 0.0045 0.0038 -15.56%
RUM - start view 0.005 0.0036 -28.00%
RUM - start/stop session replay recording 0.0012 0.0009 -25.00%
Logs - log message 0.0218 0.0194 -11.01%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 25.94 KiB 25.27 KiB -691 B
RUM - add action 49.52 KiB 48.23 KiB -1.30 KiB
RUM - add timing 24.32 KiB 24.35 KiB +37 B
RUM - add error 54.73 KiB 53.41 KiB -1.32 KiB
RUM - start/stop session replay recording 23.65 KiB 23.94 KiB +299 B
RUM - start view 424.60 KiB 425.47 KiB +885 B
Logs - log message 43.70 KiB 44.27 KiB +591 B

🔗 RealWorld

@amortemousque amortemousque force-pushed the aymeric/profiler-use-history branch from 55c710a to 54300b7 Compare December 10, 2025 09:11

export const startProfilingContext = (hooks: Hooks): ProfilingContextManager => {
// Default status is `starting`.
export function startProfilingContext(hooks: Hooks): ProfilingContextManager {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unrelated but use classic function declaration for consistency

@amortemousque amortemousque changed the title ♻️ Replace longTaskRegistry by valueHistory ♻️ Replace longTaskRegistry by longTaskContexts Dec 10, 2025
@amortemousque amortemousque force-pushed the aymeric/profiler-use-history branch from 361628c to 08d1b6b Compare December 10, 2025 15:03
@amortemousque amortemousque force-pushed the aymeric/profiler-use-history branch from 643752a to cfac54a Compare December 10, 2025 15:27
@amortemousque amortemousque force-pushed the aymeric/profiler-use-history branch from cfac54a to 847e3b4 Compare December 10, 2025 15:28
Copy link
Collaborator

@thomasbertet thomasbertet left a comment

Choose a reason for hiding this comment

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

LGTM overall !

Added a nit on naming, but otherwise I believe that's a great refactoring!

Comment on lines +28 to +37
export interface LongTaskContext {
id: string
startClocks: ClocksState
duration: Duration
entryType: RumPerformanceEntryType.LONG_ANIMATION_FRAME | RumPerformanceEntryType.LONG_TASK
}

export interface LongTaskContexts {
findLongTasks: (startTime: RelativeTime) => LongTaskContext[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this s plural to represent the API object a convention ? Otherwise I can suggest :

export interface LongTaskEntry {
  id: string
  startClocks: ClocksState
  duration: Duration
  entryType: RumPerformanceEntryType.LONG_ANIMATION_FRAME | RumPerformanceEntryType.LONG_TASK
}

and

export interface LongTaskContext {
  findLongTasks: (startTime: RelativeTime) => LongTaskEntry[]
}

I'd find this a bit more clear - but it may not be following existing convention so overall I trust what you think is best !

@amortemousque
Copy link
Collaborator Author

/to-staging

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Dec 12, 2025

View all feedbacks in Devflow UI.

2025-12-12 08:40:06 UTC ℹ️ Start processing command /to-staging


2025-12-12 08:40:14 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 0s (p90)

Commit 847e3b43d6 will soon be integrated into staging-50.


2025-12-12 08:56:24 UTC ℹ️ Branch Integration: this commit was successfully integrated

Commit 847e3b43d6 has been merged into staging-50 in merge commit 14ec0770a2.

Check out the triggered pipeline on Gitlab 🦊

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-50

dd-mergequeue bot added a commit that referenced this pull request Dec 12, 2025
Integrated commit sha: 847e3b4

Co-authored-by: amortemousque <aymeric.mortemousque@datadoghq.com>
@amortemousque amortemousque merged commit dbb354e into main Dec 15, 2025
22 checks passed
@amortemousque amortemousque deleted the aymeric/profiler-use-history branch December 15, 2025 09:48
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2025
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.

3 participants