Skip to content

Commit

Permalink
Update ZioMetrics.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 authored Dec 11, 2024
1 parent c81aee7 commit 9da5621
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ object ZioMetrics {

/** Convert into zio metric labels */
private def asZioLabel(l: MetricLabels, res: Either[Throwable, ServerResponse[_]], phase: Option[String]): Set[MetricLabel] = {
val responseLabels = l.forResponse.flatMap { case (key, valueFn) =>
valueFn(res).map(value => MetricLabel(key, value))
val responseLabels = l.forResponse.map { case (key, valueFn) =>
MetricLabel(key, valueFn(res).getOrElse("unknown"))
}
val phaseLabel = phase.map(v => MetricLabel(l.forResponsePhase.name, v))
(responseLabels ++ phaseLabel).toSet
Expand Down

0 comments on commit 9da5621

Please sign in to comment.