diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java index ca7683319..2a0764895 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java @@ -116,6 +116,7 @@ public class ProfileController { private static final String PNI_CREDENTIAL_TYPE = "pni"; private static final Counter VERSION_NOT_FOUND_COUNTER = Metrics.counter(name(ProfileController.class, "versionNotFound")); + private static final Counter INVALID_ACCEPT_LANGUAGE_COUNTER = Metrics.counter(name(ProfileController.class, "invalidAcceptLanguageCounter")); public ProfileController( Clock clock, @@ -437,7 +438,8 @@ public class ProfileController { try { return containerRequestContext.getAcceptableLanguages(); } catch (final ProcessingException e) { - logger.warn("Could not get acceptable languages; Accept-Language: {}; User-Agent: {}", + INVALID_ACCEPT_LANGUAGE_COUNTER.increment(); + logger.debug("Could not get acceptable languages; Accept-Language: {}; User-Agent: {}", containerRequestContext.getHeaderString(HttpHeaders.ACCEPT_LANGUAGE), containerRequestContext.getHeaderString(HttpHeaders.USER_AGENT), e); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java index aad74f77b..4f341b7d3 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java @@ -56,6 +56,8 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.Metrics; import org.apache.commons.lang3.StringUtils; import org.signal.zkgroup.InvalidInputException; import org.signal.zkgroup.VerificationFailedException; @@ -78,6 +80,8 @@ import org.whispersystems.textsecuregcm.storage.SubscriptionManager.GetResult; import org.whispersystems.textsecuregcm.stripe.StripeManager; import org.whispersystems.textsecuregcm.util.ExactlySize; +import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; + @Path("/v1/subscription") public class SubscriptionController { @@ -93,6 +97,8 @@ public class SubscriptionController { private final BadgeTranslator badgeTranslator; private final LevelTranslator levelTranslator; + private static final Counter INVALID_ACCEPT_LANGUAGE_COUNTER = Metrics.counter(name(SubscriptionController.class, "invalidAcceptLanguageCounter")); + public SubscriptionController( @Nonnull Clock clock, @Nonnull SubscriptionConfiguration subscriptionConfiguration, @@ -859,7 +865,8 @@ public class SubscriptionController { try { return containerRequestContext.getAcceptableLanguages(); } catch (final ProcessingException e) { - logger.warn("Could not get acceptable languages; Accept-Language: {}; User-Agent: {}", + INVALID_ACCEPT_LANGUAGE_COUNTER.increment(); + logger.debug("Could not get acceptable languages; Accept-Language: {}; User-Agent: {}", containerRequestContext.getHeaderString(HttpHeaders.ACCEPT_LANGUAGE), containerRequestContext.getHeaderString(HttpHeaders.USER_AGENT), e);