mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 14:54:51 +02:00
Make FlowReporter log tld and various other fields
As part of b/36599833, this makes FlowReporter log the tld(s) of every domain flow it executes, so we can provide ICANN reporting totals on a per-TLD basis. It also adds several other fields that we're computing anyway and which seem useful, particularly for debugging any issues we see in production with the data that we're attempting to record for ICANN reporting. The full set of fields is: - commandType (e.g. "create", "info", "transfer") - resourceType* (e.g. "domain", "contact", "host") - flowClassName (e.g. "ContactCreateFlow", "DomainRestoreRequestFlow") - targetId* (e.g. "ns1.foo.com", "bar.org", "contact-1234") - targetIds* - plural of the above, for multi-resource checks - tld** (e.g. "com", "co.uk") - extracted from targetId, lowercased - tlds** - plural of the above, deduplicated, for multi-resource checks * = only non-empty for resource flows (not e.g. login, logout, poll) ** = only non-empty for domain flows Note that TLD extraction is deliberately very lenient to avoid the complexity overhead of double-validation of the domain names in the common case. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154070794
This commit is contained in:
parent
c596d23523
commit
f296b225af
21 changed files with 215 additions and 17 deletions
|
@ -45,6 +45,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
import org.json.simple.JSONValue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -173,10 +174,25 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
|||
.payload(expectedPayload));
|
||||
}
|
||||
|
||||
|
||||
protected void assertClientIdFieldLogged(String clientId) {
|
||||
assertAboutLogs().that(logHandler)
|
||||
.hasLogAtLevelWithMessage(Level.INFO, "FLOW-LOG-SIGNATURE-METADATA")
|
||||
.which()
|
||||
.contains("\"clientId\":" + JSONValue.toJSONString(clientId));
|
||||
}
|
||||
|
||||
protected void assertTldsFieldLogged(String... tlds) {
|
||||
assertAboutLogs().that(logHandler)
|
||||
.hasLogAtLevelWithMessage(Level.INFO, "FLOW-LOG-SIGNATURE-METADATA")
|
||||
.which()
|
||||
.contains("\"tlds\":" + JSONValue.toJSONString(ImmutableList.copyOf(tlds)));
|
||||
}
|
||||
|
||||
protected void assertIcannReportingActivityFieldLogged(String fieldName) {
|
||||
assertAboutLogs().that(logHandler)
|
||||
.hasLogAtLevelWithMessage(Level.INFO, "FLOW-LOG-SIGNATURE-METADATA")
|
||||
.which()
|
||||
.contains(fieldName);
|
||||
.contains("\"icannActivityReportField\":" + JSONValue.toJSONString(fieldName));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue