-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat(instrumentation): Add binder IPC call tracing #1159
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: main
Are you sure you want to change the base?
Changes from all commits
0cf9ca8
84cae2a
2a204f6
5e505fd
c88ce04
6f571dc
ebdabca
64e8f33
7ebb52a
ce9013d
c99a18d
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package io.sentry.android.gradle.extensions | ||
|
|
||
| import javax.inject.Inject | ||
| import org.gradle.api.model.ObjectFactory | ||
| import org.gradle.api.provider.Property | ||
|
|
||
| open class BinderExtension @Inject constructor(objects: ObjectFactory) { | ||
| /** | ||
| * Enables or disables Binder IPC call instrumentation. Defaults to true. This requires | ||
| * sentry-android-core version TODO or above, and needs to be enabled. See | ||
|
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. h: TODO (same below) (though I'm sure they're on your radar)
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. l: Should we remove the "and needs to be enabled" since we enable it by default, or is that phrase referring to something else? |
||
| * https://docs.sentry.io/platforms/android/configuration/gradle/#tracing-auto-instrumentation for | ||
| * more details. | ||
| */ | ||
| val enabled: Property<Boolean> = objects.property(Boolean::class.java).convention(true) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package io.sentry.android.gradle.instrumentation.binder | ||
|
|
||
| import com.android.build.api.instrumentation.ClassContext | ||
| import io.sentry.android.gradle.instrumentation.ClassInstrumentable | ||
| import io.sentry.android.gradle.instrumentation.CommonClassVisitor | ||
| import io.sentry.android.gradle.instrumentation.SpanAddingClassVisitorFactory | ||
| import io.sentry.android.gradle.instrumentation.util.isSentryClass | ||
| import org.objectweb.asm.ClassVisitor | ||
|
|
||
| class Binder : ClassInstrumentable { | ||
|
|
||
| companion object { | ||
| private const val CLASSNAME = "Binder" | ||
| } | ||
|
|
||
| override fun getVisitor( | ||
| instrumentableContext: ClassContext, | ||
| apiVersion: Int, | ||
| originalVisitor: ClassVisitor, | ||
| parameters: SpanAddingClassVisitorFactory.SpanAddingParameters, | ||
| ): ClassVisitor { | ||
| return CommonClassVisitor( | ||
| apiVersion, | ||
| originalVisitor, | ||
| CLASSNAME, | ||
| listOf(BinderMethodInstrumentable()), | ||
| parameters, | ||
| ) | ||
| } | ||
|
|
||
| override fun isInstrumentable(data: ClassContext) = !data.isSentryClass() | ||
| } | ||
|
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. m: Any concerns about impact on build time? Our hash map lookups are fast, and I see we also perform the same scan for logging, etc., so the effect will be incremental for anyone who hasn't disabled the defaults. Not a blocker, just making sure we considered it + curious to hear how we think about these sorts of scans (eg, okay to add indefinitely b/c cost is marginal vs something we weigh carefully each time out). |
||
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.
l: Do we normally also tell folks how to enable/disable (+ inform them that it's auto-enabled)?