Skip to content

Commit

Permalink
use native function instead of JVM only
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez committed May 24, 2024
1 parent 489e432 commit 2c3bc06
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import aws.smithy.kotlin.runtime.client.ProtocolRequestInterceptorContext
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
import aws.smithy.kotlin.runtime.http.request.HttpRequest
import aws.smithy.kotlin.runtime.http.request.toBuilder
import kotlin.text.toByteArray

/**
* Appends business metrics to the `User-Agent` header.
Expand All @@ -35,7 +34,7 @@ public class BusinessMetricsInterceptor : HttpInterceptor {
*/
private fun formatMetrics(metrics: MutableSet<String>): String {
val metricsString = metrics.joinToString(",", "m/")
val metricsByteArray = metricsString.toByteArray()
val metricsByteArray = metricsString.encodeToByteArray()
val maxSize = 1024

if (metricsByteArray.size <= maxSize) return metricsString
Expand Down

0 comments on commit 2c3bc06

Please sign in to comment.