timeseries [6/6] RUM-13949 Add end-to-end timeseries verification tests with CSV fixtures#3436
Draft
satween wants to merge 16 commits into
Conversation
This was referenced May 12, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
timeseries RUM-13949 Add end-to-end timeseries verification tests with CSV fixtures
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## tvaleev/feature/RUM-13949/timeseries-rum-session-wiring #3436 +/- ##
===========================================================================================
- Coverage 72.16% 72.15% -0.01%
===========================================================================================
Files 973 973
Lines 35718 35718
Branches 5934 5934
===========================================================================================
- Hits 25775 25771 -4
- Misses 8320 8325 +5
+ Partials 1623 1622 -1 🚀 New features to boost your workflow:
|
f630b6d to
3b05b0c
Compare
47a028b to
c082086
Compare
3b05b0c to
9d01d39
Compare
Introduces the core primitives for the timeseries data pipeline: `Timeseries` interface (with `@NoOpImplementation`), `DataPoint`, `Buffer`, `DeltaCompression`, `Pipeline`, `EventWriter`, `JsonSerializer` interface, `DataPointsReader` interface, `VitalReaderWrapper`, and the generic `RumSessionScopeTimeseries` per-session collector. Also adds detekt safe-call allowlist entries for the new APIs. ### What does this PR do? Adds the foundational building blocks shared by all timeseries metric types: the `Timeseries` lifecycle interface, immutable `DataPoint`, the `Buffer`/`DeltaCompression`/`Pipeline` data-processing chain, the `EventWriter` flush boundary, `JsonSerializer` interface, `DataPointsReader`/`VitalReaderWrapper` for OS-metric abstraction, and `RumSessionScopeTimeseries` — the generic per-session scheduler that drives sampling, batching, and writing for any metric type. ### Motivation Establishes the shared infrastructure that CPU and memory collectors will extend, keeping primitive types and pipeline logic isolated so they can be reviewed without metric-specific details. ### Additional Notes Unit tests cover all primitives. `DataPointForgeryFactory` and the `Configurator` registration are included so subsequent commits can write tests against generated `DataPoint` values. `RumSessionTypeExt` session-type mappings are added here (used by both CPU and memory serializers in later commits).
c082086 to
ac44f0c
Compare
8ea9614 to
9a49aaa
Compare
ac44f0c to
92af517
Compare
This comment has been minimized.
This comment has been minimized.
9a49aaa to
0db4915
Compare
92af517 to
de1c9de
Compare
0db4915 to
91bf158
Compare
de1c9de to
15f936e
Compare
- Switch `RumSessionScopeTimeseries` from owning a per-session executor to accepting a shared `ScheduledExecutorService` (no creation, no shutdown). - Add `RumSessionScopeTimeseriesFactory` so reviewers can see how `RumSessionScopeTimeseries` is instantiated. - Wire timeseries `start`/`stop` lifecycle into `RumSessionScope` (`startTimeseries`/`stopTimeseries` called from `renewSession`/`stopSession`). - Remove 3 unused entries added to `detekt_custom_safe_calls.yml` in this branch.
### What does this PR do? Adds `CpuDatapointReader`, which reads CPU-usage metrics from the existing `CpuVitalReader` vital and wraps them as `DataPoint` values; and `CpuEventSerializer`, which converts a batch of CPU `DataPoint`s into a `RumTimeseriesCpuEvent` JSON object ready for ingestion. ### Motivation Implements CPU metric collection as the first concrete timeseries type, exercising the pipeline infrastructure introduced in the previous commit. ### Additional Notes `CpuDatapointReader` normalises the raw MHz value to a 0–100 percent scale and clamps it with `coerceIn`. `CpuEventSerializer` maps `RumSessionType` to `RumTimeseriesCpuEvent.Session.Type` via the `toTimeseriesCpuSessionType()` extension. Both classes are fully covered by unit tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15f936e to
5a583ff
Compare
91bf158 to
7298723
Compare
…ions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds `MemoryEventSerializer`, which converts a batch of memory `DataPoint`s (heap + native RSS) into a `RumTimeseriesMemoryEvent` JSON object. Introduces `TimeseriesConfiguration` as the public `@ExperimentalRumApi` configuration class (sampling intervals, batch size, background collection flag). Completes the pipeline with `RumSessionScopeTimeseriesFactory`, which wires CPU and memory readers, serializers, and the `TimeseriesConfiguration` together to create fully configured `RumSessionScopeTimeseries` instances for each new session. Completes the two metric types and provides the factory needed to tie the pipeline to the RUM session lifecycle. `MemoryEventSerializer` reports both heap and native RSS in bytes, normalised to a 0–100 percent scale using device `maxMemory`. `RumSessionScopeTimeseriesFactory` creates one pipeline per metric type and dispatches them through the same `Timeseries.Factory` interface. `TimeseriesConfiguration` exposes sampling interval, batch size, and a background-collection flag with sensible defaults.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds `enableTimeseries()`/`disableTimeseries()` builder methods on `RumConfiguration.Builder`. Wires the `Timeseries.Factory` through `RumFeature` → `DatadogRumMonitor` → `RumApplicationScope` → `RumSessionScope`, so that a new `RumSessionScopeTimeseries` collector is created and started for each sampled session and stopped on session end or SDK teardown. Also enables timeseries in the Kotlin sample app. Connects the standalone pipeline and public configuration API to the existing RUM session lifecycle, completing the end-to-end data flow from configuration through to event emission. Existing scope and monitor test scaffolding is updated to pass `timeseriesFactory = null` / a mock factory where required. The `RumFeature.onStop()` ordering test verifies the writer is still live when the final flush fires.
…ctivityManager cast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MemoryInfo() and getMemoryInfo() are listed in knownThrowingCalls as they can throw RuntimeException on broken Android implementations. Extract to readTotalRamBytes() with a safe RuntimeException catch and WARN log, falling back to 0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
### What does this PR do? Adds a self-contained end-to-end test suite for the timeseries pipeline using CSV-driven input fixtures and golden JSON files, without any real Android API dependencies. Includes `CSVReader`, `CsvTimeseries` (a synchronous, executor-free test double mirroring `RumSessionScopeTimeseriesFactory`), `TimeseriesEndToEndTest`, and the accompanying CSV input and expected JSON fixture files. ### Motivation Provides regression coverage that the full memory and CPU batch outputs match the expected wire format exactly, catching any serialization regressions independently of mock-heavy unit tests. ### Additional Notes Fixtures use a fixed 10-sample / 2-batch scenario. Numeric comparisons use a small relative tolerance for floating-point memory_percent values.
- DataPoint(timestamp→timestampNs), onSessionStart/Stop, remove unsafe ?. call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7298723 to
cd319d9
Compare
5a583ff to
de29adf
Compare
timeseries RUM-13949 Add end-to-end timeseries verification tests with CSV fixturestimeseries [6/6] RUM-13949 Add end-to-end timeseries verification tests with CSV fixtures
cd319d9 to
ac48ae9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Adds a self-contained end-to-end test suite for the timeseries pipeline using CSV-driven input fixtures and golden JSON files, without any real Android API dependencies. Includes
CSVReader,CsvTimeseries(a synchronous, executor-free test double mirroringRumSessionScopeTimeseriesFactory),TimeseriesEndToEndTest, and the accompanying CSV input and expected JSON fixture files.Motivation
Provides regression coverage that the full memory and CPU batch outputs match the expected wire format exactly, catching any serialization regressions independently of mock-heavy unit tests.
Review checklist (to be filled by reviewers)