Skip to content

Commit

Permalink
Use more idiomatic Kotlin in doc example
Browse files Browse the repository at this point in the history
  • Loading branch information
esperar authored and mhalbritter committed Sep 21, 2023
1 parent f24c0e2 commit 45e08f3
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@ class MyHealthMetricsExportConfiguration(registry: MeterRegistry, healthEndpoint
}

private fun getStatusCode(health: HealthEndpoint): Int {
val status = health.health().status
if (Status.UP == status) {
return 3
}
if (Status.OUT_OF_SERVICE == status) {
return 2
}
if (Status.DOWN == status) {
return 1
}
return 0
return when (health.health().status) {
Status.UP -> 3
Status.OUT_OF_SERVICE -> 2
Status.DOWN -> 1
else -> 0
}
}

}

0 comments on commit 45e08f3

Please sign in to comment.