-
Notifications
You must be signed in to change notification settings - Fork 85
RUM-18142: Add setAnrTriggerEnabled opt-out API for ANR-triggered profiling #3729
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,9 @@ internal class PerfettoProfiler( | |
| profilingTelemetry.internalLogger = value | ||
| } | ||
|
|
||
| @Volatile | ||
| internal var anrTriggerEnabled: Boolean = true | ||
|
ambushwork marked this conversation as resolved.
|
||
|
|
||
| internal val anrListener = AnrListener { event -> | ||
| callback?.onAnrDetected(event) | ||
| } | ||
|
|
@@ -253,7 +256,7 @@ internal class PerfettoProfiler( | |
| ) { | ||
| synchronized(this) { | ||
| this.callback = callback | ||
| if (buildSdkVersionProvider.isAtLeastBaklava) { | ||
| if (buildSdkVersionProvider.isAtLeastBaklava && anrTriggerEnabled) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we going to consume the actual profile in another PR?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't consume it until the system trace support is deployed on profiling-backend.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but I don't think it makes sense to ship this PR alone, without consuming profile.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well this API currently just provides a way to opt-out the trigger registration, but indeed exposing the API might be misleading. we can put this on hold since it doesn't block any incoming development. |
||
| anrTriggerRegistrar.register(appContext, anrListener) | ||
| } | ||
| } | ||
|
|
@@ -262,7 +265,7 @@ internal class PerfettoProfiler( | |
| override fun unregisterProfilingCallback(appContext: Context) { | ||
| synchronized(this) { | ||
| callback = null | ||
| if (buildSdkVersionProvider.isAtLeastBaklava) { | ||
| if (buildSdkVersionProvider.isAtLeastBaklava && anrTriggerEnabled) { | ||
| anrTriggerRegistrar.unregister(appContext) | ||
| } | ||
| } | ||
|
|
@@ -272,6 +275,10 @@ internal class PerfettoProfiler( | |
| this.extendLaunchSession = extend | ||
| } | ||
|
|
||
| override fun setAnrTriggerEnabled(enabled: Boolean) { | ||
| this.anrTriggerEnabled = enabled | ||
| } | ||
|
|
||
| override fun resolveProfilingPackageVersionCode(appContext: Context) { | ||
| profilingPackageVersionCode(appContext) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
enableAnrTriggerto be consistent with similar APIs that enable/disable something? but probably we don't have strict consistency anyway