Measure adoption of the `gv1-migration` capability.
This commit is contained in:
parent
c228e125c3
commit
7ba689aaeb
|
@ -21,8 +21,7 @@ import static com.codahale.metrics.MetricRegistry.name;
|
|||
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 = "gv2";
|
||||
private static final String IOS_OLD_GV2_CAPABILITY_TAG_NAME = "ios_old_gv2";
|
||||
private static final String GV2_CAPABLE_TAG_NAME = "gv1Migration";
|
||||
|
||||
public AccountAuthenticator(AccountsManager accountsManager) {
|
||||
super(accountsManager);
|
||||
|
@ -32,16 +31,9 @@ public class AccountAuthenticator extends BaseAccountAuthenticator implements Au
|
|||
public Optional<Account> authenticate(BasicCredentials basicCredentials) {
|
||||
final Optional<Account> maybeAccount = super.authenticate(basicCredentials, true);
|
||||
|
||||
// TODO Remove this temporary counter after the GV2 rollout is underway
|
||||
// TODO Remove this temporary counter when we can replace it with more generic feature adoption system
|
||||
maybeAccount.ifPresent(account -> {
|
||||
final boolean iosDeviceHasOldGv2Capability = account.getDevices().stream().anyMatch(device ->
|
||||
(device.getApnId() != null || device.getVoipApnId() != null) &&
|
||||
(device.getCapabilities() != null && device.getCapabilities().isGv2()));
|
||||
|
||||
final Tag gv2CapableTag = Tag.of(GV2_CAPABLE_TAG_NAME, String.valueOf(account.isGroupsV2Supported()));
|
||||
final Tag iosOldGv2CapabilityTag = Tag.of(IOS_OLD_GV2_CAPABILITY_TAG_NAME, String.valueOf(iosDeviceHasOldGv2Capability));
|
||||
|
||||
Metrics.counter(AUTHENTICATION_COUNTER_NAME, List.of(gv2CapableTag, iosOldGv2CapabilityTag)).increment();
|
||||
Metrics.counter(AUTHENTICATION_COUNTER_NAME, GV2_CAPABLE_TAG_NAME, String.valueOf(account.isGv1MigrationSupported())).increment();
|
||||
});
|
||||
|
||||
return maybeAccount;
|
||||
|
|
Loading…
Reference in New Issue