From 3342bcbdded7c2c97dc6637c5d2c69e332639c30 Mon Sep 17 00:00:00 2001 From: Vamshi Maskuri <117595548+varshith257@users.noreply.github.com> Date: Sat, 16 Nov 2024 21:39:34 +0530 Subject: [PATCH] Update metrics/opentelemetry-metrics/src/main/scala/sttp/tapir/server/metrics/opentelemetry/OpenTelemetryMetrics.scala --- .../server/metrics/opentelemetry/OpenTelemetryMetrics.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metrics/opentelemetry-metrics/src/main/scala/sttp/tapir/server/metrics/opentelemetry/OpenTelemetryMetrics.scala b/metrics/opentelemetry-metrics/src/main/scala/sttp/tapir/server/metrics/opentelemetry/OpenTelemetryMetrics.scala index cf496239e8..fa72694203 100644 --- a/metrics/opentelemetry-metrics/src/main/scala/sttp/tapir/server/metrics/opentelemetry/OpenTelemetryMetrics.scala +++ b/metrics/opentelemetry-metrics/src/main/scala/sttp/tapir/server/metrics/opentelemetry/OpenTelemetryMetrics.scala @@ -63,7 +63,9 @@ object OpenTelemetryMetrics { case Right(_) => None // No error.type for successful responses } } - ).collect { case (k, v) if v(response) != None => k -> v(response).get } + ).flatMap { + case (k, v) => v(Either.unit).map(value => k -> value) + } ) def apply[F[_]](meter: Meter): OpenTelemetryMetrics[F] = apply(meter, Nil)