Skip to content

Conversation

@HugoGarrido
Copy link
Collaborator

@HugoGarrido HugoGarrido commented Jan 19, 2026

Motivation

LCP Subparts are values that compute the final LCP measure the browser SDK.

This is helpful for troubleshooting LCP since it help to define what type of LCP issue we are facing (server, render etc.) by looking at the biggest contributor (more details in this doc)

Here is a breakdown of each part :

Subpart Meaning
TTFB Already tracked by the Browser SDK as firstByte
Resource load delay Time between firstByte and the loading start of the resource associated with the LCP. 0 if no resource are attached to the LCP
Resource load duration Time to takes to load the resource attached to the LCP0 if no resource are attached to the LCP
Element render delay Time between the LCP resource finishes loading and the LCP element is fully rendered

This PR adds the collection of the LCP subparts when we collect the LCP

Changes

  • In trackLargestContentfulPaint when we have an LCP entry :
    • re-measure the TTFB (keeping the name firstByte)
    • get the performance entry related to the LCP resource if applicable
    • compute an optional subParts object that is added in the final payload
  • Extract a helper to safely compute the firstByte value
  • Extract a helper to safely read performance global
  • Update tests, fixtures and types to support the new subParts object
  • Add code behind COLLECT_LCP_SUBPARTS

Test instructions

Checklist

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

@github-actions
Copy link

github-actions bot commented Jan 19, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Jan 20, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 167.98 KiB 168.61 KiB +648 B +0.38%
Rum Profiler 4.31 KiB 4.31 KiB 0 B 0.00%
Rum Recorder 24.54 KiB 24.54 KiB 0 B 0.00%
Logs 56.25 KiB 56.29 KiB +46 B +0.08%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 124.88 KiB 125.49 KiB +625 B +0.49%
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.0039 0.0047 +20.51%
RUM - add action 0.0129 0.0162 +25.58%
RUM - add error 0.0133 0.0158 +18.80%
RUM - add timing 0.0026 0.003 +15.38%
RUM - start view 0.0031 0.0049 +58.06%
RUM - start/stop session replay recording 0.0007 0.001 +42.86%
Logs - log message 0.0176 0.0197 +11.93%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 28.70 KiB 26.60 KiB -2.09 KiB
RUM - add action 100.44 KiB 50.99 KiB -49.45 KiB
RUM - add timing 27.83 KiB 27.66 KiB -175 B
RUM - add error 102.86 KiB 54.29 KiB -48.57 KiB
RUM - start/stop session replay recording 26.75 KiB 26.25 KiB -512 B
RUM - start view 438.38 KiB 430.16 KiB -8.22 KiB
Logs - log message 48.20 KiB 46.61 KiB -1.59 KiB

🔗 RealWorld

@datadog-official
Copy link

datadog-official bot commented Jan 20, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 70.00%
Overall Coverage: 77.23%

View detailed report

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

@HugoGarrido
Copy link
Collaborator Author

I have read the CLA Document and I hereby sign the CLA

@HugoGarrido HugoGarrido marked this pull request as ready for review January 22, 2026 10:13
@HugoGarrido HugoGarrido requested a review from a team as a code owner January 22, 2026 10:13
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: 94434b0253

ℹ️ 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 +76 to +78
const lcpResourceEntry = resourceUrl
? (getResourceEntries()?.find((e) => e.name === resourceUrl) as PerformanceResourceTiming | undefined)
: undefined

Choose a reason for hiding this comment

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

P2 Badge Match the LCP resource to the correct request

The LCP resource timing is selected via getResourceEntries()?.find((e) => e.name === resourceUrl), which returns the first entry with that URL. Resource entries persist for the whole page and can include multiple requests for the same URL (e.g., preloads, cache-busting reloads, or SPA route changes). In those cases the first entry is often unrelated to the LCP element, so loadDelay/loadTime/renderDelay are computed from stale timings, corrupting the subparts metrics. Consider picking the most recent matching entry whose timing precedes lcpEntry.startTime instead of the first match.

Useful? React with 👍 / 👎.

@HugoGarrido HugoGarrido force-pushed the hugo.garridoysaez/feat/support-lcp-subparts branch from 04f3642 to e211124 Compare February 2, 2026 10:48
@HugoGarrido
Copy link
Collaborator Author

/to-staging

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

gh-worker-devflow-routing-ef8351 bot commented Feb 2, 2026

View all feedbacks in Devflow UI.

2026-02-02 13:55:15 UTC ℹ️ Start processing command /to-staging


2026-02-02 13:55:23 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 0s (p90)

Commit 989e08daac will soon be integrated into staging-06.


2026-02-02 14:07:33 UTC ℹ️ Branch Integration: this commit was successfully integrated

Commit 989e08daac has been merged into staging-06 in merge commit 722f4b6fee.

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-06

gh-worker-dd-mergequeue-cf854d bot added a commit that referenced this pull request Feb 2, 2026
…aging-06

Integrated commit sha: 989e08d

Co-authored-by: HugoGarrido <9059402+HugoGarrido@users.noreply.github.com>
Co-authored-by: hugo.garridoysaez <hugo.garridoysaez@datadoghq.com>
@dd-devflow dd-devflow bot added the staging-06 label Feb 2, 2026
@HugoGarrido
Copy link
Collaborator Author

Code is deployed on staging for you to test!
Screenshot 2026-02-02 at 16 43 21

@HugoGarrido HugoGarrido requested a review from bcaudan February 2, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants