Skip to content

Rum-12060: Move RUM Debug Widget code from rum module to a new separate module#2960

Merged
kikoveiga merged 20 commits into
tvaleev/feature/innovation-week-07-04-25from
kikoveiga/RUM-12060/move-widget-code
Nov 3, 2025
Merged

Rum-12060: Move RUM Debug Widget code from rum module to a new separate module#2960
kikoveiga merged 20 commits into
tvaleev/feature/innovation-week-07-04-25from
kikoveiga/RUM-12060/move-widget-code

Conversation

@kikoveiga

@kikoveiga kikoveiga commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Moves the RUM Debug Widget code from dd-sdk-android-rum to a new module dd-sdk-android-rum-debug-widget.
  • Decouples the widget UI (LocalInsightsOverlay) and the InsightsCollector interface implementation (DefaultInsightsCollector) from the core RUM SDK.
  • Introduces a clean integration point so the widget can observe the active RUM insights without tight coupling.

Motivation

  • Reduce coupling between the RUM core and debug tools.
  • Optional inclusion of the new module into release builds.
  • Customers can build their own UI overlay and provide their own InsightsCollector implementation.

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)

@kikoveiga kikoveiga changed the title Kikoveiga/rum 12060/move widget code Rum-12060: Move RUM Debug Widget code from rum module to a new separate module Oct 21, 2025
@kikoveiga
kikoveiga changed the base branch from develop to kikoveiga/RUM-12060/fix-widget-code October 21, 2025 16:29
@datadog-official

datadog-official Bot commented Oct 21, 2025

Copy link
Copy Markdown

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 69.98% (-0.16%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 429cca6 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter

codecov-commenter commented Oct 21, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.14%. Comparing base (44ff748) to head (429cca6).

Files with missing lines Patch % Lines
...rnal/instrumentation/insights/InsightsCollector.kt 0.00% 4 Missing ⚠️
...om/datadog/android/insights/LocalInsightOverlay.kt 0.00% 1 Missing ⚠️
...kotlin/com/datadog/android/rum/RumConfiguration.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                             Coverage Diff                              @@
##           tvaleev/feature/innovation-week-07-04-25    #2960      +/-   ##
============================================================================
+ Coverage                                     70.09%   70.14%   +0.05%     
============================================================================
  Files                                           838      839       +1     
  Lines                                         30767    30770       +3     
  Branches                                       5231     5232       +1     
============================================================================
+ Hits                                          21564    21581      +17     
- Misses                                         7724     7731       +7     
+ Partials                                       1479     1458      -21     
Files with missing lines Coverage Δ
...tadog/android/insights/DefaultInsightsCollector.kt 0.00% <ø> (ø)
...g/android/insights/internal/InsightStateStorage.kt 0.00% <ø> (ø)
.../android/insights/internal/domain/TimelineEvent.kt 0.00% <ø> (ø)
...droid/insights/internal/extensions/AnimationExt.kt 0.00% <ø> (ø)
...og/android/insights/internal/extensions/LangExt.kt 0.00% <ø> (ø)
...dog/android/insights/internal/widgets/ChartView.kt 0.00% <ø> (ø)
...oid/insights/internal/widgets/DragTouchListener.kt 0.00% <ø> (ø)
.../android/insights/internal/widgets/TimelineView.kt 0.00% <ø> (ø)
...lin/com/datadog/android/rum/internal/RumFeature.kt 90.29% <100.00%> (+0.68%) ⬆️
...om/datadog/android/insights/LocalInsightOverlay.kt 0.00% <0.00%> (ø)
... and 2 more

... and 35 files with indirect coverage changes

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

Base automatically changed from kikoveiga/RUM-12060/fix-widget-code to tvaleev/feature/innovation-week-07-04-25 October 23, 2025 12:57
Comment thread features/dd-sdk-android-rum-debug-widget/build.gradle.kts Outdated
Comment thread features/dd-sdk-android-rum-debug-widget/build.gradle.kts Outdated
@kikoveiga
kikoveiga marked this pull request as ready for review October 28, 2025 19:02
@kikoveiga
kikoveiga requested review from a team as code owners October 28, 2025 19:03
@kikoveiga
kikoveiga requested a review from satween October 29, 2025 09:25
@kikoveiga kikoveiga self-assigned this Oct 29, 2025
It is intended for debugging and development purposes only and **should not** be included in production builds.
As shown in the screenshot below, the widget provides a floating overlay that displays key metrics such as **memory usage**, **CPU load** and **RUM events**.

<img src="../../docs/images/screenshot_rumdebugwidget.png" width="400" alt="Datadog RUM Debug Widget"/> No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: we should probably include details about the api call needed for integration
(.setInsightsCollector(DefaultInsightsCollector()))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, yes. I think it's best to add it on RUM-12062 as the configuration will change there.

/**
* The nullable singleton [InsightsCollector] instance.
*/
val insightsCollector: InsightsCollector? = (Datadog.getInstance() as? InternalSdkCore)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: This is a val in a singleton. If when first accessed the insightsCollector is null, will it recompute the instance when accessed again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It won't recompute. For that, we'd need to use a custom get(), should we do that?

@kikoveiga
kikoveiga requested a review from jonathanmos October 30, 2025 14:55
Comment thread features/dd-sdk-android-rum-debug-widget/build.gradle.kts Outdated
Comment on lines 29 to 30
@InternalApi
@ExperimentalRumApi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it is exposed as a part of public API, it shouldn't have @InternalApi annotation. Should it be a part of public API?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, as it's used in SampleApplication and intended to be used in the customers' applications in the future. Removed the @InternalApi notation.


private var isPaused: Boolean = false

private val insightsCollector: DefaultInsightsCollector?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need a singleton if we are in the same module?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was the solution found for now, but it will be refactored and improved in RUM-12062.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this class be a part of public API?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes for now, as it's being used in the Sample app's NavActivity and JetpackComposeActivity. After RUM-12062 this will be no longer needed so I intend to make it internal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we are adding a new public module, it should be added to the publish jobs in CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added configuration for this module in default-pipeline.yml and local_ci.sh.

* Provides the [InsightsCollector] instance inside the SDK, making it accessible to other modules.
*/
@InternalApi
object InsightsCollectorProvider {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this singleton? If yes, I guess it shouldn't be public?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was the solution found for now, but it will be refactored and improved in RUM-12062.

@kikoveiga
kikoveiga requested a review from 0xnm October 31, 2025 12:02
Comment thread features/dd-sdk-android-rum-debug-widget/build.gradle.kts Outdated
@kikoveiga
kikoveiga merged commit bcbb712 into tvaleev/feature/innovation-week-07-04-25 Nov 3, 2025
25 checks passed
@kikoveiga
kikoveiga deleted the kikoveiga/RUM-12060/move-widget-code branch November 3, 2025 09:36
@ncreated
ncreated restored the kikoveiga/RUM-12060/move-widget-code branch April 9, 2026 10:20
@0xnm
0xnm deleted the kikoveiga/RUM-12060/move-widget-code branch April 24, 2026 09:43
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.

6 participants