From e282a4bc68978b332f00b98dcb92d14d6adf9267 Mon Sep 17 00:00:00 2001 From: Kevin Meredith Date: Sat, 7 Jan 2023 23:25:57 -0500 Subject: [PATCH] don't add method or status label if already present, case insensitive --- .../scala/sttp/client3/prometheus/PrometheusBackend.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/observability/prometheus-backend/src/main/scala/sttp/client3/prometheus/PrometheusBackend.scala b/observability/prometheus-backend/src/main/scala/sttp/client3/prometheus/PrometheusBackend.scala index c2242c4f94..4d4436e809 100644 --- a/observability/prometheus-backend/src/main/scala/sttp/client3/prometheus/PrometheusBackend.scala +++ b/observability/prometheus-backend/src/main/scala/sttp/client3/prometheus/PrometheusBackend.scala @@ -79,7 +79,7 @@ object PrometheusBackend { */ def addLabelPairs(config: BaseCollectorConfig, req: Request[_, _], maybeResp: Option[Response[_]]): config.T = { val methodLabel: Option[(String, String)] = { - if (config.labels.map(_._1).contains("method")) { + if (config.labels.map(_._1.toLowerCase).contains("method")) { None } else { Some { @@ -89,7 +89,7 @@ object PrometheusBackend { } val statusLabel: Option[(String, String)] = { - if (config.labels.map(_._1).contains("status")) { + if (config.labels.map(_._1.toLowerCase).contains("status")) { None } else { maybeResp.map { r => ("status", mapStatusToLabelValue(r.code)) }