Skip to content

RUM-7171 Implement the basic logic for interaction-to-next-view-metric #2417

Merged
mariusc83 merged 1 commit into
feature/view-loading-timesfrom
mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric
Nov 29, 2024
Merged

RUM-7171 Implement the basic logic for interaction-to-next-view-metric #2417
mariusc83 merged 1 commit into
feature/view-loading-timesfrom
mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric

Conversation

@mariusc83

@mariusc83 mariusc83 commented Nov 28, 2024

Copy link
Copy Markdown
Member

What does this PR do?

In this PR we are adding the logic to compute and provide the interaction-to-next-view time.

Captures the time interval in nano seconds from the last user interaction on the previous view to when the current view becomes visible. The last user interaction needs to match some criteria that will
be detailed below where we explain how this metric is computed.

Is Directly associated with the lifecycle of the view: the end part of this interval is
equal with the moment when the new view scope creation but under the hood this is triggered by a system tied to the internal view lifecycle events. More details below in the computation explanation.

gantt
    title Timeline for Interaction-to-Next-View
    dateFormat  HH:mm:ss

    section Interaction-to-Next-View
    User Interaction: des1, 00:00:00, 00:00:00:100  
    View Is Created :done, des2, 00:00:01, 00:00:02
    View Becomes Visible :done, des3, after des2, 00:00:03
    Interaction-to-Next-View Interval :active, des3, 00:00:00, 00:00:03

Loading

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

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)

@mariusc83 mariusc83 self-assigned this Nov 28, 2024
@mariusc83
mariusc83 force-pushed the mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric branch 4 times, most recently from 84f8e24 to 970eee7 Compare November 28, 2024 13:48
@mariusc83
mariusc83 marked this pull request as ready for review November 28, 2024 13:57
@mariusc83
mariusc83 requested review from a team as code owners November 28, 2024 13:57
@codecov-commenter

codecov-commenter commented Nov 28, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.84946% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.01%. Comparing base (f1e298b) to head (d3a512d).
Report is 3 commits behind head on feature/view-loading-times.

Files with missing lines Patch % Lines
...ntonextview/InteractionToNextViewMetricResolver.kt 96.15% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           feature/view-loading-times    #2417      +/-   ##
==============================================================
+ Coverage                       69.87%   70.01%   +0.14%     
==============================================================
  Files                             770      775       +5     
  Lines                           28559    28647      +88     
  Branches                         4793     4805      +12     
==============================================================
+ Hits                            19955    20057     +102     
+ Misses                           7269     7265       -4     
+ Partials                         1335     1325      -10     
Files with missing lines Coverage Δ
...d/rum/internal/domain/scope/RumViewManagerScope.kt 91.57% <100.00%> (+0.26%) ⬆️
.../android/rum/internal/domain/scope/RumViewScope.kt 95.28% <100.00%> (+0.73%) ⬆️
...actiontonextview/ActionTypeInteractionValidator.kt 100.00% <100.00%> (ø)
...nteractiontonextview/InternalInteractionContext.kt 100.00% <100.00%> (ø)
...ontonextview/PreviousViewLastInteractionContext.kt 100.00% <100.00%> (ø)
...actiontonextview/TimeBasedInteractionIdentifier.kt 100.00% <100.00%> (ø)
...ntonextview/InteractionToNextViewMetricResolver.kt 96.15% <96.15%> (ø)

... and 29 files with indirect coverage changes

@mariusc83
mariusc83 force-pushed the mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric branch from 970eee7 to 43a30e3 Compare November 28, 2024 15:47
Comment on lines +112 to +114
// we need to keep at least 10 entries to be able to calculate the metric for consecutive views that
// are going to be created almost in the same time and will rely on the previous view interaction
private const val MAX_ENTRIES = 10

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/ What are the "views created almost in the same time"? Does it mean very short navigation through series of views OR a problem with instrumentation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes...also for views that are already stopped but still request the metric for some view updates. I also want to prepare it for 2 active views later, this logic will support that scenario also.

Comment on lines +62 to +66
internalLogger.log(
InternalLogger.Level.WARN,
InternalLogger.Target.MAINTAINER,
{ "[ViewNetworkSettledMetric] No previous interaction found for this viewId:$viewId" }
)

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/ Won't we always end up here for the initial view (ApplicationLaunch)? If so, this log won't be actionable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

totally true....I guess we can condition this log by checking if there's any interaction yet added in the map, if not this is the applaunch. Good point. Actually added a test about this but never thought to condition the log.

@mariusc83
mariusc83 force-pushed the mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric branch from 43a30e3 to d3a512d Compare November 29, 2024 10:40
@mariusc83
mariusc83 merged commit 614e7c0 into feature/view-loading-times Nov 29, 2024
@mariusc83
mariusc83 deleted the mconstantin/rum-7171/implement-basic-functionality-for-itnv-metric branch November 29, 2024 15:41
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.

4 participants