Skip to content

RUM-17613: timeseries [5/5] Add integration tests for timeseries collection - #3718

Open
satween wants to merge 1 commit into
tvaleev/feature/RUM-17613-3b-background-suspendfrom
tvaleev/feature/RUM-17613-4-integration-tests
Open

RUM-17613: timeseries [5/5] Add integration tests for timeseries collection#3718
satween wants to merge 1 commit into
tvaleev/feature/RUM-17613-3b-background-suspendfrom
tvaleev/feature/RUM-17613-4-integration-tests

Conversation

@satween

@satween satween commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds TimeseriesTrackingPlaygroundActivity and an instrumented TimeseriesCollectionTest that run
the real collection pipeline against the mock RUM server: CPU and memory batches are emitted with
the expected sample counts, leaving the foreground flushes the pending batch, nothing is collected
while backgrounded, and collection resumes on return to the foreground.

Motivation

The unit tests cover the pipeline pieces in isolation; nothing exercised the whole executor-driven
path with real readers and real lifecycle transitions, which is where the suspend/flush timing
actually matters.

Additional Notes

The integration module consumes testFixtures(project(":features:dd-sdk-android-rum")) and excludes
tools:unit, a JVM-only test module that must not land on the Android test classpath; gson and
jUnit4 are added as testFixturesImplementation so the androidTest consumer still has them at
runtime.

Requires a connected device or emulator on API 24+:
./gradlew :instrumented:integration:connectedDebugAndroidTest. Verified on API 28 — both tests
pass, three consecutive runs. The suite cannot run on API 23: every AssertJ assertion dies in
ConfigurationProvider.<clinit> with NoClassDefFoundError: Ljava/util/Spliterators;. That is not
specific to this PR — the pre-existing security.EncryptionTest fails identically on the same AVD.

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-prod-us1-4

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

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

DataDog/dd-sdk-android | test-pyramid:legacy-integration-instrumented-latest-api   View in Datadog   GitLab

DataDog/dd-sdk-android | test-pyramid:legacy-integration-instrumented-median-api   View in Datadog   GitLab

DataDog/dd-sdk-android | test-pyramid:legacy-integration-instrumented-min-api   View in Datadog   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

🔄 Datadog auto-retried 1 job - 0 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 72.82% (+0.00%)

Useful? React with 👍 / 👎

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

@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.34%. Comparing base (40a19e5) to head (40a19e5).

⚠️ Current head 40a19e5 differs from pull request most recent head 9d15921

Please upload reports for the commit 9d15921 to get more accurate results.

Additional details and impacted files
@@                               Coverage Diff                                @@
##           tvaleev/feature/RUM-17613-3b-background-suspend    #3718   +/-   ##
================================================================================
  Coverage                                            73.34%   73.34%           
================================================================================
  Files                                                 1012     1012           
  Lines                                                37087    37087           
  Branches                                              6392     6392           
================================================================================
  Hits                                                 27201    27201           
  Misses                                                8045     8045           
  Partials                                              1841     1841           
🚀 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-3-background-flush branch from 2c34b26 to 61448ac Compare August 14, 2026 15:04
@satween
satween force-pushed the tvaleev/feature/RUM-17613-4-integration-tests branch from 94ca6d7 to b3faf94 Compare August 14, 2026 15:04
@satween
satween marked this pull request as ready for review August 14, 2026 15:21
@satween
satween requested review from a team as code owners August 14, 2026 15:21
@satween satween changed the title RUM-17613: Add integration tests for timeseries collection RUM-17613: timeseries [4/4] Add integration tests for timeseries collection 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: b3faf94903

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

androidTestImplementation(project(":features:dd-sdk-android-trace-internal"))
androidTestImplementation(
(testFixtures(project(":features:dd-sdk-android-rum")) as ModuleDependency).apply {
exclude(mapOf("group" to "dd-sdk-android-timeseries.tools", "module" to "unit"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid hard-coding the checkout-derived project group

When the repository is checked out under its normal dd-sdk-android directory, Gradle derives this subproject's group as dd-sdk-android.tools, so this dd-sdk-android-timeseries.tools exclusion does not match. The JVM-flavored transitive :tools:unit dependency therefore remains alongside the integration module's direct ART-flavored dependency, which can break androidTest variant resolution; exclude the project dependency without depending on the clone directory name.

Useful? React with 👍 / 👎.

Comment on lines +146 to +149
private const val EXPECTED_FOREGROUND_MEMORY_DATA_POINTS =
((FOREGROUND_COLLECTION_DURATION_MS + ACTIVITY_STOP_DELAY_MS) / SAMPLE_INTERVAL_MS).toInt()
private const val EXPECTED_FOREGROUND_CPU_DATA_POINTS =
EXPECTED_FOREGROUND_MEMORY_DATA_POINTS - 1

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 Synchronize sampling before asserting exact point counts

On a slower or busier emulator, the collector can be scheduled before the test method begins—or its asynchronous session startup can occur after the sleep begins—so the number of sampling intervals is not determined solely by FOREGROUND_COLLECTION_DURATION_MS + ACTIVITY_STOP_DELAY_MS. The resulting batch can contain fewer or more points than this formula predicts, making both tests intermittently fail despite correct collection; synchronize against the first sample/collector state or assert a timing-tolerant range instead.

Useful? React with 👍 / 👎.

Comment on lines +29 to +30

@RunWith(AndroidJUnit4::class)

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 Skip these AssertJ tests on unsupported API 23 runs

When this module's tests run on its declared minimum SDK of API 23 without the optional Java backport property, the AssertJ calls used throughout this class fail while initializing ConfigurationProvider because java.util.Spliterators is unavailable. Since @LargeTest does not impose an SDK floor, the runner still executes both tests; add an API-24 @SdkSuppress (or ensure the backport is always enabled) so the documented integration command does not add guaranteed failures on a supported test device.

Useful? React with 👍 / 👎.

Add a playground activity and an instrumented test that assert CPU and
memory timeseries are collected, flushed on backgrounding and resumed on
return to foreground.

Ref: RUM-17613
@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 force-pushed the tvaleev/feature/RUM-17613-4-integration-tests branch from b3faf94 to 9d15921 Compare August 14, 2026 16:12
@satween satween changed the title RUM-17613: timeseries [4/4] Add integration tests for timeseries collection RUM-17613: timeseries [5/5] Add integration tests for timeseries collection Aug 14, 2026
@satween
satween changed the base branch from tvaleev/feature/RUM-17613-3-background-flush to tvaleev/feature/RUM-17613-3b-background-suspend August 14, 2026 16:13
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