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:
guyben 2018-09-13 14:31:39 -07:00 committed by Ben McIlwain
parent e72f5c09a2
commit 414b2e4db1
6 changed files with 145 additions and 4 deletions

View file

@ -14,6 +14,7 @@
package google.registry.tools;
import com.google.monitoring.metrics.MetricWriter;
import dagger.Component;
import google.registry.config.CredentialModule;
import google.registry.config.RegistryConfig.ConfigModule;
@ -27,6 +28,7 @@ import google.registry.request.Modules.AppIdentityCredentialModule;
import google.registry.request.Modules.DatastoreServiceModule;
import google.registry.request.Modules.GoogleCredentialModule;
import google.registry.request.Modules.Jackson2Module;
import google.registry.request.Modules.NetHttpTransportModule;
import google.registry.request.Modules.URLFetchServiceModule;
import google.registry.request.Modules.UrlFetchTransportModule;
import google.registry.request.Modules.UseAppIdentityCredentialForGoogleApisModule;
@ -63,6 +65,7 @@ import javax.inject.Singleton;
Jackson2Module.class,
KeyModule.class,
KmsModule.class,
NetHttpTransportModule.class,
RdeModule.class,
RegistryToolModule.class,
SystemClockModule.class,
@ -74,6 +77,7 @@ import javax.inject.Singleton;
UserServiceModule.class,
VoidDnsWriterModule.class,
WhoisModule.class,
MetricToolModule.class,
})
interface RegistryToolComponent {
void inject(CheckDomainClaimsCommand command);
@ -111,4 +115,6 @@ interface RegistryToolComponent {
void inject(WhoisQueryCommand command);
AppEngineConnection appEngineConnection();
MetricWriter metricWriter();
}