Skip to content

[RUM-8061] RUM View Ended Telemetry now includes TNS and INV#2495

Merged
satween merged 7 commits into
developfrom
tvaleev/rum-8061
Feb 3, 2025
Merged

[RUM-8061] RUM View Ended Telemetry now includes TNS and INV#2495
satween merged 7 commits into
developfrom
tvaleev/rum-8061

Conversation

@satween

@satween satween commented Jan 28, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds mandatory telemetry events for TTNS and ITNV

Spec

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 January 28, 2025 18:17
@codecov-commenter

codecov-commenter commented Jan 28, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 96.31579% with 7 lines in your changes missing coverage. Please review.

Project coverage is 70.11%. Comparing base (6c54695) to head (2f6ed12).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
...d/rum/internal/metric/ViewEndedMetricDispatcher.kt 94.83% 1 Missing and 2 partials ⚠️
...ntonextview/InteractionToNextViewMetricResolver.kt 95.12% 1 Missing and 1 partial ⚠️
...ric/networksettled/NetworkSettledMetricResolver.kt 92.86% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2495      +/-   ##
===========================================
+ Coverage    69.95%   70.11%   +0.16%     
===========================================
  Files          788      791       +3     
  Lines        29647    29795     +148     
  Branches      4962     4987      +25     
===========================================
+ Hits         20739    20889     +150     
+ Misses        7536     7526      -10     
- Partials      1372     1380       +8     
Files with missing lines Coverage Δ
.../datadog/android/rum/internal/domain/RumContext.kt 100.00% <100.00%> (ø)
...d/rum/internal/domain/scope/RumViewManagerScope.kt 91.75% <100.00%> (+1.09%) ⬆️
.../android/rum/internal/domain/scope/RumViewScope.kt 94.61% <100.00%> (-0.09%) ⬇️
...g/android/rum/internal/domain/scope/RumViewType.kt 100.00% <100.00%> (ø)
.../internal/metric/ViewInitializationMetricsState.kt 100.00% <100.00%> (ø)
...android/rum/internal/vitals/VitalReaderRunnable.kt 100.00% <100.00%> (ø)
...actiontonextview/TimeBasedInteractionIdentifier.kt 91.67% <100.00%> (+0.76%) ⬆️
...tworksettled/TimeBasedInitialResourceIdentifier.kt 91.67% <100.00%> (+0.76%) ⬆️
...ntonextview/InteractionToNextViewMetricResolver.kt 94.52% <95.12%> (-1.63%) ⬇️
...ric/networksettled/NetworkSettledMetricResolver.kt 94.20% <92.86%> (+1.52%) ⬆️
... and 1 more

... and 23 files with indirect coverage changes

xgouchet
xgouchet previously approved these changes Jan 29, 2025
Comment on lines +834 to +836
networkSettledMetricResolver.viewWasStopped()

viewEndedMetricDispatcher.sendViewEnded(

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.

Is it intentional that we are using a different lingvo: ended vs stopped? Shouldn't we align?

View may be stopped, but still be in the list of the scopes (but not active ones), waiting for the child scopes to finish.

Once all childs scopes finish, the view is considered as complete (see

private fun isViewComplete(): Boolean {
val pending = pendingActionCount +
pendingResourceCount +
pendingErrorCount +
pendingLongTaskCount
// we use <= 0 for pending counter as a safety measure to make sure this ViewScope will
// be closed.
return stopped && activeResourceScopes.isEmpty() && (pending <= 0L)
}
).

Is ended here an equivalent of stopped or complete?

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.

Nice catch here - changes followed from this note lead me to found potential issue.
The ended here comes from metric name rather than android sdk notation so I prefer to keep it as it is ( to be aligned with SessionEndedMetric), but entire method call now checks for child scopes

)

val viewEndedMetricDispatcher = ViewEndedMetricDispatcher(
viewType = ViewMetricDispatcher.ViewType.CUSTOM,

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.

shouldn't we inherit it as an argument of fromEvent call and it is up to the caller to provide a relevant value?

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.

I found that there is RumViewType enum that does actually the same so removed duplication and reusing RumViewType instead. There is no reason to get the value from method parameters because RumViewType is not provided at this moment, but thanks for spotting - it helped to reduce code duplication

jonathanmos
jonathanmos previously approved these changes Jan 30, 2025

@ncreated ncreated 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 only validated the spec values, finding a problem around loading_time key - requesting a change. Other that this, it looks very good, well done 🙂 💪.

@satween
satween dismissed stale reviews from jonathanmos and xgouchet via fae6587 January 30, 2025 17:11
@satween
satween requested review from 0xnm and ncreated January 30, 2025 17:32

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

Looks good to me 👍

@satween
satween merged commit 056dc01 into develop Feb 3, 2025
@satween
satween deleted the tvaleev/rum-8061 branch February 3, 2025 10:25
Comment on lines +89 to +101
// Second, if there is no previous view information, we are either on the very first screen of the app or
// lost the previous view information for some reason
val previousViewId = resolvePreviousViewId(viewId)
?: return NoValueReason.InteractionToNextView.NO_PREVIOUS_VIEW

// Third - the case where there is no interaction from the previous view.
if (lastInteractions[previousViewId] == null) {
return NoValueReason.InteractionToNextView.NO_ACTION
}
return null

// Finally - checking that the previous view interaction is eligible
resolveLastInteraction(previousViewId, currentViewCreatedTimestamp)
?: return NoValueReason.InteractionToNextView.NO_ELIGIBLE_ACTION

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.

There is a corner case when view ID may change if session ID has changed

if (parentContext.sessionId != sessionId) {
sessionId = parentContext.sessionId
viewId = UUID.randomUUID().toString()
}
, but it is hard to address it anyway.

@plousada plousada changed the title RUM View Ended" Telemetry [RUM-8098] RUM View Ended" Telemetry Feb 3, 2025
@plousada plousada changed the title [RUM-8098] RUM View Ended" Telemetry RUM View Ended" Telemetry Feb 3, 2025
@plousada plousada changed the title RUM View Ended" Telemetry [RUM-8061] RUM View Ended Telemetry now includes TNS and INV Feb 3, 2025
@satween satween mentioned this pull request Feb 6, 2025
3 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.

6 participants