Skip to content

RUM-18154: Buffer trigger profiles through PendingTriggerProfiles and dispatch via writeTriggerProfile - #3808

Draft
ambushwork wants to merge 1 commit into
feature/memory-profilingfrom
yl/memory/wire-heap-dump-to-writer
Draft

RUM-18154: Buffer trigger profiles through PendingTriggerProfiles and dispatch via writeTriggerProfile#3808
ambushwork wants to merge 1 commit into
feature/memory-profilingfrom
yl/memory/wire-heap-dump-to-writer

Conversation

@ambushwork

@ambushwork ambushwork commented Sep 1, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Wires OOM and memory-anomaly heap histograms into the profiling upload path. Adds a new PendingTriggerProfiles buffer that pairs a trigger-captured Perfetto trace with its gating RUM error event (RumOomErrorEvent / RumAnomalyErrorEvent), and dispatches matched pairs to the new ProfilingDataWriter.writeTriggerProfile(...). Unmatched captures/signals expire after 5s (or on feature stop) and are discarded so no trace file leaks.

Also relaxes the ProfilingManagerTriggerRegistrar staleness cutoff so it only applies to ANR: OOM/Anomaly captures are always forwarded even when the callback is delayed, and the registrar now keeps the histogram file — the feature owns its lifetime.

Motivation

RUM already emits its own OOM error events; the profiling feature needs to correlate those with the captured heap histogram and upload them together as a trigger profile. The capture and the RUM error arrive asynchronously, so they must be buffered and matched by trigger type.

Additional Notes

  • The staleness check (delay > MAX_CALLBACK_DELAY_MS) now applies only to ANR, whose thread dump is live and time-sensitive; OOM/Anomaly trace files are captured at the actual trigger time, so delayed callbacks must still be forwarded.
  • ANR remains synchronous (thread dump to RUM, no histogram buffered) — its file is deleted as before.
  • New PendingTriggerProfilesTest covers matching (both arrival orders), trigger-type mismatch, expiry (device vs server clock drift), override, and cleanup.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Sep 1, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/dd-sdk-android | test-pyramid:legacy-integration-instrumented-min-api — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 86.36%
Overall Coverage: 70.99% (+0.04%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0cfdbab | Docs | View more details | Give us feedback!

@ambushwork
ambushwork force-pushed the yl/memory/wire-heap-dump-to-writer branch 2 times, most recently from a9c5224 to bcbfce9 Compare September 1, 2026 15:51
@ambushwork
ambushwork force-pushed the yl/memory/wire-heap-dump-to-writer branch from bcbfce9 to 0cfdbab Compare September 1, 2026 16:32
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.

1 participant