Skip to content

Commit

Permalink
added recordnetwork methods with primitive data types (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsitoPuglisi committed Oct 31, 2023
1 parent ad56d48 commit b362771
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,25 @@ internal interface UnityInternalInterface : EmbraceInternalInterface {
message: String,
stacktrace: String?
)

fun recordIncompleteNetworkRequest(
url: String,
httpMethod: String,
startTime: Long,
endTime: Long,
errorType: String?,
errorMessage: String?,
traceId: String?
)

fun recordCompletedNetworkRequest(
url: String,
httpMethod: String,
startTime: Long,
endTime: Long,
bytesSent: Long,
bytesReceived: Long,
statusCode: Int,
traceId: String?
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package io.embrace.android.embracesdk

import io.embrace.android.embracesdk.internal.EmbraceInternalInterface
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.network.EmbraceNetworkRequest
import io.embrace.android.embracesdk.network.http.HttpMethod
import io.embrace.android.embracesdk.prefs.PreferencesService

internal class UnityInternalInterfaceImpl(
Expand Down Expand Up @@ -106,4 +108,54 @@ internal class UnityInternalInterfaceImpl(
logger.logSDKNotInitialized("log Unity exception")
}
}

override fun recordIncompleteNetworkRequest(
url: String,
httpMethod: String,
startTime: Long,
endTime: Long,
errorType: String?,
errorMessage: String?,
traceId: String?
) {
embrace.recordNetworkRequest(
EmbraceNetworkRequest.fromIncompleteRequest(
url,
HttpMethod.fromString(httpMethod),
startTime,
endTime,
errorType ?: "",
errorMessage ?: "",
traceId,
null,
null
)
)
}

override fun recordCompletedNetworkRequest(
url: String,
httpMethod: String,
startTime: Long,
endTime: Long,
bytesSent: Long,
bytesReceived: Long,
statusCode: Int,
traceId: String?
) {
embrace.recordNetworkRequest(
EmbraceNetworkRequest.fromCompletedRequest(
url,
HttpMethod.fromString(httpMethod),
startTime,
endTime,
bytesSent,
bytesReceived,
statusCode,
traceId,
null,
null
)
)
}
}

0 comments on commit b362771

Please sign in to comment.