Skip to content

[RUM-8875] Add ability to manually add an activity to JankStats#2524

Merged
fuzzybinary merged 2 commits into
developfrom
jward/RUM-8875-manual-jank-stats-add
Mar 6, 2025
Merged

[RUM-8875] Add ability to manually add an activity to JankStats#2524
fuzzybinary merged 2 commits into
developfrom
jward/RUM-8875-manual-jank-stats-add

Conversation

@fuzzybinary

Copy link
Copy Markdown
Member

What does this PR do?

Add a method to AdvancedRumMonitor to manually add an activity to JankStats tracking so that we can get framerate information.

Motivation

Unity's main activity is started prior to initializing Datadog, so it misses adding the Activity to JankStats tracking.

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)

@fuzzybinary
fuzzybinary requested review from a team as code owners March 5, 2025 14:36
@fuzzybinary
fuzzybinary force-pushed the jward/RUM-8875-manual-jank-stats-add branch from 5afa3fb to e36ff19 Compare March 5, 2025 14:38
Unity's main activity is started prior to initializing Datadog, so it misses adding the Activity to JankStats tracking. Add an internal method to allow manually adding an activity to JankStats tracking.
@fuzzybinary
fuzzybinary force-pushed the jward/RUM-8875-manual-jank-stats-add branch from e36ff19 to 231e760 Compare March 5, 2025 14:59

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

lgtm, left few minor comments

Comment on lines +389 to +398
try {
jankStatsActivityLifecycleListener?.onActivityStarted(activity)
} catch (@Suppress("TooGenericExceptionCaught") e: Exception) {
sdkCore.internalLogger.log(
InternalLogger.Level.ERROR,
InternalLogger.Target.TELEMETRY,
{ FAILED_TO_ENABLE_JANK_STATS_TRACKING_MANUALLY },
e
)
}

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.

which exception do we expect here? or it is just a generic safeguard, just in case?

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.

Generic safeguard. Detekt complained about it, and instead of suppressing it I thought it would be better to catch and log.

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.

To be clearer, Detekt complained about onActivityStarted being unsafe.

0xnm
0xnm previously approved these changes Mar 5, 2025
Co-authored-by: Nikita Ogorodnikov <[email protected]>
@fuzzybinary
fuzzybinary force-pushed the jward/RUM-8875-manual-jank-stats-add branch from 3187ddf to bdddd22 Compare March 5, 2025 19:28
@codecov-commenter

codecov-commenter commented Mar 5, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 30.76923% with 9 lines in your changes missing coverage. Please review.

Project coverage is 70.08%. Comparing base (146a8c9) to head (bdddd22).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
...lin/com/datadog/android/rum/internal/RumFeature.kt 12.50% 6 Missing and 1 partial ⚠️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 33.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2524      +/-   ##
===========================================
- Coverage    70.09%   70.08%   -0.01%     
===========================================
  Files          796      796              
  Lines        29957    29972      +15     
  Branches      5012     5013       +1     
===========================================
+ Hits         20997    21004       +7     
- Misses        7569     7583      +14     
+ Partials      1391     1385       -6     
Files with missing lines Coverage Δ
...otlin/com/datadog/android/rum/_RumInternalProxy.kt 75.00% <100.00%> (+1.67%) ⬆️
...ernal/vitals/JankStatsActivityLifecycleListener.kt 71.01% <100.00%> (+0.21%) ⬆️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 86.21% <33.33%> (+0.45%) ⬆️
...lin/com/datadog/android/rum/internal/RumFeature.kt 91.72% <12.50%> (-1.42%) ⬇️

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

@fuzzybinary
fuzzybinary merged commit a9007ed into develop Mar 6, 2025
@fuzzybinary
fuzzybinary deleted the jward/RUM-8875-manual-jank-stats-add branch March 6, 2025 13:48
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