Files
super-app/android/app/src/main/java/com/naviapp/traceflow/TraceCallbackImpl.kt
Siddiboina Susai c85f060f6e NTP-21454: Integrate Traceflow in super app (#14558)
Co-authored-by: Shivam Goyal <shivam.goyal@navi.com>
2025-01-16 13:34:11 +00:00

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)
}
}
}