public class RateLimitingSearcher extends Searcher
This takes these query parameter arguments:
Whenever quota is exceeded for an id this searcher will reject queries from that id by returning a result containing a status 429 error.
If rate.id or rate.quota is not set in Query.properties this searcher will do nothing.
Metrics: This will emit the count metric requestsOverQuota with the dimension [rate.idDimension=rate.id] counting rejected requests.
Ordering: This searcher Provides rateLimiting
Modifier and Type | Field and Description |
---|---|
static com.yahoo.processing.request.CompoundName |
costKey |
static com.yahoo.processing.request.CompoundName |
dryRunKey |
static com.yahoo.processing.request.CompoundName |
idDimensionKey |
static com.yahoo.processing.request.CompoundName |
idKey |
static com.yahoo.processing.request.CompoundName |
quotaKey |
static String |
RATE_LIMITING
Constant containing the name this Provides - "rateLimiting", for ordering constraints
|
Constructor and Description |
---|
RateLimitingSearcher(RateLimitingConfig rateLimitingConfig,
com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig,
com.yahoo.metrics.simple.MetricReceiver metric) |
RateLimitingSearcher(RateLimitingConfig rateLimitingConfig,
com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig,
com.yahoo.metrics.simple.MetricReceiver metric,
Clock clock)
For testing - allows injection of a timer to avoid depending on the system clock
|
Modifier and Type | Method and Description |
---|---|
Result |
search(Query query,
Execution execution)
Override this to implement your searcher.
|
ensureFilled, fill, getLogger, process, toString
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
public static final String RATE_LIMITING
public static final com.yahoo.processing.request.CompoundName idKey
public static final com.yahoo.processing.request.CompoundName costKey
public static final com.yahoo.processing.request.CompoundName quotaKey
public static final com.yahoo.processing.request.CompoundName idDimensionKey
public static final com.yahoo.processing.request.CompoundName dryRunKey
@Inject public RateLimitingSearcher(RateLimitingConfig rateLimitingConfig, com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig, com.yahoo.metrics.simple.MetricReceiver metric)
public RateLimitingSearcher(RateLimitingConfig rateLimitingConfig, com.yahoo.cloud.config.ClusterInfoConfig clusterInfoConfig, com.yahoo.metrics.simple.MetricReceiver metric, Clock clock)
public Result search(Query query, Execution execution)
Searcher
Searcher implementation subclasses will, depending on their type of logic, do one of the following:
Hits come in two kinds - concrete hits are actual content of the kind requested by the user, meta hits are hits which provides information about the collection of hits, on the query, the service and so on.
The query specifies a window into a larger result list that must be returned from the searcher through hits and offset; Searchers which returns list of hits in the top level in the result must return at least hits number of hits (or if impossible; all that are available), starting at the given offset. In addition, searchers are allowed to return any number of meta hits (although this number is expected to be low). For hits contained in nested hit groups, the concept of a window defined by hits and offset is not well defined and does not apply.
Error handling in searchers:
Copyright © 2018. All rights reserved.