File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
e2e/android/app/src/main/java/com/example/androidobservability
sdk/@launchdarkly/observability-android/lib Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ class MainActivity : ComponentActivity() {
7272 ) {
7373 Text (" Trigger Stop Span" )
7474 }
75+ Button (
76+ onClick = {
77+ viewModel.triggerCrash()
78+ }
79+ ) {
80+ Text (" Trigger Crash" )
81+ }
7582 }
7683 }
7784 }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import io.opentelemetry.api.common.AttributeKey
88import io.opentelemetry.api.common.Attributes
99import io.opentelemetry.api.logs.Severity
1010import io.opentelemetry.api.trace.Span
11+ import java.net.SocketTimeoutException
1112
1213class ViewModel : ViewModel () {
1314
@@ -44,4 +45,8 @@ class ViewModel : ViewModel() {
4445 lastSpan?.end()
4546 lastSpan = null
4647 }
48+
49+ fun triggerCrash () {
50+ throw RuntimeException (" Failed to connect to bogus server." )
51+ }
4752}
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ dependencies {
3535 implementation(" io.opentelemetry.android.instrumentation:activity:0.11.0-alpha" )
3636 implementation(" io.opentelemetry.android:session:0.11.0-alpha" )
3737
38+ // Android crash instrumentation
39+ implementation(" io.opentelemetry.android.instrumentation:crash:0.11.0-alpha" )
40+
3841 // Use JUnit Jupiter for testing.
3942 testImplementation(" org.junit.jupiter:junit-jupiter" )
4043 testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
You can’t perform that action at this time.
0 commit comments