Add RDAP metrics for non-search endpoints

This CL uses the previously-defined RDAP metrics class to record basic metrics
for all RDAP endpoints, and handles testing of non-search endpoints. Searches
are more complicated, and will be handled in future CLs.

The default wildcard type is now INVALID rather than NO_WILDCARD.

A change to getMatchingResources() (adding an additional parameter) is also included in this CL, as it was needed to set the incompleteness warning type correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175719265
This commit is contained in:
mountford 2017-11-14 12:36:06 -08:00 committed by jianglai
parent 0ffd3553c3
commit 358fe68f09
14 changed files with 288 additions and 31 deletions

View file

@ -64,8 +64,6 @@ public class RdapEntitySearchAction extends RdapActionBase {
public static final String PATH = "/rdap/entities";
private static final int RESULT_SET_SIZE_SCALING_FACTOR = 30;
@Inject Clock clock;
@Inject @Parameter("fn") Optional<String> fnParam;
@Inject @Parameter("handle") Optional<String> handleParam;
@ -189,7 +187,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
if (authorization.role() != RdapAuthorization.Role.ADMINISTRATOR) {
query = query.filter("currentSponsorClientId in", authorization.clientIds());
}
resultSet = getMatchingResources(query, false, now);
resultSet = getMatchingResources(query, false, now, rdapResultSetMaxSize + 1);
}
return makeSearchResults(resultSet, registrars, now);
}
@ -234,16 +232,17 @@ public class RdapEntitySearchAction extends RdapActionBase {
// Get the contact matches and return the results, fetching an additional contact to detect
// truncation. If we are including deleted entries, we must fetch more entries, in case some
// get excluded due to permissioning.
int querySizeLimit = getStandardQuerySizeLimit();
Query<ContactResource> query =
queryItemsByKey(
ContactResource.class,
partialStringQuery,
shouldIncludeDeleted(),
shouldIncludeDeleted()
? (RESULT_SET_SIZE_SCALING_FACTOR * (rdapResultSetMaxSize + 1))
: (rdapResultSetMaxSize + 1));
querySizeLimit);
return makeSearchResults(
getMatchingResources(query, shouldIncludeDeleted(), now), registrars, now);
getMatchingResources(query, shouldIncludeDeleted(), now, querySizeLimit),
registrars,
now);
}
}