1313/**
1414 * Health indicator for the Cloudflare Turnstile service.
1515 * <p>
16- * This component provides health check information for the Cloudflare Turnstile service.
17- * It checks if the service is properly configured and if the service has not exceeded
18- * the configured error threshold. The health indicator can be disabled through configuration.
16+ * This component provides health check information for the Cloudflare Turnstile service. It checks if the service is properly configured and if the
17+ * service has not exceeded the configured error threshold. The health indicator can be disabled through configuration.
1918 * </p>
2019 */
2120@ Slf4j
@@ -43,19 +42,15 @@ public Health health() {
4342 double errorRate = validationService .getErrorRate ();
4443 int errorThreshold = properties .getMetrics ().getErrorThreshold ();
4544
46- Health .Builder builder = Health .up ()
47- .withDetail ("url" , properties .getUrl ())
48- .withDetail ("validationCount" , validationService .getValidationCount ())
49- .withDetail ("successCount" , validationService .getSuccessCount ())
50- .withDetail ("errorCount" , validationService .getErrorCount ())
51- .withDetail ("errorRate" , String .format ("%.2f%%" , errorRate ))
52- .withDetail ("responseTimeAvg" , String .format ("%.2fms" , validationService .getAverageResponseTime ()));
45+ Health .Builder builder =
46+ Health .up ().withDetail ("url" , properties .getUrl ()).withDetail ("validationCount" , validationService .getValidationCount ())
47+ .withDetail ("successCount" , validationService .getSuccessCount ())
48+ .withDetail ("errorCount" , validationService .getErrorCount ()).withDetail ("errorRate" , String .format ("%.2f%%" , errorRate ))
49+ .withDetail ("responseTimeAvg" , String .format ("%.2fms" , validationService .getAverageResponseTime ()));
5350
5451 // If error rate exceeds threshold, report as DOWN
5552 if (errorRate > errorThreshold ) {
56- return builder .down ()
57- .withDetail ("reason" , "Error rate exceeded threshold: " + errorRate + "% > " + errorThreshold + "%" )
58- .build ();
53+ return builder .down ().withDetail ("reason" , "Error rate exceeded threshold: " + errorRate + "% > " + errorThreshold + "%" ).build ();
5954 }
6055
6156 return builder .build ();
@@ -64,4 +59,4 @@ public Health health() {
6459 return Health .down (e ).withDetail ("reason" , "Error checking service health: " + e .getMessage ()).build ();
6560 }
6661 }
67- }
62+ }
0 commit comments