net.niebes.retrofit.metrics.MeasuredCallAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of retrofit-metrics Show documentation
Show all versions of retrofit-metrics Show documentation
Implementation to retry retrofit calls with resilience4j
The newest version!
package net.niebes.retrofit.metrics
import retrofit2.Call
import retrofit2.CallAdapter
import java.lang.reflect.Type
class MeasuredCallAdapter internal constructor(
private val nextCallAdapter: CallAdapter,
private val metricsCollector: RetrofitCallMetricsCollector,
) : CallAdapter {
override fun responseType(): Type = nextCallAdapter.responseType()
override fun adapt(call: Call): TargetType = nextCallAdapter.adapt(
MeasuredCall(
call,
metricsCollector
)
)
}