Migrate to "regionCode" instead of "region" to avoid tag name conflicts
This commit is contained in:
parent
fc5cd3a9ca
commit
3c655cdd5a
|
@ -135,7 +135,13 @@ public class AccountController {
|
||||||
private static final String CHALLENGE_PRESENT_TAG_NAME = "present";
|
private static final String CHALLENGE_PRESENT_TAG_NAME = "present";
|
||||||
private static final String CHALLENGE_MATCH_TAG_NAME = "matches";
|
private static final String CHALLENGE_MATCH_TAG_NAME = "matches";
|
||||||
private static final String COUNTRY_CODE_TAG_NAME = "countryCode";
|
private static final String COUNTRY_CODE_TAG_NAME = "countryCode";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated "region" conflicts with cloud provider region tags; prefer "regionCode" instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
private static final String REGION_TAG_NAME = "region";
|
private static final String REGION_TAG_NAME = "region";
|
||||||
|
private static final String REGION_CODE_TAG_NAME = "regionCode";
|
||||||
private static final String VERIFICATION_TRANSPORT_TAG_NAME = "transport";
|
private static final String VERIFICATION_TRANSPORT_TAG_NAME = "transport";
|
||||||
private static final String SCORE_TAG_NAME = "score";
|
private static final String SCORE_TAG_NAME = "score";
|
||||||
|
|
||||||
|
@ -250,6 +256,7 @@ public class AccountController {
|
||||||
UserAgentTagUtil.getPlatformTag(userAgent),
|
UserAgentTagUtil.getPlatformTag(userAgent),
|
||||||
Tag.of(COUNTRY_CODE_TAG_NAME, countryCode),
|
Tag.of(COUNTRY_CODE_TAG_NAME, countryCode),
|
||||||
Tag.of(REGION_TAG_NAME, region),
|
Tag.of(REGION_TAG_NAME, region),
|
||||||
|
Tag.of(REGION_CODE_TAG_NAME, region),
|
||||||
Tag.of(SCORE_TAG_NAME, result.score())))
|
Tag.of(SCORE_TAG_NAME, result.score())))
|
||||||
.increment());
|
.increment());
|
||||||
|
|
||||||
|
@ -267,7 +274,8 @@ public class AccountController {
|
||||||
Metrics.counter(CHALLENGE_ISSUED_COUNTER_NAME, Tags.of(
|
Metrics.counter(CHALLENGE_ISSUED_COUNTER_NAME, Tags.of(
|
||||||
UserAgentTagUtil.getPlatformTag(userAgent),
|
UserAgentTagUtil.getPlatformTag(userAgent),
|
||||||
Tag.of(COUNTRY_CODE_TAG_NAME, Util.getCountryCode(number)),
|
Tag.of(COUNTRY_CODE_TAG_NAME, Util.getCountryCode(number)),
|
||||||
Tag.of(REGION_TAG_NAME, Util.getRegion(number))))
|
Tag.of(REGION_TAG_NAME, Util.getRegion(number)),
|
||||||
|
Tag.of(REGION_CODE_TAG_NAME, region)))
|
||||||
.increment();
|
.increment();
|
||||||
return Response.status(402).build();
|
return Response.status(402).build();
|
||||||
}
|
}
|
||||||
|
@ -419,6 +427,7 @@ public class AccountController {
|
||||||
Metrics.counter(ACCOUNT_VERIFY_COUNTER_NAME, Tags.of(UserAgentTagUtil.getPlatformTag(userAgent),
|
Metrics.counter(ACCOUNT_VERIFY_COUNTER_NAME, Tags.of(UserAgentTagUtil.getPlatformTag(userAgent),
|
||||||
Tag.of(COUNTRY_CODE_TAG_NAME, Util.getCountryCode(number)),
|
Tag.of(COUNTRY_CODE_TAG_NAME, Util.getCountryCode(number)),
|
||||||
Tag.of(REGION_TAG_NAME, Util.getRegion(number)),
|
Tag.of(REGION_TAG_NAME, Util.getRegion(number)),
|
||||||
|
Tag.of(REGION_CODE_TAG_NAME, Util.getRegion(number)),
|
||||||
Tag.of(VERIFY_EXPERIMENT_TAG_NAME, String.valueOf(storedVerificationCode.get().getTwilioVerificationSid().isPresent()))))
|
Tag.of(VERIFY_EXPERIMENT_TAG_NAME, String.valueOf(storedVerificationCode.get().getTwilioVerificationSid().isPresent()))))
|
||||||
.increment();
|
.increment();
|
||||||
|
|
||||||
|
@ -838,6 +847,7 @@ public class AccountController {
|
||||||
Metrics.counter(PUSH_CHALLENGE_COUNTER_NAME,
|
Metrics.counter(PUSH_CHALLENGE_COUNTER_NAME,
|
||||||
COUNTRY_CODE_TAG_NAME, countryCode,
|
COUNTRY_CODE_TAG_NAME, countryCode,
|
||||||
REGION_TAG_NAME, region,
|
REGION_TAG_NAME, region,
|
||||||
|
REGION_CODE_TAG_NAME, region,
|
||||||
CHALLENGE_PRESENT_TAG_NAME, Boolean.toString(pushChallenge.isPresent()),
|
CHALLENGE_PRESENT_TAG_NAME, Boolean.toString(pushChallenge.isPresent()),
|
||||||
CHALLENGE_MATCH_TAG_NAME, Boolean.toString(match))
|
CHALLENGE_MATCH_TAG_NAME, Boolean.toString(match))
|
||||||
.increment();
|
.increment();
|
||||||
|
|
|
@ -61,7 +61,13 @@ public class TwilioSmsSender {
|
||||||
static final String STATUS_CODE_TAG_NAME = "statusCode";
|
static final String STATUS_CODE_TAG_NAME = "statusCode";
|
||||||
static final String ERROR_CODE_TAG_NAME = "errorCode";
|
static final String ERROR_CODE_TAG_NAME = "errorCode";
|
||||||
static final String COUNTRY_CODE_TAG_NAME = "countryCode";
|
static final String COUNTRY_CODE_TAG_NAME = "countryCode";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated "region" conflicts with cloud provider region tags; prefer "regionCode" instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
static final String REGION_TAG_NAME = "region";
|
static final String REGION_TAG_NAME = "region";
|
||||||
|
static final String REGION_CODE_TAG_NAME = "regionCode";
|
||||||
|
|
||||||
private final String accountId;
|
private final String accountId;
|
||||||
private final String accountToken;
|
private final String accountToken;
|
||||||
|
@ -223,7 +229,8 @@ public class TwilioSmsSender {
|
||||||
STATUS_CODE_TAG_NAME, String.valueOf(response.failureResponse.status),
|
STATUS_CODE_TAG_NAME, String.valueOf(response.failureResponse.status),
|
||||||
ERROR_CODE_TAG_NAME, String.valueOf(response.failureResponse.code),
|
ERROR_CODE_TAG_NAME, String.valueOf(response.failureResponse.code),
|
||||||
COUNTRY_CODE_TAG_NAME, countryCode,
|
COUNTRY_CODE_TAG_NAME, countryCode,
|
||||||
REGION_TAG_NAME, region).increment();
|
REGION_TAG_NAME, region,
|
||||||
|
REGION_CODE_TAG_NAME, region).increment();
|
||||||
|
|
||||||
logger.info("Failed with code={}, country={}",
|
logger.info("Failed with code={}, country={}",
|
||||||
response.failureResponse.code,
|
response.failureResponse.code,
|
||||||
|
|
|
@ -165,7 +165,8 @@ class TwilioVerifySender {
|
||||||
TwilioSmsSender.STATUS_CODE_TAG_NAME, String.valueOf(twilioVerifyResponse.failureResponse.status),
|
TwilioSmsSender.STATUS_CODE_TAG_NAME, String.valueOf(twilioVerifyResponse.failureResponse.status),
|
||||||
TwilioSmsSender.ERROR_CODE_TAG_NAME, String.valueOf(twilioVerifyResponse.failureResponse.code),
|
TwilioSmsSender.ERROR_CODE_TAG_NAME, String.valueOf(twilioVerifyResponse.failureResponse.code),
|
||||||
TwilioSmsSender.COUNTRY_CODE_TAG_NAME, countryCode,
|
TwilioSmsSender.COUNTRY_CODE_TAG_NAME, countryCode,
|
||||||
TwilioSmsSender.REGION_TAG_NAME, region).increment();
|
TwilioSmsSender.REGION_TAG_NAME, region,
|
||||||
|
TwilioSmsSender.REGION_CODE_TAG_NAME, region).increment();
|
||||||
|
|
||||||
logger.info("Failed with code={}, country={}",
|
logger.info("Failed with code={}, country={}",
|
||||||
twilioVerifyResponse.failureResponse.code,
|
twilioVerifyResponse.failureResponse.code,
|
||||||
|
|
Loading…
Reference in New Issue