Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RUM-8785]: Refactoring JankStatsActivityLifecycleListener #2513

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

satween
Copy link
Contributor

@satween satween commented Feb 26, 2025

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
Copy link

codecov-commenter commented Feb 26, 2025

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

jonathanmos
jonathanmos previously approved these changes Feb 27, 2025
0xnm
0xnm previously approved these changes Feb 28, 2025
Copy link
Member

@0xnm 0xnm left a comment

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
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
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
24 checks passed
@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