mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 03:39:36 +02:00
Register quota metrics in GCP proxy
When a quota request is rejected, increment the metric counter by one. Also makes both frontend and backend metrics singleton because all the fields they have a static. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185146804
This commit is contained in:
parent
c34e547659
commit
ce5baafc4a
6 changed files with 137 additions and 15 deletions
|
@ -163,4 +163,23 @@ public class FrontendMetricsTest {
|
|||
.and()
|
||||
.hasNoOtherValues();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_registerQuotaRejections() {
|
||||
String otherCertHash = "foobar1234X";
|
||||
String remoteAddress = "127.0.0.1";
|
||||
String otherProtocol = "other protocol";
|
||||
metrics.registerQuotaRejection(PROTOCOL, CERT_HASH);
|
||||
metrics.registerQuotaRejection(PROTOCOL, otherCertHash);
|
||||
metrics.registerQuotaRejection(PROTOCOL, otherCertHash);
|
||||
metrics.registerQuotaRejection(otherProtocol, remoteAddress);
|
||||
assertThat(FrontendMetrics.quotaRejectionsCounter)
|
||||
.hasValueForLabels(1, PROTOCOL, CERT_HASH)
|
||||
.and()
|
||||
.hasValueForLabels(2, PROTOCOL, otherCertHash)
|
||||
.and()
|
||||
.hasValueForLabels(1, otherProtocol, remoteAddress)
|
||||
.and()
|
||||
.hasNoOtherValues();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue