Add a temporary counter for profile key credential types
This commit is contained in:
parent
30df4c3d29
commit
8d468d17e3
|
@ -143,6 +143,8 @@ public class ProfileController {
|
||||||
|
|
||||||
private static final Counter VERSION_NOT_FOUND_COUNTER = Metrics.counter(name(ProfileController.class, "versionNotFound"));
|
private static final Counter VERSION_NOT_FOUND_COUNTER = Metrics.counter(name(ProfileController.class, "versionNotFound"));
|
||||||
private static final String INVALID_ACCEPT_LANGUAGE_COUNTER_NAME = name(ProfileController.class, "invalidAcceptLanguage");
|
private static final String INVALID_ACCEPT_LANGUAGE_COUNTER_NAME = name(ProfileController.class, "invalidAcceptLanguage");
|
||||||
|
private static final String GET_PROFILE_CREDENTIAL_COUNTER_NAME = name(ProfileController.class, "getProfileCredential");
|
||||||
|
private static final String CREDENTIAL_TYPE_TAG_NAME = "credentialType";
|
||||||
|
|
||||||
public ProfileController(
|
public ProfileController(
|
||||||
Clock clock,
|
Clock clock,
|
||||||
|
@ -277,8 +279,13 @@ public class ProfileController {
|
||||||
final Account targetAccount = verifyPermissionToReceiveAccountIdentityProfile(maybeRequester, accessKey, uuid);
|
final Account targetAccount = verifyPermissionToReceiveAccountIdentityProfile(maybeRequester, accessKey, uuid);
|
||||||
final boolean isSelf = isSelfProfileRequest(maybeRequester, uuid);
|
final boolean isSelf = isSelfProfileRequest(maybeRequester, uuid);
|
||||||
|
|
||||||
|
String credentialTypeTagValue = "unrecognized";
|
||||||
|
|
||||||
|
try {
|
||||||
switch (credentialType) {
|
switch (credentialType) {
|
||||||
case PROFILE_KEY_CREDENTIAL_TYPE -> {
|
case PROFILE_KEY_CREDENTIAL_TYPE -> {
|
||||||
|
credentialTypeTagValue = PROFILE_KEY_CREDENTIAL_TYPE;
|
||||||
|
|
||||||
return buildProfileKeyCredentialProfileResponse(targetAccount,
|
return buildProfileKeyCredentialProfileResponse(targetAccount,
|
||||||
version,
|
version,
|
||||||
credentialRequest,
|
credentialRequest,
|
||||||
|
@ -287,6 +294,8 @@ public class ProfileController {
|
||||||
}
|
}
|
||||||
|
|
||||||
case PNI_CREDENTIAL_TYPE -> {
|
case PNI_CREDENTIAL_TYPE -> {
|
||||||
|
credentialTypeTagValue = PNI_CREDENTIAL_TYPE;
|
||||||
|
|
||||||
if (!isSelf) {
|
if (!isSelf) {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
@ -298,6 +307,8 @@ public class ProfileController {
|
||||||
}
|
}
|
||||||
|
|
||||||
case EXPIRING_PROFILE_KEY_CREDENTIAL_TYPE -> {
|
case EXPIRING_PROFILE_KEY_CREDENTIAL_TYPE -> {
|
||||||
|
credentialTypeTagValue = EXPIRING_PROFILE_KEY_CREDENTIAL_TYPE;
|
||||||
|
|
||||||
return buildExpiringProfileKeyCredentialProfileResponse(targetAccount,
|
return buildExpiringProfileKeyCredentialProfileResponse(targetAccount,
|
||||||
version,
|
version,
|
||||||
credentialRequest,
|
credentialRequest,
|
||||||
|
@ -308,6 +319,9 @@ public class ProfileController {
|
||||||
|
|
||||||
default -> throw new BadRequestException();
|
default -> throw new BadRequestException();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Metrics.counter(GET_PROFILE_CREDENTIAL_COUNTER_NAME, CREDENTIAL_TYPE_TAG_NAME, credentialTypeTagValue).increment();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Although clients should generally be using versioned profiles wherever possible, there are still a few lingering
|
// Although clients should generally be using versioned profiles wherever possible, there are still a few lingering
|
||||||
|
|
Loading…
Reference in New Issue