All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
sttp.client4.prometheus.PrometheusConfig.scala Maven / Gradle / Ivy
package sttp.client4.prometheus
import io.prometheus.metrics.model.registry.PrometheusRegistry
import sttp.client4.GenericRequest
import sttp.client4.Response
import sttp.client4.prometheus.PrometheusBackend._
final case class PrometheusConfig(
requestToHistogramNameMapper: GenericRequest[_, _] => Option[HistogramCollectorConfig] =
(req: GenericRequest[_, _]) => Some(addMethodLabel(HistogramCollectorConfig(DefaultHistogramName), req)),
requestToInProgressGaugeNameMapper: GenericRequest[_, _] => Option[CollectorConfig] = (req: GenericRequest[_, _]) =>
Some(addMethodLabel(CollectorConfig(DefaultRequestsActiveGaugeName), req)),
responseToSuccessCounterMapper: (GenericRequest[_, _], Response[_]) => Option[CollectorConfig] =
(req: GenericRequest[_, _], resp: Response[_]) =>
Some(addStatusLabel(addMethodLabel(CollectorConfig(DefaultSuccessCounterName), req), resp)),
responseToErrorCounterMapper: (GenericRequest[_, _], Response[_]) => Option[CollectorConfig] =
(req: GenericRequest[_, _], resp: Response[_]) =>
Some(addStatusLabel(addMethodLabel(CollectorConfig(DefaultErrorCounterName), req), resp)),
requestToFailureCounterMapper: (GenericRequest[_, _], Throwable) => Option[CollectorConfig] = (
req: GenericRequest[_, _],
_: Throwable
) => Some(addMethodLabel(CollectorConfig(DefaultFailureCounterName), req)),
requestToSizeSummaryMapper: GenericRequest[_, _] => Option[CollectorConfig] = (req: GenericRequest[_, _]) =>
Some(addMethodLabel(CollectorConfig(DefaultRequestSizeName), req)),
responseToSizeSummaryMapper: (GenericRequest[_, _], Response[_]) => Option[CollectorConfig] =
(req: GenericRequest[_, _], resp: Response[_]) =>
Some(addStatusLabel(addMethodLabel(CollectorConfig(DefaultResponseSizeName), req), resp)),
prometheusRegistry: PrometheusRegistry = PrometheusRegistry.defaultRegistry
)
object PrometheusConfig {
val Default: PrometheusConfig = PrometheusConfig()
}