Replace AnalyticsSdkSpanFactory with AnalyticsSdkManager.

`AnalyticsSdkManager` also enables and disables Sentry logging in the SDK based on analytics user content.
This commit is contained in:
Jorge Martín 2025-12-04 10:27:04 +01:00 committed by Jorge Martin Espinosa
parent b31267d7c7
commit 739f12d603
7 changed files with 88 additions and 52 deletions

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.services.analytics.api
/**
* Manager to handle SDK analytics (e.g., Sentry).
*/
interface AnalyticsSdkManager {
/**
* Enable or disable SDK analytics.
*/
fun enableSdkAnalytics(enabled: Boolean)
/**
* Start a new span with the given [name], using [parentTraceId] to optionally attach it to a parent transaction.
*/
fun startSpan(name: String, parentTraceId: String? = null): AnalyticsSdkSpan
/**
* Create a 'bridge' span optionally linking it to a parent trace via [parentTraceId].
*/
fun bridge(parentTraceId: String? = null): AnalyticsSdkSpan
}

View file

@ -1,16 +0,0 @@
/*
* Copyright (c) 2025 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.services.analytics.api
interface AnalyticsSdkSpanFactory {
/** Create an SDK span with the provided [name] and optional [parentTraceId]. */
fun create(name: String, parentTraceId: String?): AnalyticsSdkSpan
/** Create a bridge span which will join our tracing spans to the SDK ones while it's active. */
fun bridge(parentTraceId: String?): AnalyticsSdkSpan
}