Skip to content

Commit

Permalink
Try to return an Option[String] with review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 authored Nov 16, 2024
1 parent ba7b18f commit 6733960
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ object OpenTelemetryMetrics {
"url.scheme" -> { case (_, req) => req.uri.scheme.getOrElse("unknown") },
"path" -> { case (ep, _) => ep.showPathTemplate(showQueryParam = None) }
),
forResponse = List(
"http.response.status_code" -> {
case Right(r) => r.code.code.toString
// Default to 500 for exceptions
case Left(_) => "500"
},
"error.type" -> {
case Left(ex) => ex.getClass.getSimpleName
case Right(_) => ""
forResponse = List(
"http.response.status_code" -> {
case Right(r) => Some(r.code.code.toString)
case Left(_) => Some("500")
},
"error.type" -> {
case Left(ex) => Some(ex.getClass.getName)
case Right(_) => None
}
).collect { case (k, Some(v)) => k -> v }

}
)
Expand Down

0 comments on commit 6733960

Please sign in to comment.