fix: Add internal disableJankStats config option#3000
Conversation
refs: RUM-12763 This PR adds a check to RUM feature initialization: if the new internal option `_dd.rum.disable_jank_stats` is explicitly set to true, then we refrain from calling `initializeFrameStatesAggregator()`. Otherwise, we call that function as normal. This allows the Unity SDK to configure the Android SDK in such a way that it will never call `JankStats.createAndTrack()`, which is necessary to avoid crashes caused by the older versions of `androidx.metrics` that the `dd-sdk-unity` is forced to use in older versions of Unity. (I notice that the generated `apiSurface` files are not up to date at latest in develop, so I expect that CI will fail. When I test locally with `./local-ci.sh --test`, everything passes. I can rebase once the unrelated API surface issue is fixed in develop.)
refs: RUM-12764 This PR updates Android RUM initialization logic such that we always set `_dd.rum.disable_jank_stats` to `true` when configuring `dd-sdk-android`. This change depends on [an accompanying dd-sdk-android fix](DataDog/dd-sdk-android#3000), which will need to be released in v2. We'll need to bump the Unity SDK's dd-sdk-android dependency once that release is available.
|
🎯 Code Coverage 🔗 Commit SHA: 63c16f0 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3000 +/- ##
===========================================
- Coverage 71.34% 71.25% -0.09%
===========================================
Files 859 859
Lines 31309 31320 +11
Branches 5275 5276 +1
===========================================
- Hits 22335 22316 -19
- Misses 7505 7528 +23
- Partials 1469 1476 +7
🚀 New features to boost your workflow:
|
|
Looks good to me, but we need to port it to into release branch of v2 |
| // If "_dd.rum.disable_jank_stats" is explicitly set to true, refrain from registering | ||
| // any frame state listeners; if false or not set, proceed normally | ||
| val disableJankStats = configuration.additionalConfig[DD_RUM_DISABLE_JANK_STATS_TAG] | ||
| val allowJankStats = disableJankStats as? Boolean != true |
There was a problem hiding this comment.
RumConfiguration.additionalConfig is something legacy I would say.
I would propose to add the explicit field to RumConfiguration and expose it through internal method which can be called via _RumInternalProxy.
There was a problem hiding this comment.
Gotcha, that makes sense. I've switched to the approach you suggest.
| * Disables JankStats tracking. This flag may be enabled by cross-platform SDKs where | ||
| * native frame metrics are not meaningful. | ||
| */ | ||
| internal fun setDisableJankStats(disable: Boolean): Builder { |
There was a problem hiding this comment.
minor: it can be just disableJankStats, but let's keep it like that, it is only for us anyway.
There was a problem hiding this comment.
btw, probably PR title should be updated, since approach is different now
refs: RUM-12764 This PR updates Android RUM initialization logic such that we always set `_dd.rum.disable_jank_stats` to `true` when configuring `dd-sdk-android`. This change depends on [an accompanying dd-sdk-android fix](DataDog/dd-sdk-android#3000), which will need to be released in v2. We'll need to bump the Unity SDK's dd-sdk-android dependency once that release is available.
refs: RUM-12763
What does this PR do?
This PR adds a check to RUM feature initialization: if the new internal option
_dd.rum.disable_jank_statsis explicitly set to true, then we refrain from callinginitializeFrameStatesAggregator(). Otherwise, we call that function as normal.Motivation
This change allows the Unity SDK to configure the Android SDK in such a way that it will never call
JankStats.createAndTrack(), which is necessary to avoid crashes caused by the older versions ofandroidx.metricsthat thedd-sdk-unityis forced to use in older versions of Unity.Additional Notes
I notice that the generated
apiSurfacefiles are not up to date at latest in develop, so I expect that CI will fail. When I test locally with./local-ci.sh --test, everything passes. I can rebase once the unrelated API surface issue is fixed in develop.Review checklist (to be filled by reviewers)