Skip to content

Commit

Permalink
wire session instrumentation up in demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk committed Dec 11, 2024
1 parent 67fb99e commit 30c6ef8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion demo-app/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ dependencyResolutionManagement {
google()
}
}
includeBuild("..")
includeBuild("..") {
dependencySubstitution {
substitute(module("io.opentelemetry.android:android-agent"))
.using(project(":android-agent"))
substitute(module("io.opentelemetry.android:instrumentation-sessions"))
.using(project(":instrumentation:sessions"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 30c6ef8

Please sign in to comment.