Skip to content

Commit

Permalink
Maybe this will export quantiles
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaFox161 committed Apr 16, 2024
1 parent a7a2505 commit 1639e57
Showing 1 changed file with 8 additions and 9 deletions.
Expand Up @@ -4,8 +4,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import discord4j.common.JacksonResources
import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.binder.okhttp3.OkHttpMetricsEventListener
import io.micrometer.core.instrument.binder.okhttp3.OkHttpObservationInterceptor
import io.micrometer.observation.ObservationRegistry
import okhttp3.OkHttpClient
import org.dreamexposure.discal.core.serializers.DurationMapper
import org.dreamexposure.discal.core.serializers.SnowflakeMapper
Expand Down Expand Up @@ -33,13 +33,12 @@ class BeanConfig {
}

@Bean
fun httpClient(registry: MeterRegistry): OkHttpClient {
fun httpClient(registry: ObservationRegistry): OkHttpClient {
val interceptor = OkHttpObservationInterceptor.builder(registry, "okhttp.requests")
.build()

return OkHttpClient.Builder()
.eventListener(
OkHttpMetricsEventListener.builder(registry, "okhttp.requests")
// This does allow for cardinality explosion... unsure how I want to deal with that?
.uriMapper { it.url.encodedPath }
.build()
).build()
.addInterceptor(interceptor)
.build()
}
}

0 comments on commit 1639e57

Please sign in to comment.