# MXO Auth Latency Reporting ![](https://hackmd.io/_uploads/rJGVHBJJa.png) **NOTE: The contents of this page are now outdated. Refer to this [doc](https://engineering.paypalcorp.com/confluence/display/MSDK/Latency+Tracking) for the latest auth latency duration pairs.** We need to be able to calculate customer interaction time and customer percieved latency for the following auth flows: * Web Auth - measure when auth is invoked to when an accessToken is returned * Native OTP - measure CIT and CPL for all native screens * Native OTP with web fallback - measure when auth is invoked to when an accessToken is returned * Native LLS (launched through either native OTP or web auth flows) - measure when auth is invoked to when an accessToken is returned ## Solution Decision After discussing with the identity team - we decided to go with Option 1 - adding new success events. ## Option 1 - Add Success Events for different Auth Flows Auth SDK sends new analytics events for success cases - right before the success callback is invoked. Web Auth Interface events: * Web auth success: `native_xo_auth_web_auth_success` * Native LLS success: `native_xo_auth_native_lls_success` OTP Auth Interface events: * OTP auth success: `native_xo_otp_success` * Web auth fallback launched: `native_xo_auth_otp_with_web_fallback_started` * Web auth fallback success: `native_xo_auth_otp_with_web_fallback_success` * Native LLS success: `native_xo_auth_native_lls_success` MXO will define separate start and end pairs for each of the flows. ## Option 2 - Add Additional Info in the Auth Success Callback Add flags for the following fields: * Native LLS to both web auth and otp interfaces * Native OTP interface - fell back to web ```kotlin // Web Auth val authDelegate = object : AuthenticationDelegate { override fun completeWithSuccess( tokenResponse: TokenResponse, isNativeLLS: Boolean ) { } ... } // Native OTP val listener = object : Authentication.Listener { override fun onSuccess( authTokensProvider: AuthenticationTokensProvider, isNativeLLS: Boolean, didFallbackToWeb: Boolean ) { ... } ... } ``` MXO will then send unique end events for duration tracking based on the returned fields and will have separate start and end pairs for each. ## Links - [Auth Instrumentation](https://engineering.paypalcorp.com/confluence/pages/viewpage.action?spaceKey=INE&title=3rd+Party+XO+Flow+Instrumentation) - [Event Pairs Sheet](https://paypal-my.sharepoint.com/:x:/r/personal/keesimmons_paypal_com/Documents/MXO%20Latency%20Event%20Pairs%20%5BDRAFT%5D.xlsx?d=w2c4f32c80d984da98f1dfda9bff52cc4&csf=1&web=1&e=RcAtGa) - [MXO Transition Names](https://hackmd.io/hwEfg08xS2OJzURCslRUWA)