Skip to content

Commit b5a4a38

Browse files
committed
One liner for emitIdentityBusinessMetrics
1 parent a7e2c7e commit b5a4a38

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/SdkOperationExecution.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import aws.smithy.kotlin.runtime.client.endpoints.authOptions
1414
import aws.smithy.kotlin.runtime.client.logMode
1515
import aws.smithy.kotlin.runtime.collections.attributesOf
1616
import aws.smithy.kotlin.runtime.collections.emptyAttributes
17-
import aws.smithy.kotlin.runtime.collections.get
1817
import aws.smithy.kotlin.runtime.collections.merge
1918
import aws.smithy.kotlin.runtime.http.*
2019
import aws.smithy.kotlin.runtime.http.auth.SignHttpRequest
@@ -419,15 +418,5 @@ private class InterceptorTransmitMiddleware<I, O>(
419418
/**
420419
* Emits an [Identity]'s attributes [BusinessMetrics] into an [ExecutionContext]
421420
*/
422-
private fun emitIdentityBusinessMetrics(identity: Identity, context: ExecutionContext) {
423-
val identityAttributes = identity.attributes
424-
425-
if (identityAttributes.contains(BusinessMetrics)) {
426-
identityAttributes[BusinessMetrics]
427-
.toList()
428-
.reversed()
429-
.forEach { metric ->
430-
context.emitBusinessMetric(metric)
431-
}
432-
}
433-
}
421+
private fun emitIdentityBusinessMetrics(identity: Identity, context: ExecutionContext) =
422+
identity.attributes.getOrNull(BusinessMetrics)?.toList()?.reversed()?.forEach(context::emitBusinessMetric)

0 commit comments

Comments
 (0)