Skip to content

[RUM-8785]: Refactoring JankStatsActivityLifecycleListener#2513

Merged
satween merged 4 commits into
developfrom
tvaleev/RUM-8785
Feb 28, 2025
Merged

[RUM-8785]: Refactoring JankStatsActivityLifecycleListener#2513
satween merged 4 commits into
developfrom
tvaleev/RUM-8785

Conversation

@satween

@satween satween commented Feb 26, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

In this PR we decoupling FrameMetrics subscription logic and FPS computation. Listener delegates were introduced for future ui slowness metrics support.

Motivation

This class makes too much work and make impossible to reuse subscription logic. Core idea to subscribe for the metrics in one single place and use collected info in several monitors.

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)

@satween
satween requested review from a team as code owners February 26, 2025 18:00
@codecov-commenter

codecov-commenter commented Feb 26, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 76.62338% with 18 lines in your changes missing coverage. Please review.

Project coverage is 70.06%. Comparing base (c0044da) to head (a03d8e8).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...ernal/vitals/JankStatsActivityLifecycleListener.kt 61.54% 8 Missing and 7 partials ⚠️
...og/android/rum/internal/vitals/FPSVitalListener.kt 85.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2513      +/-   ##
===========================================
+ Coverage    70.02%   70.06%   +0.05%     
===========================================
  Files          794      796       +2     
  Lines        29875    29927      +52     
  Branches      4991     5001      +10     
===========================================
+ Hits         20917    20968      +51     
+ Misses        7579     7572       -7     
- Partials      1379     1387       +8     
Files with missing lines Coverage Δ
...lin/com/datadog/android/rum/internal/RumFeature.kt 92.81% <100.00%> (+0.35%) ⬆️
...og/android/rum/internal/domain/FrameMetricsData.kt 100.00% <100.00%> (ø)
...og/android/rum/internal/vitals/FPSVitalListener.kt 85.00% <85.00%> (ø)
...ernal/vitals/JankStatsActivityLifecycleListener.kt 70.80% <61.54%> (+1.64%) ⬆️

... and 26 files with indirect coverage changes

ambushwork
ambushwork previously approved these changes Feb 27, 2025
jonathanmos
jonathanmos previously approved these changes Feb 27, 2025
0xnm
0xnm previously approved these changes Feb 28, 2025

@0xnm 0xnm left a comment

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.

I left few comments, but nothing blocking.

Comment on lines +301 to +306
@SuppressLint("InlinedApi")
if (buildSdkVersionProvider.version >= Build.VERSION_CODES.O) {
intendedVsyncTimestamp = frameMetrics.getMetric(FrameMetrics.INTENDED_VSYNC_TIMESTAMP)
vsyncTimestamp = frameMetrics.getMetric(FrameMetrics.VSYNC_TIMESTAMP)
}
@SuppressLint("InlinedApi")

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.

why these annotations are needed? If removed, what is the error?

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.

We're using buildSdkVersionProvider for OS version resolution. Android Studios's linter is not aware of it and highlighting inappropriate api usage:
image

@satween
satween merged commit 24bdc2c into develop Feb 28, 2025
@satween
satween deleted the tvaleev/RUM-8785 branch February 28, 2025 13:35
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