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-7107 feat: Add Interaction To Next View metric in RUM #2153

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Dec 18, 2024

What and why?

📦⏱️ This PR introduces the Interaction-to-Next-View (ITNV) metric to measure the time between the last action in a previous view and the moment the next view is started. This metric provides valuable insights into the time it takes for a view to be prepared and displayed after user interaction.

The ITNV value is reported under the following conditions:

  • The value is tracked only if a .tap, .click, or .swipe action occurred in the previous view, and the time between the last action and the start of the next view is less than 3 seconds
  • For .tap and .click, the measurement starts at the action's start time.
  • For .swipe, the measurement starts at the action's end time.

Example: In the scenario below, A2 is the last action in the "Previous View." It’s a .tap action that occurs less than 3 seconds before the "Next View" starts. The ITNV value for "Next View" is calculated as the time from when the action starts to when the next view starts:

Screenshot 2024-12-18 at 11 32 51

The ITNV value is reported in the view.interaction_to_next_view_time attribute, in nanoseconds.

This is the counterpart to Android PR #2417.

How?

The metric is modeled as an object implementing the ITNVMetricTracking interface, which tracks key events (action, view start, and view completion) and provides a method to retrieve the ITNV value:

internal protocol ITNVMetricTracking {
    func trackAction(startTime: Date, endTime: Date, actionType: RUMActionType, in viewID: RUMUUID)
    func trackViewStart(at viewStart: Date, viewID: RUMUUID)
    func trackViewComplete(viewID: RUMUUID)
    func value(for viewID: RUMUUID) -> TimeInterval?
}

The ITNV metric object is created and managed by RUMSessionScope, enabling it to track actions and views throughout the session. When a view or action starts, a reference to this object is passed to the respective RUM scopes, allowing key events to be tracked via the interface.

This design aligns with the solution implemented for the TTNS metric in #2125

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs (see our guidelines [internal]) and run make api-surface)

@ncreated ncreated self-assigned this Dec 18, 2024
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 18, 2024

Datadog Report

Branch report: feature/RUM-7107/vl-itnv-basics
Commit report: d26e770
Test service: dd-sdk-ios

✅ 0 Failed, 461 Passed, 3218 Skipped, 34.35s Total duration (1m 55.22s time saved)

@ncreated ncreated force-pushed the feature/RUM-7107/vl-itnv-basics branch from 0381406 to 8b2a25a Compare December 18, 2024 13:36
@ncreated ncreated marked this pull request as ready for review December 18, 2024 15:30
@ncreated ncreated requested review from a team as code owners December 18, 2024 15:30
Copy link
Contributor

@simaoseica-dd simaoseica-dd left a comment

Choose a reason for hiding this comment

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

Great job!

@ncreated ncreated merged commit bf43041 into feature/view-loading-times Dec 30, 2024
14 checks passed
@ncreated ncreated deleted the feature/RUM-7107/vl-itnv-basics branch December 30, 2024 12:40
@maxep maxep mentioned this pull request Feb 5, 2025
4 tasks
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.

2 participants