-
Notifications
You must be signed in to change notification settings - Fork 1
feat: adds configuration options to Android observability plugin #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tanderson-ld
merged 10 commits into
main
from
ta/O11Y-360/obs-android-configuration-api
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
07de899
wip
tanderson-ld 7fcd845
wip
tanderson-ld 753cd9d
wip
tanderson-ld c63e169
wip
tanderson-ld 37f04ac
feat: adds configuration options to Android observability plugin
tanderson-ld 59bb31d
self review
tanderson-ld 4c10bea
Merge remote-tracking branch 'origin' into ta/O11Y-360/obs-android-co…
tanderson-ld 207b0b8
ci: reverting Android dry-run publish
tanderson-ld 92847ad
Update sdk/@launchdarkly/observability-android/lib/src/main/kotlin/co…
tanderson-ld 84e1bc8
adding timber dep
tanderson-ld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...y/observability-android/lib/src/main/kotlin/com/launchdarkly/observability/api/Options.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.launchdarkly.observability.api | ||
|
||
import com.launchdarkly.logging.LDLogAdapter | ||
import com.launchdarkly.observability.BuildConfig | ||
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" | ||
|
||
/** | ||
* Configuration options for the Observability plugin. | ||
* | ||
* @property serviceName The service name for the application. Defaults to the app package name if not set. | ||
* @property serviceVersion The version of the service. Defaults to the app version if not set. | ||
* @property otlpEndpoint The OTLP exporter endpoint. Defaults to LaunchDarkly endpoint. | ||
* @property backendUrl The backend URL for non-OTLP operations. Defaults to LaunchDarkly url. | ||
* @property resourceAttributes Additional resource attributes to include in telemetry data. | ||
* @property customHeaders Custom headers to include with OTLP exports. | ||
* @property sessionBackgroundTimeout Session timeout if app is backgrounded. Defaults to 15 minutes. | ||
* @property debug Enables verbose telemetry logging if true as well as other debug functionality. Defaults to false. | ||
* @property disableErrorTracking Disables error tracking if true. Defaults to false. | ||
* @property disableLogs Disables logs if true. Defaults to false. | ||
* @property disableTraces Disables traces if true. Defaults to false. | ||
* @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". | ||
*/ | ||
data class Options( | ||
val serviceName: String = "observability-android", | ||
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" | ||
tanderson-ld marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.