Retire old GV2 adoption metrics.
This commit is contained in:
parent
d5d9978e48
commit
4e2284b83f
|
@ -4,36 +4,21 @@
|
||||||
*/
|
*/
|
||||||
package org.whispersystems.textsecuregcm.auth;
|
package org.whispersystems.textsecuregcm.auth;
|
||||||
|
|
||||||
import io.micrometer.core.instrument.Metrics;
|
import io.dropwizard.auth.Authenticator;
|
||||||
|
import io.dropwizard.auth.basic.BasicCredentials;
|
||||||
|
import java.util.Optional;
|
||||||
import org.whispersystems.textsecuregcm.storage.Account;
|
import org.whispersystems.textsecuregcm.storage.Account;
|
||||||
import org.whispersystems.textsecuregcm.storage.AccountsManager;
|
import org.whispersystems.textsecuregcm.storage.AccountsManager;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import io.dropwizard.auth.Authenticator;
|
|
||||||
import io.dropwizard.auth.basic.BasicCredentials;
|
|
||||||
|
|
||||||
import static com.codahale.metrics.MetricRegistry.name;
|
|
||||||
|
|
||||||
public class AccountAuthenticator extends BaseAccountAuthenticator implements Authenticator<BasicCredentials, Account> {
|
public class AccountAuthenticator extends BaseAccountAuthenticator implements Authenticator<BasicCredentials, Account> {
|
||||||
|
|
||||||
private static final String AUTHENTICATION_COUNTER_NAME = name(AccountAuthenticator.class, "authenticate");
|
|
||||||
private static final String GV2_CAPABLE_TAG_NAME = "gv1Migration";
|
|
||||||
|
|
||||||
public AccountAuthenticator(AccountsManager accountsManager) {
|
public AccountAuthenticator(AccountsManager accountsManager) {
|
||||||
super(accountsManager);
|
super(accountsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Account> authenticate(BasicCredentials basicCredentials) {
|
public Optional<Account> authenticate(BasicCredentials basicCredentials) {
|
||||||
final Optional<Account> maybeAccount = super.authenticate(basicCredentials, true);
|
return super.authenticate(basicCredentials, true);
|
||||||
|
|
||||||
// TODO Remove this temporary counter when we can replace it with more generic feature adoption system
|
|
||||||
maybeAccount.ifPresent(account -> {
|
|
||||||
Metrics.counter(AUTHENTICATION_COUNTER_NAME, GV2_CAPABLE_TAG_NAME, String.valueOf(account.isGv1MigrationSupported())).increment();
|
|
||||||
});
|
|
||||||
|
|
||||||
return maybeAccount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue