Skip to content

Commit 9074454

Browse files
committed
Add base unit to metrics and improve log sanitization
1 parent b0546f2 commit 9074454

File tree

1 file changed

+2
-1
lines changed
  • captchaservice-backend/src/main/java/de/muenchen/captchaservice/service/captcha

1 file changed

+2
-1
lines changed

captchaservice-backend/src/main/java/de/muenchen/captchaservice/service/captcha/MetricsService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public void recordClientSolveTime(String siteKey, SourceAddress sourceAddress, l
6161
.tag("site_key", siteKey)
6262
.tag("difficulty", String.valueOf(difficulty))
6363
.description("Summary of the time taken by clients to solve captcha challenges")
64+
.baseUnit("milliseconds")
6465
.register(meterRegistry)
6566
.record(solveTime);
6667
}
@@ -78,6 +79,6 @@ public void initializeInvalidatedPayloadsGauge() {
7879
*/
7980
private static String sanitizeForLog(String input) {
8081
if (input == null) return null;
81-
return input.replaceAll("[\\r\\n]", "");
82+
return input.replaceAll("[^A-Za-z0-9_-]", "_");
8283
}
8384
}

0 commit comments

Comments
 (0)