34 lines
1.0 KiB
Kotlin
34 lines
1.0 KiB
Kotlin
/*
|
|
*
|
|
* * Copyright © 2025 by Navi Technologies Limited
|
|
* * All rights reserved. Strictly confidential
|
|
*
|
|
*/
|
|
|
|
package com.naviapp.traceflow
|
|
|
|
import com.navi.analytics.utils.NaviTrackEvent
|
|
import com.navi.base.utils.orZero
|
|
import com.navi.traceflow.Trace
|
|
import com.navi.traceflow.TraceCallback
|
|
import timber.log.Timber
|
|
|
|
class TraceCallbackImpl : TraceCallback {
|
|
override fun onTraceEnded(trace: Trace) {
|
|
val props = mutableMapOf<String, String>()
|
|
props["NAME"] = trace.name
|
|
props["START_TIME"] = trace.startTime.toString()
|
|
props["END_TIME"] = trace.endTime.orZero().toString()
|
|
props["TRACE_ID"] = trace.traceId.toString()
|
|
trace.parentTrace?.traceId?.let { parentTraceId ->
|
|
props["PARENT_UUID"] = parentTraceId.toString()
|
|
}
|
|
try { // surrounding this try catch, because, some times pulse may not be initialised at
|
|
// this point
|
|
NaviTrackEvent.trackEvent("TRACE_FLOW", props)
|
|
} catch (e: Exception) {
|
|
Timber.e(e)
|
|
}
|
|
}
|
|
}
|