From 30c6ef8d0d4ed47bf9fd66486122ec13baef4722 Mon Sep 17 00:00:00 2001 From: Jason Plumb Date: Tue, 10 Dec 2024 17:37:32 -0800 Subject: [PATCH] wire session instrumentation up in demo app --- demo-app/build.gradle.kts | 1 + demo-app/settings.gradle.kts | 9 ++++++++- .../io/opentelemetry/android/demo/OtelDemoApplication.kt | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/demo-app/build.gradle.kts b/demo-app/build.gradle.kts index a7246496d..e89984a6e 100644 --- a/demo-app/build.gradle.kts +++ b/demo-app/build.gradle.kts @@ -67,6 +67,7 @@ dependencies { coreLibraryDesugaring(libs.desugarJdkLibs) implementation("io.opentelemetry.android:android-agent") //parent dir + implementation("io.opentelemetry.android:instrumentation-sessions") implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) diff --git a/demo-app/settings.gradle.kts b/demo-app/settings.gradle.kts index 3f3fc66ab..c3244f09b 100644 --- a/demo-app/settings.gradle.kts +++ b/demo-app/settings.gradle.kts @@ -19,4 +19,11 @@ dependencyResolutionManagement { google() } } -includeBuild("..") \ No newline at end of file +includeBuild("..") { + dependencySubstitution { + substitute(module("io.opentelemetry.android:android-agent")) + .using(project(":android-agent")) + substitute(module("io.opentelemetry.android:instrumentation-sessions")) + .using(project(":instrumentation:sessions")) + } +} \ No newline at end of file diff --git a/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt b/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt index 1dadceeb5..c02c5cd73 100644 --- a/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt +++ b/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt @@ -12,6 +12,7 @@ import io.opentelemetry.android.OpenTelemetryRum import io.opentelemetry.android.OpenTelemetryRumBuilder import io.opentelemetry.android.config.OtelRumConfig import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration +import io.opentelemetry.android.instrumentation.sessions.SessionInstrumentation import io.opentelemetry.api.common.AttributeKey.stringKey import io.opentelemetry.api.common.Attributes import io.opentelemetry.api.incubator.events.EventBuilder @@ -55,6 +56,8 @@ class OtelDemoApplication : Application() { .setEndpoint(logsIngestUrl) .build() } + // TODO: This should NOT be necessary if it's in the runtime classpath... + .addInstrumentation(SessionInstrumentation()) try { rum = otelRumBuilder.build() Log.d(TAG, "RUM session started: " + rum!!.rumSessionId)