mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 08:06:52 +00:00
Introduce CaptchaMetrics
This commit is contained in:
1 parent
4ae82cbb59
commit
87e88dd3a1
1 file changed
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2026 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.metrics;
|
||||
|
||||
import io.micrometer.core.instrument.DistributionSummary;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
|
||||
public class CaptchaMetrics {
|
||||
|
||||
private static final String CAPTCHA_OUTCOME_DISTRIBUTION_NAME = MetricsUtil.name(CaptchaMetrics.class, "outcome");
|
||||
|
||||
private CaptchaMetrics() {}
|
||||
|
||||
public static void measureCaptchaOutcome(final int score,
|
||||
final boolean success,
|
||||
final String region,
|
||||
final String context) {
|
||||
|
||||
DistributionSummary.builder(CAPTCHA_OUTCOME_DISTRIBUTION_NAME)
|
||||
.tags("success", String.valueOf(success),
|
||||
"regionCode", region,
|
||||
"context", context)
|
||||
.minimumExpectedValue(1.0d)
|
||||
.maximumExpectedValue(100.0d)
|
||||
.serviceLevelObjectives(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
|
||||
.register(Metrics.globalRegistry)
|
||||
.record(Math.max(1, score));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user