Distinguish between indexable and non-indexable extra data
This commit is contained in:
parent
5c6fee08fd
commit
7fe3b18699
10 changed files with 69 additions and 11 deletions
|
|
@ -8,14 +8,47 @@
|
|||
package io.element.android.services.analyticsproviders.api
|
||||
|
||||
interface AnalyticsTransaction {
|
||||
/**
|
||||
* Start a child span from this transaction.
|
||||
*/
|
||||
fun startChild(operation: String, description: String? = null): AnalyticsTransaction
|
||||
fun setData(key: String, value: Any)
|
||||
|
||||
/**
|
||||
* Adds extra data to the transaction. This data is not indexed, it's just listed.
|
||||
*/
|
||||
fun putExtraData(key: String, value: String)
|
||||
|
||||
/**
|
||||
* Similar to [putExtraData], adds extra data that *will be indexed* and can be used for filtering in the analytics portal.
|
||||
*
|
||||
* **Do not add numerical values using this function, use [putExtraData] instead.**
|
||||
*/
|
||||
fun putIndexableData(key: String, value: String)
|
||||
|
||||
/**
|
||||
* Whether the transaction has finished.
|
||||
*/
|
||||
fun isFinished(): Boolean
|
||||
|
||||
/**
|
||||
* The optional trace id which can be used for distributed tracing.
|
||||
*/
|
||||
fun traceId(): String?
|
||||
|
||||
/**
|
||||
* Attach a throwable to the transaction, so we can know it failed.
|
||||
*/
|
||||
fun attachError(throwable: Throwable)
|
||||
|
||||
/**
|
||||
* Finish the transaction. This will schedule an upload of the data.
|
||||
*/
|
||||
fun finish()
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a child span from this transaction.
|
||||
*/
|
||||
inline fun <T> AnalyticsTransaction.recordChildTransaction(operation: String, description: String? = null, block: (AnalyticsTransaction) -> T): T {
|
||||
val child = startChild(operation, description)
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -14,4 +14,7 @@ object AnalyticsUserData {
|
|||
const val EVENT_CACHE_SIZE = "event_cache_size"
|
||||
const val CRYPTO_STORE_SIZE = "crypto_store_size"
|
||||
const val MEDIA_STORE_SIZE = "media_store_size"
|
||||
|
||||
const val FIRST_SYNC_STATE = "first_sync_state"
|
||||
const val TIMELINE_ITEM_COUNT = "timeline_item_count"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,16 @@ interface AnalyticsTracker {
|
|||
fun updateSuperProperties(updatedProperties: SuperProperties)
|
||||
|
||||
/**
|
||||
* Adds user data that will be sent with every event.
|
||||
* Adds extra data that will be sent with every event.
|
||||
*/
|
||||
fun addUserData(key: String, value: String) {}
|
||||
fun addExtraData(key: String, value: String) {}
|
||||
|
||||
/**
|
||||
* Similar to [addExtraData], adds data that will be indexed in the analytics portal.
|
||||
*
|
||||
* **Do not add numerical values using this, use [addExtraData] instead.**
|
||||
*/
|
||||
fun addIndexableData(key: String, value: String) {}
|
||||
}
|
||||
|
||||
fun AnalyticsTracker.captureInteraction(name: Interaction.Name, type: Interaction.InteractionType? = null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue