Don't include "Command" suffix in WHOIS metrics command name label

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152414152
This commit is contained in:
mcilwain 2017-04-06 12:39:06 -07:00 committed by Ben McIlwain
parent 5081d780dc
commit 08009e755f
3 changed files with 6 additions and 4 deletions

View file

@ -112,7 +112,9 @@ public class WhoisMetrics {
private Clock clock = null; private Clock clock = null;
public Builder setCommand(WhoisCommand command) { public Builder setCommand(WhoisCommand command) {
return setCommandName(command.getClass().getSimpleName()); // All WHOIS command class names share the "Command" suffix, so strip it out in order to
// have shorter labels.
return setCommandName(command.getClass().getSimpleName().replaceFirst("Command$", ""));
} }
public abstract Builder setCommandName(String commandName); public abstract Builder setCommandName(String commandName);

View file

@ -352,7 +352,7 @@ public class WhoisHttpServerTest {
server.run(); server.run();
WhoisMetric expected = WhoisMetric expected =
WhoisMetric.builderForRequest(clock) WhoisMetric.builderForRequest(clock)
.setCommandName("NameserverLookupByHostCommand") .setCommandName("NameserverLookupByHost")
.setNumResults(1) .setNumResults(1)
.setStatus(SC_OK) .setStatus(SC_OK)
.build(); .build();

View file

@ -456,7 +456,7 @@ public class WhoisServerTest {
server.run(); server.run();
WhoisMetric expected = WhoisMetric expected =
WhoisMetric.builderForRequest(clock) WhoisMetric.builderForRequest(clock)
.setCommandName("NameserverLookupByIpCommand") .setCommandName("NameserverLookupByIp")
.setNumResults(2) .setNumResults(2)
.setStatus(SC_OK) .setStatus(SC_OK)
.build(); .build();
@ -470,7 +470,7 @@ public class WhoisServerTest {
server.run(); server.run();
WhoisMetric expected = WhoisMetric expected =
WhoisMetric.builderForRequest(clock) WhoisMetric.builderForRequest(clock)
.setCommandName("DomainLookupCommand") .setCommandName("DomainLookup")
.setNumResults(0) .setNumResults(0)
.setStatus(SC_NOT_FOUND) .setStatus(SC_NOT_FOUND)
.build(); .build();