Use the actual EPP command flow name for EppMetrics

It was previously only using the name of the inner command XML element,
e.g. "Create", "Delete", "Update", etc. This wasn't very useful because
there was no way to discriminate between operations on different types
of EPP resources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151131491
This commit is contained in:
mcilwain 2017-03-24 09:03:01 -07:00 committed by Ben McIlwain
parent 0d32b6b7b2
commit 4260fb573f
5 changed files with 36 additions and 15 deletions

View file

@ -14,6 +14,7 @@
package google.registry.monitoring.whitebox;
import static com.google.common.base.Preconditions.checkArgument;
import static google.registry.bigquery.BigqueryUtils.toBigqueryTimestamp;
import com.google.api.services.bigquery.model.TableFieldSchema;
@ -141,7 +142,14 @@ public abstract class EppMetric implements BigQueryMetric {
abstract Builder setEndTimestamp(DateTime endTimestamp);
public abstract Builder setCommandName(String commandName);
abstract Builder setCommandName(String commandName);
public Builder setCommandNameFromFlow(String flowSimpleClassName) {
checkArgument(
flowSimpleClassName.endsWith("Flow"),
"Must pass in the simple class name of a flow class");
return setCommandName(flowSimpleClassName.replaceFirst("Flow$", ""));
}
public abstract Builder setClientId(String clientId);