Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.launchdarkly.sdk.android.Components
import com.launchdarkly.sdk.android.LDClient
import com.launchdarkly.sdk.android.LDConfig
import com.launchdarkly.observability.plugin.Observability
import com.launchdarkly.observability.replay.ReplayInstrumentation
import com.launchdarkly.sdk.android.LDAndroidLogging
import com.launchdarkly.sdk.android.integrations.Plugin
import io.opentelemetry.api.common.AttributeKey
Expand All @@ -29,6 +30,10 @@ open class BaseApplication : Application() {
),
debug = true,
logAdapter = LDAndroidLogging.adapter(),
// TODO: consider these being factories so that the obs plugin can pass instantiation data, log adapter
instrumentations = listOf(
ReplayInstrumentation()
),
)

var telemetryInspector: TelemetryInspector? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ package com.example.androidobservability

import android.app.Application
import androidx.test.core.app.ApplicationProvider
import com.example.androidobservability.TestUtils.TelemetryType
import com.example.androidobservability.TestUtils.waitForTelemetryData
import com.launchdarkly.observability.api.Options
import com.launchdarkly.observability.interfaces.Metric
import com.launchdarkly.observability.sdk.LDObserve
import io.opentelemetry.api.common.AttributeKey
import io.opentelemetry.api.common.Attributes
import io.opentelemetry.api.logs.Severity
import com.example.androidobservability.TestUtils.TelemetryType
import com.launchdarkly.observability.api.Options
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertFalse
import junit.framework.TestCase.assertNotNull
import junit.framework.TestCase.assertNull
import junit.framework.TestCase.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -96,7 +95,6 @@ class DisablingConfigOptionsE2ETest {
LDObserve.flush()
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.METRICS)

assertNull(application.telemetryInspector?.metricExporter)
assertFalse(requestsContainsUrl(metricsUrl))
}

Expand All @@ -110,7 +108,6 @@ class DisablingConfigOptionsE2ETest {
LDObserve.flush()
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.METRICS)

assertNotNull(application.telemetryInspector?.metricExporter)
assertTrue(requestsContainsUrl(metricsUrl))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ dependencies {
// Android crash instrumentation
implementation("io.opentelemetry.android.instrumentation:crash:0.11.0-alpha")

// TODO: O11Y-626 - move replay instrumentation and associated compose dependencies into dedicated package
// Compose dependencies for capture functionality
implementation("androidx.compose.ui:ui:1.7.5")
implementation("androidx.compose.ui:ui-tooling:1.7.5")

// Use JUnit Jupiter for testing.
testImplementation(platform("org.junit:junit-bom:5.13.4"))
testImplementation("org.junit.jupiter:junit-jupiter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package com.launchdarkly.observability.api

import com.launchdarkly.logging.LDLogAdapter
import com.launchdarkly.observability.BuildConfig
import com.launchdarkly.observability.interfaces.LDExtendedInstrumentation
import com.launchdarkly.sdk.android.LDTimberLogging
import io.opentelemetry.api.common.Attributes
import kotlin.time.Duration
import kotlin.time.Duration.Companion.minutes

private const val DEFAULT_OTLP_ENDPOINT = "https://otel.observability.app.launchdarkly.com:4318"
private const val DEFAULT_BACKEND_URL = "https://pub.observability.app.launchdarkly.com"
const val DEFAULT_SERVICE_NAME = "observability-android"
const val DEFAULT_OTLP_ENDPOINT = "https://otel.observability.app.launchdarkly.com:4318"
const val DEFAULT_BACKEND_URL = "https://pub.observability.app.launchdarkly.com"

/**
* Configuration options for the Observability plugin.
Expand All @@ -27,21 +29,23 @@ private const val DEFAULT_BACKEND_URL = "https://pub.observability.app.launchdar
* @property disableMetrics Disables metrics if true. Defaults to false.
* @property logAdapter The log adapter to use. Defaults to using the LaunchDarkly SDK's LDTimberLogging.adapter(). Use LDAndroidLogging.adapter() to use the Android logging adapter.
* @property loggerName The name of the logger to use. Defaults to "LaunchDarklyObservabilityPlugin".
* @property instrumentations List of additional instrumentations to use
*/
data class Options(
val serviceName: String = "observability-android",
val serviceName: String = DEFAULT_SERVICE_NAME,
val serviceVersion: String = BuildConfig.OBSERVABILITY_SDK_VERSION,
val otlpEndpoint: String = DEFAULT_OTLP_ENDPOINT,
val backendUrl: String = DEFAULT_BACKEND_URL,
val resourceAttributes: Attributes = Attributes.empty(),
val customHeaders: Map<String, String> = emptyMap(),
val sessionBackgroundTimeout: Duration = 15.minutes,
val debug: Boolean = false,
// TODO O11Y-398: implement disable config options after all other instrumentations are implemented
val disableErrorTracking: Boolean = false,
val disableLogs: Boolean = false,
val disableTraces: Boolean = false,
val disableMetrics: Boolean = false,
val logAdapter: LDLogAdapter = LDTimberLogging.adapter(), // this follows the LaunchDarkly SDK's default log adapter
val loggerName: String = "LaunchDarklyObservabilityPlugin"
val loggerName: String = "LaunchDarklyObservabilityPlugin",
// TODO: update this to provide a list of factories instead of instances
val instrumentations: List<LDExtendedInstrumentation> = emptyList()
)
Loading
Loading