-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
TracingInstrumentationExtension.kt
72 lines (64 loc) · 2.5 KB
/
TracingInstrumentationExtension.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package io.sentry.android.gradle.extensions
import javax.inject.Inject
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
open class TracingInstrumentationExtension @Inject constructor(objects: ObjectFactory) {
/**
* Enable the tracing instrumentation.
* Does bytecode manipulation for specified [features].
* Defaults to true.
*/
val enabled: Property<Boolean> = objects.property(Boolean::class.java)
.convention(true)
/**
* Enabled debug output of the plugin. Useful when there are issues with code instrumentation,
* shows the modified bytecode.
* Defaults to false.
*/
val debug: Property<Boolean> = objects.property(Boolean::class.java).convention(
false
)
/**
* Forces dependencies instrumentation, even if they were already instrumented.
* Useful when there are issues with code instrumentation, e.g. the dependencies are
* partially instrumented.
* Defaults to false.
*/
val forceInstrumentDependencies: Property<Boolean> = objects.property(Boolean::class.java)
.convention(false)
/**
* Specifies a set of [InstrumentationFeature] features that are eligible for bytecode
* manipulation.
* Defaults to all available features of [InstrumentationFeature].
*/
val features: SetProperty<InstrumentationFeature> =
objects.setProperty(InstrumentationFeature::class.java).convention(
setOf(
InstrumentationFeature.DATABASE,
InstrumentationFeature.FILE_IO,
InstrumentationFeature.OKHTTP
)
)
}
enum class InstrumentationFeature {
/**
* When enabled the SDK will create spans for any CRUD operation performed by 'androidx.sqlite'
* and 'androidx.room'. This feature uses bytecode manipulation.
*/
DATABASE,
/**
* When enabled the SDK will create spans for [java.io.FileInputStream],
* [java.io.FileOutputStream], [java.io.FileReader], [java.io.FileWriter].
* This feature uses bytecode manipulation and replaces the above
* mentioned classes with Sentry-specific implementations.
*/
FILE_IO,
/**
* When enabled the SDK will create spans for outgoing network requests and attach
* sentry-trace-header for distributed tracing.
* This feature uses bytecode manipulation and attaches SentryOkHttpInterceptor to all OkHttp
* clients in the project.
*/
OKHTTP
}