Skip to content

[RUM-8654] Slow frames collection support #2518

Merged
satween merged 23 commits into
developfrom
tvaleev/rum-8654
Mar 19, 2025
Merged

[RUM-8654] Slow frames collection support #2518
satween merged 23 commits into
developfrom
tvaleev/rum-8654

Conversation

@satween

@satween satween commented Feb 28, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a SlowFrames listener that collects occurrences of jank frames during a view's lifetime.
This PR introduces the underlying logic and corresponding tests but does not yet integrate the functionality. The remaining integration will be completed in future tickets.

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 28, 2025 16:23
currentViewStartedTimeStampNs = startedTimestampNs
}

override fun resolveReport(viewId: String): ViewUIPerformanceData {

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.

This function name is not as indicative enough as onViewCreated to explain where it should be called. (especially you haven't call it yet in this PR). should it be called when the rum view scope ends?

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 approach follows common one,
in InteractionToNextViewMetricResolver and NetworkSettledMetricResolver

How do you think we should call it?

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 see, because I didn't find any call site of this function (because you haven't finish the whole feature yet), I am trying to understand where it should be called.

@codecov-commenter

codecov-commenter commented Feb 28, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 93.40659% with 12 lines in your changes missing coverage. Please review.

Project coverage is 70.21%. Comparing base (4c23077) to head (f942dd6).
Report is 24 commits behind head on develop.

Files with missing lines Patch % Lines
.../android/rum/internal/domain/scope/RumViewScope.kt 64.71% 0 Missing and 6 partials ⚠️
...m/internal/domain/state/ViewUIPerformanceReport.kt 91.30% 1 Missing and 1 partial ⚠️
...adog/android/internal/collections/EvictingQueue.kt 95.45% 0 Missing and 1 partial ⚠️
...lin/com/datadog/android/rum/internal/RumFeature.kt 97.50% 0 Missing and 1 partial ⚠️
...droid/rum/internal/domain/state/SlowFrameRecord.kt 80.00% 1 Missing ⚠️
...m/internal/metric/slowframes/SlowFramesListener.kt 97.37% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2518      +/-   ##
===========================================
+ Coverage    70.01%   70.21%   +0.20%     
===========================================
  Files          798      803       +5     
  Lines        30047    30196     +149     
  Branches      5029     5059      +30     
===========================================
+ Hits         21035    21200     +165     
+ Misses        7614     7598      -16     
  Partials      1398     1398              
Files with missing lines Coverage Δ
...rum/src/main/kotlin/com/datadog/android/rum/Rum.kt 87.72% <100.00%> (+0.22%) ⬆️
...kotlin/com/datadog/android/rum/RumConfiguration.kt 97.18% <100.00%> (+0.08%) ⬆️
...droid/rum/configuration/SlowFramesConfiguration.kt 100.00% <100.00%> (ø)
...og/android/rum/internal/domain/FrameMetricsData.kt 100.00% <100.00%> (ø)
...d/rum/internal/domain/scope/RumApplicationScope.kt 95.15% <100.00%> (+0.15%) ⬆️
...droid/rum/internal/domain/scope/RumSessionScope.kt 96.72% <100.00%> (+0.03%) ⬆️
...d/rum/internal/domain/scope/RumViewManagerScope.kt 91.41% <100.00%> (+0.18%) ⬆️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 85.31% <100.00%> (-0.27%) ⬇️
...droid/rum/internal/vitals/FrameStatesAggregator.kt 71.13% <100.00%> (ø)
...adog/android/internal/collections/EvictingQueue.kt 95.45% <95.45%> (ø)
... and 5 more

... and 26 files with indirect coverage changes

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

ambushwork
ambushwork previously approved these changes Mar 3, 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 went through the production code so far and left some comments/questions. Didn't check test code yet.

@ambushwork

Copy link
Copy Markdown
Member

Question: in the description it says part of the implementation has not been done yet, should this PR targets to a feature branch instead of develop branch then?

@satween

satween commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

Question: in the description it says part of the implementation has not been done yet, should this PR targets to a feature branch instead of develop branch then?

I am gonna merge this PR after new version release, but there is no core changes so should be fine

@satween
satween requested a review from 0xnm March 7, 2025 15:19
@satween satween mentioned this pull request Mar 7, 2025
3 tasks

@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.

nice work! I left some questions, but nothing blocking.

0xnm
0xnm previously approved these changes Mar 10, 2025

fun slowFramesRate(viewEndedTimeStamp: Long): Double = when {
viewEndedTimeStamp - viewStartedTimeStamp <= minViewLifetimeThresholdNs -> 0.0
totalFramesDurationNs > 0.0 -> slowFramesDurationNs.toDouble() / totalFramesDurationNs

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.

to me it is not a rate, but ratio. Are we sure we are using a correct terminology?

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.

Gonna update event schema first, and then change this in a serate ticket

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a good point.
We followed the naming used by Apple here:

@satween
satween requested review from 0xnm and ambushwork March 12, 2025 16:08
0xnm
0xnm previously approved these changes Mar 13, 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 tentatively approve this PR, but we really need to decide on the lingvo rate vs ratio before the next release. The chosen terminology should be:

  • easily understandable by the customers
  • common in the industry (ideally the same wording used by the Play Store as well)

0xnm
0xnm previously approved these changes Mar 13, 2025
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.

5 participants