Skip to content

RUM-17613: timeseries [3/5] Pass the live RUM context to timeseries pipelines - #3717

Open
satween wants to merge 1 commit into
tvaleev/feature/RUM-17613-2-timeseries-schemafrom
tvaleev/feature/RUM-17613-3-background-flush
Open

RUM-17613: timeseries [3/5] Pass the live RUM context to timeseries pipelines#3717
satween wants to merge 1 commit into
tvaleev/feature/RUM-17613-2-timeseries-schemafrom
tvaleev/feature/RUM-17613-3-background-flush

Conversation

@satween

@satween satween commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Timeseries batches carried the RumContext captured when RumSessionScope created the collector, so every event was attributed to whatever view happened to be active at session start. The collector now tracks the context and hands it to Pipeline.execute() / Pipeline.flush() per call, and RumSessionScope feeds it the active context on every handled event.

Pipeline takes over its own synchronization as part of that: reader.read() stays outside the lock, so a concurrent flush() waits only for the buffer and never for /proc I/O.

The sampling lifecycle is unchanged here — background suspension still behaves exactly as before, gated on TimeseriesConfiguration.collectInBackground. [4/5] reworks it.

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)

Ref: RUM-17613

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 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: 100.00%
Overall Coverage: 72.82% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 341c6b1 | Docs | Datadog PR Page | Give us feedback!

@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.39%. Comparing base (40fa7af) to head (341c6b1).

Files with missing lines Patch % Lines
.../internal/timeseries/DefaultTimeseriesCollector.kt 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                                Coverage Diff                                @@
##           tvaleev/feature/RUM-17613-2-timeseries-schema    #3717      +/-   ##
=================================================================================
- Coverage                                          73.41%   73.39%   -0.02%     
=================================================================================
  Files                                               1012     1012              
  Lines                                              37072    37074       +2     
  Branches                                            6385     6384       -1     
=================================================================================
- Hits                                               27216    27210       -6     
+ Misses                                              8034     8033       -1     
- Partials                                            1822     1831       +9     
Files with missing lines Coverage Δ
...droid/rum/internal/domain/scope/RumSessionScope.kt 93.30% <100.00%> (+0.04%) ⬆️
...al/timeseries/DefaultTimeseriesCollectorFactory.kt 100.00% <100.00%> (ø)
...atadog/android/rum/internal/timeseries/Pipeline.kt 97.06% <100.00%> (+0.09%) ⬆️
.../internal/timeseries/DefaultTimeseriesCollector.kt 76.00% <87.50%> (-1.55%) ⬇️

... and 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@satween
satween force-pushed the tvaleev/feature/RUM-17613-2-timeseries-schema branch from a2fbff9 to 27abec6 Compare August 14, 2026 15:04
@satween
satween force-pushed the tvaleev/feature/RUM-17613-3-background-flush branch from 2c34b26 to 61448ac Compare August 14, 2026 15:04
@satween
satween marked this pull request as ready for review August 14, 2026 15:20
@satween
satween requested review from a team as code owners August 14, 2026 15:20
@satween satween changed the title RUM-17613: Stop collecting timeseries in background and flush the batch RUM-17613: Flush the batch in background Aug 14, 2026
@satween satween changed the title RUM-17613: Flush the batch in background RUM-17613: timeseries [3/4] Flush the batch in background Aug 14, 2026

@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: 61448ace2d

ℹ️ 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 +39 to +40
val dataPoint = reader.read()
synchronized(this) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep terminal flush ordered after in-flight reads

When a session or the RUM feature stops while a scheduled tick is inside reader.read(), onSessionStop() can flush the buffer before this block acquires the lock. The tick then adds its point after the final flush, does not reschedule because its generation is inactive, and the collector is discarded, so that point is permanently lost. The terminal flush needs to wait for an in-flight read/add operation or arrange another flush after the point is added.

Useful? React with 👍 / 👎.

Timeseries batches carried the RumContext captured when RumSessionScope
created the collector, so every event was attributed to whatever view was
active at session start. The collector now tracks the context and hands it to
Pipeline.execute()/flush() per call, and RumSessionScope feeds it the active
context on each handled event.

Pipeline takes over its own synchronization as part of that: reader.read()
stays outside the lock so a concurrent flush() never waits for /proc I/O.

Ref: RUM-17613
@satween
satween force-pushed the tvaleev/feature/RUM-17613-2-timeseries-schema branch from 27abec6 to 40fa7af Compare August 14, 2026 16:12
@satween
satween force-pushed the tvaleev/feature/RUM-17613-3-background-flush branch from 61448ac to 341c6b1 Compare August 14, 2026 16:12
@satween satween changed the title RUM-17613: timeseries [3/4] Flush the batch in background RUM-17613: timeseries [3/5] Pass the live RUM context to timeseries pipelines Aug 14, 2026

@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: 341c6b1286

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

synchronized(pipeline) {
if (isActive(generation)) pipeline.execute()
}
pipeline.execute(rumContext)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot the RUM context when the batch is drained

When a view transition is handled while reader.read() is in progress, this argument has already captured the previous rumContext; after the read completes, Pipeline.execute() can drain the buffer using that stale view ID even though the new view is active. This contradicts the intended drain-time attribution and can compute session.hasReplay from the wrong view, so the live context should be obtained after sampling, at the point the buffer is drained.

Useful? React with 👍 / 👎.

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.

2 participants