Skip to content

🐛 Fix profiling <-> long task association regression#4045

Merged
amortemousque merged 2 commits intomainfrom
aymeric/fix-long-task-association
Jan 5, 2026
Merged

🐛 Fix profiling <-> long task association regression#4045
amortemousque merged 2 commits intomainfrom
aymeric/fix-long-task-association

Conversation

@amortemousque
Copy link
Collaborator

Motivation

This PR fixes a regression introduced in #4013, where the profiler only linked long tasks that were active at startTime. It now links every long task that occurs during the profiling session.

Changes

  • Call findLongTasks with the duration to get all long tasks that occur within that period.
  • Update unit tests to cover this case

Test instructions

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 18, 2025 15:16
@amortemousque amortemousque force-pushed the aymeric/fix-long-task-association branch from 03c98a0 to 79756bc Compare December 18, 2025 15:18
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

const longTask = (rawRumEvents[0].rawRumEvent as RawRumLongTaskEvent).long_task
const longTasks = longTaskCollection.longTaskContexts.findLongTasks(1234 as RelativeTime)
expect(longTasks).toContain({

P1 Badge Update legacy long-task test to pass duration to findLongTasks

The findLongTasks API now requires both start time and duration, but this legacy long-task test still calls it with a single argument. With strict TypeScript settings this produces “Expected 2 arguments, but got 1”, so the test suite no longer compiles. Pass the profiling window duration (e.g., the entry duration) into this call to align with the updated signature.

ℹ️ 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-official
Copy link

datadog-official bot commented Dec 18, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 77.24% (-0.01%)

View detailed report

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

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Dec 18, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 164.37 KiB 164.37 KiB +4 B +0.00%
Rum Profiler 4.32 KiB 4.33 KiB +6 B +0.14%
Rum Recorder 20.01 KiB 20.01 KiB 0 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.64 KiB 121.65 KiB +4 B +0.00%
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.0059 0.0044 -25.42%
RUM - add action 0.0189 0.0155 -17.99%
RUM - add error 0.0161 0.0125 -22.36%
RUM - add timing 0.0053 0.0029 -45.28%
RUM - start view 0.0063 0.0037 -41.27%
RUM - start/stop session replay recording 0.0014 0.0007 -50.00%
Logs - log message 0.0206 0.0135 -34.47%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 26.02 KiB 25.12 KiB -912 B
RUM - add action 49.30 KiB 48.90 KiB -415 B
RUM - add timing 23.72 KiB 24.56 KiB +854 B
RUM - add error 55.95 KiB 53.30 KiB -2.64 KiB
RUM - start/stop session replay recording 24.07 KiB 23.62 KiB -460 B
RUM - start view 424.13 KiB 425.16 KiB +1.03 KiB
Logs - log message 45.43 KiB 44.17 KiB -1.27 KiB

🔗 RealWorld

notifyPerformanceEntries([entry])

const longTask = (rawRumEvents[0].rawRumEvent as RawRumLongTaskEvent).long_task
const longTasks = longTaskCollection.longTaskContexts.findLongTasks(1234 as RelativeTime)
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: could you adjust or add a test to illustrate the issue? In this case, if you were using findLongTasks with a time older than the long task start time, the long task wasn't returned.

Edit: I see you added tests below, but maybe add a test closer to the actual issue could be nice

@amortemousque amortemousque merged commit ce2d3fc into main Jan 5, 2026
21 checks passed
@amortemousque amortemousque deleted the aymeric/fix-long-task-association branch January 5, 2026 11:34
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants