mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Add metrics for the command used in the registry CLI tool
Puts the metric in <project>/tools/commands_called It counts the use of the tool, with the following labels: - environment - tool (nomulus/gtech) - command called (class name) - success true/false - from the shell true/false ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=212879670
This commit is contained in:
parent
e72f5c09a2
commit
414b2e4db1
6 changed files with 145 additions and 4 deletions
|
@ -152,6 +152,7 @@ public class ShellCommandTest {
|
|||
public void testMultipleCommandInvocations() throws Exception {
|
||||
try (RegistryCli cli =
|
||||
new RegistryCli("unittest", ImmutableMap.of("test_command", TestCommand.class))) {
|
||||
cli.uploadMetrics = false;
|
||||
RegistryToolEnvironment.UNITTEST.setup();
|
||||
cli.setEnvironment(RegistryToolEnvironment.UNITTEST);
|
||||
cli.run(new String[] {"test_command", "-x", "xval", "arg1", "arg2"});
|
||||
|
@ -169,7 +170,7 @@ public class ShellCommandTest {
|
|||
public void testNonExistentCommand() {
|
||||
try (RegistryCli cli =
|
||||
new RegistryCli("unittest", ImmutableMap.of("test_command", TestCommand.class))) {
|
||||
|
||||
cli.uploadMetrics = false;
|
||||
cli.setEnvironment(RegistryToolEnvironment.UNITTEST);
|
||||
assertThrows(MissingCommandException.class, () -> cli.run(new String[] {"bad_command"}));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue