mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 01:17:14 +02:00
Record a version of EPP metrics with TLD for domain commands
Also fixes the issue that dry run EPP commands were incorrectly being reported on. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171062984
This commit is contained in:
parent
7e68ffa16a
commit
302a27f0db
13 changed files with 283 additions and 61 deletions
|
@ -22,8 +22,11 @@ import com.google.auto.value.AutoValue;
|
|||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import google.registry.bigquery.BigqueryUtils.FieldType;
|
||||
import google.registry.model.eppoutput.Result.Code;
|
||||
import google.registry.model.registry.Registries;
|
||||
import google.registry.util.Clock;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -43,6 +46,7 @@ public abstract class EppMetric implements BigQueryMetric {
|
|||
new TableFieldSchema().setName("endTime").setType(FieldType.TIMESTAMP.name()),
|
||||
new TableFieldSchema().setName("commandName").setType(FieldType.STRING.name()),
|
||||
new TableFieldSchema().setName("clientId").setType(FieldType.STRING.name()),
|
||||
new TableFieldSchema().setName("tld").setType(FieldType.STRING.name()),
|
||||
new TableFieldSchema().setName("privilegeLevel").setType(FieldType.STRING.name()),
|
||||
new TableFieldSchema().setName("eppTarget").setType(FieldType.STRING.name()),
|
||||
new TableFieldSchema().setName("eppStatus").setType(FieldType.INTEGER.name()),
|
||||
|
@ -58,6 +62,8 @@ public abstract class EppMetric implements BigQueryMetric {
|
|||
|
||||
public abstract Optional<String> getClientId();
|
||||
|
||||
public abstract Optional<String> getTld();
|
||||
|
||||
public abstract Optional<String> getPrivilegeLevel();
|
||||
|
||||
public abstract Optional<String> getEppTarget();
|
||||
|
@ -88,6 +94,7 @@ public abstract class EppMetric implements BigQueryMetric {
|
|||
// Populate optional values, if present
|
||||
addOptional("commandName", getCommandName(), map);
|
||||
addOptional("clientId", getClientId(), map);
|
||||
addOptional("tld", getTld(), map);
|
||||
addOptional("privilegeLevel", getPrivilegeLevel(), map);
|
||||
addOptional("eppTarget", getEppTarget(), map);
|
||||
if (getStatus().isPresent()) {
|
||||
|
@ -155,6 +162,37 @@ public abstract class EppMetric implements BigQueryMetric {
|
|||
|
||||
public abstract Builder setClientId(Optional<String> clientId);
|
||||
|
||||
public abstract Builder setTld(String tld);
|
||||
|
||||
public abstract Builder setTld(Optional<String> tld);
|
||||
|
||||
/**
|
||||
* Sets the single TLD field from a list of TLDs associated with a command.
|
||||
*
|
||||
* <p>Due to cardinality reasons we cannot record combinations of different TLDs as might be
|
||||
* seen in a domain check command, so if this happens we record "_various" instead. We also
|
||||
* record "_invalid" for a TLD that does not exist in our system, as again that could blow up
|
||||
* cardinality. Underscore prefixes are used for these sentinel values so that they cannot be
|
||||
* confused with actual TLDs, which cannot start with underscores.
|
||||
*/
|
||||
public Builder setTlds(ImmutableSet<String> tlds) {
|
||||
switch (tlds.size()) {
|
||||
case 0:
|
||||
setTld(Optional.<String>absent());
|
||||
break;
|
||||
case 1:
|
||||
String tld = Iterables.getOnlyElement(tlds);
|
||||
// Only record TLDs that actually exist, otherwise we can blow up cardinality by recording
|
||||
// an arbitrarily large number of strings.
|
||||
setTld(Optional.fromNullable(Registries.getTlds().contains(tld) ? tld : "_invalid"));
|
||||
break;
|
||||
default:
|
||||
setTld("_various");
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract Builder setPrivilegeLevel(String privilegeLevel);
|
||||
|
||||
public abstract Builder setEppTarget(String eppTarget);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue