Skip to content

RUMS-6325: Add opt-in adaptive scheduling for Session Replay captures - #3935

Open
jonathanmos wants to merge 2 commits into
developfrom
jmoskovich/rums-6325/jank-aware-backoff
Open

jonathanmos wants to merge 2 commits into
developfrom
jmoskovich/rums-6325/jank-aware-backoff

Conversation

@jonathanmos

@jonathanmos jonathanmos commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Adds an internal adaptiveCaptureSchedulingEnabled flag to reduce Session Replay overhead on screens with repeated draw events, such as a blinking cursor in React Native.
When enabled, the scheduler:

  • Posts capture work outside the draw callback, while keeping traversal on the main thread.
  • Uses a 50 ms/s capture-time budget when dynamic optimization is enabled.
  • Keeps one pending capture when the budget is exhausted and retries when it recovers, preserving the final update even if drawing stops.
  • Requests a capture when the RUM view changes.
  • Cancels pending work when recording stops or windows are replaced.
    The flag defaults to false, preserving existing behavior for other customers. It is separate from dynamicOptimizationEnabled, which continues to control budget enforcement and defaults to true.

Motivation

A customer reported high CPU usage while a React Native text input’s cursor was blinking. Each blink could trigger a full Session Replay traversal.
Reducing the existing budget from 100 to 50 ms/s substantially reduced capture CPU usage, but could drop the final update and still perform expensive traversal inside draw callbacks. This change addresses those behaviors while keeping rollout limited to customers who explicitly enable the internal flag.

Additional Notes

Anything else we should know when reviewing?

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 30, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed. Datadog automation helped this PR pass.

🎉 All green!

🧪 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.21%
• Overall Coverage: 71.79% (-0.14%)

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

@jonathanmos
jonathanmos force-pushed the jmoskovich/rums-6325/jank-aware-backoff branch from a93579e to b357194 Compare October 7, 2026 10:16
@jonathanmos jonathanmos changed the title RUMS-6325: Add jank-aware backoff to Session Replay's capture debouncer RUMS-6325: Add opt-in adaptive scheduling for Session Replay captures Oct 7, 2026
@jonathanmos
jonathanmos force-pushed the jmoskovich/rums-6325/jank-aware-backoff branch from b357194 to 6a7869e Compare October 7, 2026 10:40
@jonathanmos

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T12:19:17.628930Z e366137 New commits
🔒 Security Review ✅ Completed 2026-10-12T12:22:28.645267Z e366137 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 6a7869e503

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6a7869e503

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jonathanmos
jonathanmos marked this pull request as ready for review October 7, 2026 13:08
@jonathanmos
jonathanmos requested review from a team as code owners October 7, 2026 13:08
@jonathanmos
jonathanmos force-pushed the jmoskovich/rums-6325/jank-aware-backoff branch from 6a7869e to 5096375 Compare October 7, 2026 14:29
@maciejburda
maciejburda requested a review from satween October 8, 2026 07:06
@jonathanmos
jonathanmos force-pushed the jmoskovich/rums-6325/jank-aware-backoff branch from 5096375 to 3ff6980 Compare October 8, 2026 08:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 3ff698036a

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

@jonathanmos
jonathanmos force-pushed the jmoskovich/rums-6325/jank-aware-backoff branch from 3ff6980 to 84b98c1 Compare October 8, 2026 09:53
kikoveiga
kikoveiga previously approved these changes Oct 12, 2026
Comment thread features/dd-sdk-android-session-replay/api/apiSurface
@jonathanmos
jonathanmos requested a review from 0xnm October 15, 2026 07:57
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