-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: OY11-846 - Add Session Replay plugin #313
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
23047d7
Add Session Replay plugin
agrognetti 0f81327
Move PluginManager to plugin package
agrognetti 73d6881
Merge branch 'main' into agrognetti/O11Y-846-session-replay-plugin
agrognetti 2cf58ca
Upgrade to LD Android SDK 5.10.0 and Kotlin 2.2.0
agrognetti 7e2e23a
Update BaseApplication.kt
agrognetti e0d377d
Add reset helper and unit tests for PluginManager and SessionReplay
agrognetti 600eadf
Add ObservabilityContext and replace PluginManager with Instrumentati…
agrognetti 0e0707d
Fix potential bugs
agrognetti 8d295c5
Add test case to SessionReplayTest
agrognetti 4bb166e
Update Observability.kt
agrognetti 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
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
15 changes: 15 additions & 0 deletions
15
...android/lib/src/main/kotlin/com/launchdarkly/observability/client/ObservabilityContext.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,15 @@ | ||
| package com.launchdarkly.observability.client | ||
|
|
||
| import android.app.Application | ||
| import com.launchdarkly.logging.LDLogger | ||
| import com.launchdarkly.observability.api.Options | ||
|
|
||
| /** | ||
| * Shared information between plugins. | ||
| */ | ||
| data class ObservabilityContext( | ||
| val sdkKey: String, | ||
| val options: Options, | ||
| val application: Application, | ||
| val logger: LDLogger, | ||
| ) |
10 changes: 10 additions & 0 deletions
10
...d/lib/src/main/kotlin/com/launchdarkly/observability/plugin/InstrumentationContributor.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,10 @@ | ||
| package com.launchdarkly.observability.plugin | ||
| import com.launchdarkly.observability.interfaces.LDExtendedInstrumentation | ||
|
|
||
| /** | ||
| * Plugins can implement this to contribute OpenTelemetry instrumentations that should | ||
| * be installed by the Observability plugin. | ||
| */ | ||
| interface InstrumentationContributor { | ||
| fun provideInstrumentations(): List<LDExtendedInstrumentation> | ||
| } |
48 changes: 48 additions & 0 deletions
48
...rc/main/kotlin/com/launchdarkly/observability/plugin/InstrumentationContributorManager.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,48 @@ | ||
| package com.launchdarkly.observability.plugin | ||
|
|
||
| import com.launchdarkly.sdk.android.LDClient | ||
| import java.util.WeakHashMap | ||
|
|
||
| /** | ||
| * Manages a collection of instrumentation contributors associated with an [com.launchdarkly.sdk.android.LDClient] instance. | ||
| * | ||
| * This object provides a central place to register and retrieve instrumentation contributors for a given LDClient. | ||
| * It uses a [java.util.WeakHashMap] to store contributors, which allows the [com.launchdarkly.sdk.android.LDClient] instances and | ||
| * associated contributors to be garbage collected when they are no longer in use. | ||
| */ | ||
| internal object InstrumentationContributorManager { | ||
agrognetti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| private val contributors = WeakHashMap<LDClient, MutableList<InstrumentationContributor>>() | ||
|
|
||
| /** | ||
| * Adds a [InstrumentationContributor] to the list of contributors associated with the given [LDClient]. | ||
| * | ||
| * If no contributors have been added for the client before, a new list is created. | ||
| * | ||
| * @param client The [LDClient] to associate the contributor with. | ||
| * @param contributor The [InstrumentationContributor] to add. | ||
| */ | ||
| fun add(client: LDClient, contributor: InstrumentationContributor) { | ||
| synchronized(contributors) { | ||
| contributors.getOrPut(client) { mutableListOf() }.add(contributor) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Retrieves a list of [InstrumentationContributor]s associated with the given [LDClient]. | ||
| * | ||
| * The returned list is a snapshot and is safe to iterate over. | ||
| * | ||
| * @param client The [LDClient] to get the contributors for. | ||
| * @return A list of [InstrumentationContributor]s, or empty if no contributors are associated with the client. | ||
| */ | ||
| fun get(client: LDClient): List<InstrumentationContributor> = synchronized(contributors) { | ||
| contributors[client]?.toList().orEmpty() | ||
| } | ||
|
|
||
| /** | ||
| * Clears all contributor registrations. | ||
| */ | ||
| fun reset() = synchronized(contributors) { | ||
| contributors.clear() | ||
| } | ||
| } | ||
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.