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-7174 Introduce the setNetworkSettledInitialResourceIdentifier API #2424

Open
wants to merge 2 commits into
base: feature/view-loading-times
Choose a base branch
from

Conversation

mariusc83
Copy link
Member

@mariusc83 mariusc83 commented Dec 2, 2024

What does this PR do?

Following the RFC we are introducing the setNetworkSettledInitialResourceIdentifier API as part of the RumConfiguration#Builder in order to provide external control on which resource started in a view will be take part
in the time-to-network-settled metric computation. The default identifier being used is a TimeBasedResourceIdentifier with a default threshold set to 100ms. This could be re - used by our users in the Configuration Builder by changing the time interval to their internal needs.

In addition to this this PR contain a small but very important fix in the RumViewScope where we make sure the NetworkSettledMetricResolver is notified for the view stopped only if the event was sent for the current view and only once.

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 Dec 2, 2024
@mariusc83 mariusc83 force-pushed the mconstantin/rum-7174/add-timing-strategy-for-ttns-requests-identification branch from 8f6c29d to dd94ef2 Compare December 2, 2024 14:29
@mariusc83 mariusc83 changed the title RUM-7174 Introduce the setNetworkSettledInitialResourceIdentifier Pub… RUM-7174 Introduce the setNetworkSettledInitialResourceIdentifier API Dec 2, 2024
@mariusc83 mariusc83 force-pushed the mconstantin/rum-7174/add-timing-strategy-for-ttns-requests-identification branch from dd94ef2 to a151145 Compare December 2, 2024 14:52
@mariusc83 mariusc83 marked this pull request as ready for review December 2, 2024 14:56
@mariusc83 mariusc83 requested review from a team as code owners December 2, 2024 14:56
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.11%. Comparing base (614e7c0) to head (85893e3).

Files with missing lines Patch % Lines
...tworksettled/TimeBasedInitialResourceIdentifier.kt 90.91% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           feature/view-loading-times    #2424      +/-   ##
==============================================================
+ Coverage                       69.96%   70.11%   +0.15%     
==============================================================
  Files                             775      775              
  Lines                           28647    28676      +29     
  Branches                         4805     4807       +2     
==============================================================
+ Hits                            20042    20105      +63     
+ Misses                           7277     7251      -26     
+ Partials                         1328     1320       -8     
Files with missing lines Coverage Δ
...rum/src/main/kotlin/com/datadog/android/rum/Rum.kt 92.31% <100.00%> (+0.15%) ⬆️
...kotlin/com/datadog/android/rum/RumConfiguration.kt 96.92% <100.00%> (+0.10%) ⬆️
...lin/com/datadog/android/rum/internal/RumFeature.kt 92.98% <100.00%> (+0.43%) ⬆️
...d/rum/internal/domain/scope/RumApplicationScope.kt 94.85% <100.00%> (+0.16%) ⬆️
...droid/rum/internal/domain/scope/RumSessionScope.kt 96.67% <100.00%> (+0.03%) ⬆️
...d/rum/internal/domain/scope/RumViewManagerScope.kt 91.95% <100.00%> (+0.39%) ⬆️
.../android/rum/internal/domain/scope/RumViewScope.kt 95.16% <100.00%> (+0.41%) ⬆️
...ric/networksettled/NetworkSettledMetricResolver.kt 97.37% <ø> (ø)
.../android/rum/internal/monitor/DatadogRumMonitor.kt 85.57% <100.00%> (+0.43%) ⬆️
...ic/networksettled/NetworkSettledResourceContext.kt 100.00% <100.00%> (ø)
... and 1 more

... and 25 files with indirect coverage changes

* a threshold of 100ms.
* @param initialResourceIdentifier the [InitialResourceIdentifier] to use.
*/
fun setNetworkSettledInitialResourceIdentifier(initialResourceIdentifier: InitialResourceIdentifier): Builder {
Copy link
Member

Choose a reason for hiding this comment

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

Note

This function's name is a bit long, maybe we can rename it to setInitialResourceIdentifier?

@@ -127,6 +130,7 @@ internal class RumFeature(
private var anrDetectorExecutorService: ExecutorService? = null
internal var anrDetectorRunnable: ANRDetectorRunnable? = null
internal lateinit var appContext: Context
internal var networkSettledInitialResourceIdentifier: InitialResourceIdentifier = NoOpInitialResourceIdentifier()
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

@@ -33,7 +34,8 @@ internal class RumApplicationScope(
private val memoryVitalMonitor: VitalMonitor,
private val frameRateVitalMonitor: VitalMonitor,
private val sessionEndedMetricDispatcher: SessionMetricDispatcher,
private val sessionListener: RumSessionListener?
private val sessionListener: RumSessionListener?,
private val networkSettledResourceIdentifier: InitialResourceIdentifier
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

@@ -37,6 +38,7 @@ internal class RumSessionScope(
frameRateVitalMonitor: VitalMonitor,
private val sessionListener: RumSessionListener?,
applicationDisplayed: Boolean,
networkSettledResourceIdentifier: InitialResourceIdentifier,
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

@@ -40,6 +42,7 @@ internal class RumViewManagerScope(
private val frameRateVitalMonitor: VitalMonitor,
internal var applicationDisplayed: Boolean,
internal val sampleRate: Float,
internal val networkSettledResourceIdentifier: InitialResourceIdentifier,
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

@@ -62,8 +63,7 @@ internal open class RumViewScope(
private val trackFrustrations: Boolean,
internal val sampleRate: Float,
private val interactionToNextViewMetricResolver: InteractionToNextViewMetricResolver,
private val networkSettledMetricResolver: NetworkSettledMetricResolver =
NetworkSettledMetricResolver(internalLogger = sdkCore.internalLogger)
private val networkSettledMetricResolver: NetworkSettledMetricResolver
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

@@ -70,7 +71,8 @@ internal class DatadogRumMonitor(
memoryVitalMonitor: VitalMonitor,
frameRateVitalMonitor: VitalMonitor,
sessionListener: RumSessionListener,
internal val executorService: ExecutorService
internal val executorService: ExecutorService,
internal val networkSettledResourceIdentifier: InitialResourceIdentifier
Copy link
Member

Choose a reason for hiding this comment

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

Note

Same, maybe we can rename this property to initialResourceIdentifier.

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