diff --git a/navi-alfred/src/main/java/com/navi/alfred/model/FailureRequest.kt b/navi-alfred/src/main/java/com/navi/alfred/model/FailureRequest.kt index 9f4f787..68d429d 100644 --- a/navi-alfred/src/main/java/com/navi/alfred/model/FailureRequest.kt +++ b/navi-alfred/src/main/java/com/navi/alfred/model/FailureRequest.kt @@ -12,7 +12,7 @@ data class Failure( @SerializedName("error_type") val errorType: String? = "", @SerializedName("request_url") val requestUrl: String? = "", @SerializedName("request_method") val requestMethod: String? = "", - @SerializedName("client_ts") val clientTs: Long? = AlfredManager.config.getEventTimeStamp(), + @SerializedName("client_ts") val clientTs: Long? = null, @SerializedName("error_timestamp") val errorTimestamp: Long? = System.currentTimeMillis(), @SerializedName("zip_name") val zipName: List? = null, @SerializedName("error_name") val errorName: String? = "", diff --git a/navi-alfred/src/main/java/com/navi/alfred/utils/EventUtils.kt b/navi-alfred/src/main/java/com/navi/alfred/utils/EventUtils.kt index ba69e23..42f81b5 100644 --- a/navi-alfred/src/main/java/com/navi/alfred/utils/EventUtils.kt +++ b/navi-alfred/src/main/java/com/navi/alfred/utils/EventUtils.kt @@ -88,7 +88,8 @@ internal suspend fun sendEventsToServer(applicationContext: Context): Boolean { zipName = zipNamesList, errorStatusCode = response.code().toLong(), errorMessage = response.message(), - errorName = INGEST_EVENT_FAILURE + errorName = INGEST_EVENT_FAILURE, + clientTs = request.baseAttribute?.clientTs ) AlfredDispatcher.addTaskToQueue( AddFailureTask( @@ -353,7 +354,8 @@ internal fun sendAlfredSessionEvent(dumpFlow: Boolean = false, index: Int? = nul zipName = request.session_upload_event_attributes.eventId?.let { listOf(it) }, errorStatusCode = response.code().toLong(), errorMessage = response.message(), - errorName = INGEST_SESSION_FAILURE + errorName = INGEST_SESSION_FAILURE, + clientTs = request.base_attribute.clientTs ) AlfredDispatcher.addTaskToQueue( AddFailureTask( @@ -511,7 +513,8 @@ internal fun buildFailureEvent( zipName: List? = null, errorStatusCode: Long, errorMessage: String? = "", - errorName: String? = null + errorName: String? = null, + clientTs: Long? = null ): FailureEvent { val timeStamp = System.currentTimeMillis() val eventData = @@ -522,7 +525,8 @@ internal fun buildFailureEvent( zipName = zipName, errorStatusCode = errorStatusCode, errorMessage = errorMessage, - errorName = errorName + errorName = errorName, + clientTs = clientTs ) return FailureEvent(timeStamp, Gson().toJson(eventData)) } diff --git a/navi-alfred/src/main/java/com/navi/alfred/utils/UploadUtils.kt b/navi-alfred/src/main/java/com/navi/alfred/utils/UploadUtils.kt index ed21c3c..ce79fc5 100644 --- a/navi-alfred/src/main/java/com/navi/alfred/utils/UploadUtils.kt +++ b/navi-alfred/src/main/java/com/navi/alfred/utils/UploadUtils.kt @@ -29,7 +29,8 @@ internal suspend fun getPreSignedUrl( index: Int? = null, workManagerFlow: Boolean? = false ) { - val bucketKey = AlfredManager.config.getAlfredEventId().plus(AlfredConstants.ZIP_FILE_EXTENSION) + val zipNameForFailure = AlfredManager.config.getAlfredEventId() + val bucketKey = zipNameForFailure.plus(AlfredConstants.ZIP_FILE_EXTENSION) AlfredManager.config.setAlfredEventId() val response = AlfredManager.networkRepository.getPreSignedUrl(bucketKey, AlfredManager.config.getApiKey()) @@ -42,7 +43,8 @@ internal suspend fun getPreSignedUrl( dumpFlow, index, zipFileName, - workManagerFlow = workManagerFlow + workManagerFlow = workManagerFlow, + zipNameForFailure = zipNameForFailure ) } } @@ -51,6 +53,7 @@ internal suspend fun getPreSignedUrl( errorType = API_ERROR, requestUrl = DEFAULT_GET_PRE_SIGNED_URL_URL.plus(bucketKey), requestMethod = GET_METHOD, + zipName = listOf(zipNameForFailure), errorStatusCode = response.code().toLong(), errorMessage = response.message(), errorName = GET_PRE_SIGNED_URL_FAILURE @@ -139,7 +142,8 @@ internal suspend fun uploadFile( dumpFlow: Boolean = false, index: Int? = null, zipFileName: String, - workManagerFlow: Boolean? = false + workManagerFlow: Boolean? = false, + zipNameForFailure: String? = "" ) { val requestBody = uploadFile.asRequestBody("application/zip".toMediaTypeOrNull()) val uploadResponse = AlfredManager.networkRepository.uploadZipToS3(url, requestBody) @@ -151,6 +155,7 @@ internal suspend fun uploadFile( errorType = ZIP_ERROR, requestUrl = url, requestMethod = POST_METHOD, + zipName = listOf(zipNameForFailure?: ""), errorStatusCode = uploadResponse.code().toLong(), errorMessage = uploadResponse.message(), errorName = UPLOAD_TO_S3_FAILURE