public static class ResponseContext.Keys extends Object
If it's necessary to add new keys in the context then they should be listed in a separate class:
public class SomeClass
{
static final Key EXTENSION_KEY_1 = new StringKey(
"extension_key_1", Visibility.HEADER_AND_TRAILER, true),
static final Key EXTENSION_KEY_2 = new CounterKey(
"extension_key_2", Visibility.None);
static {
Keys.instance().registerKeys(new Key[] {
EXTENSION_KEY_1,
EXTENSION_KEY_2
});
}
}
Make sure all extension keys are added with the {@link #registerKey(Key)} or
{@link #registerKeys(Key[])} methods.
Create custom keys in one of two ways. As shown above, predefined key types exist for common values. Custom values can be created as shown in the code for this class.
| Modifier and Type | Field and Description |
|---|---|
static ResponseContext.Key |
CPU_CONSUMED_NANOS
The total CPU time for threads related to Sequence processing of the query.
|
static ResponseContext.Key |
ETAG
Entity tag.
|
static ResponseContext.Keys |
INSTANCE
One and only global list of keys.
|
static ResponseContext.Key |
MISSING_SEGMENTS
Lists missing segments.
|
static ResponseContext.Key |
NUM_SCANNED_ROWS
The number of rows scanned by
ScanQueryEngine. |
static ResponseContext.Key |
QUERY_FAIL_DEADLINE_MILLIS
Query fail time (current time + timeout).
|
static ResponseContext.Key |
QUERY_TOTAL_BYTES_GATHERED
Query total bytes gathered.
|
static ResponseContext.Key |
REMAINING_RESPONSES_FROM_QUERY_SERVERS
Map of most relevant query ID to remaining number of responses from query nodes.
|
static ResponseContext.Key |
TIMEOUT_AT
This variable indicates when a running query should be expired,
and is effective only when 'timeout' of queryContext has a positive value.
|
static ResponseContext.Key |
TRUNCATED
Indicates if a
ResponseContext was truncated during serialization. |
static ResponseContext.Key |
UNCOVERED_INTERVALS
Lists intervals for which NO segment is present.
|
static ResponseContext.Key |
UNCOVERED_INTERVALS_OVERFLOWED
Indicates if the number of uncovered intervals exceeded the limit (true/false).
|
| Modifier and Type | Method and Description |
|---|---|
ResponseContext.Key |
find(String name)
Returns a registered key associated with the given name, or
null if the key is not registered. |
static ResponseContext.Keys |
instance()
Returns the single, global key registry for this server.
|
ResponseContext.Key |
keyOf(String name)
Returns a registered key associated with the name .
|
void |
registerKey(ResponseContext.Key key)
Primary way of registering context keys.
|
void |
registerKeys(ResponseContext.Key[] keys)
Register a group of keys.
|
public static final ResponseContext.Key UNCOVERED_INTERVALS
public static final ResponseContext.Key UNCOVERED_INTERVALS_OVERFLOWED
public static final ResponseContext.Key REMAINING_RESPONSES_FROM_QUERY_SERVERS
CachingClusteredClient when it initializes the connection to the query nodes,
and is updated whenever they respond (@code DirectDruidClient). RetryQueryRunner uses this value to
check if the MISSING_SEGMENTS is valid.
Currently, the broker doesn't run subqueries in parallel, the remaining number of responses will be updated
one by one per subquery. However, since it can be parallelized to run subqueries simultaneously, we store them
in a ConcurrentHashMap.Query.getMostSpecificId()public static final ResponseContext.Key MISSING_SEGMENTS
public static final ResponseContext.Key ETAG
public static final ResponseContext.Key QUERY_TOTAL_BYTES_GATHERED
public static final ResponseContext.Key QUERY_FAIL_DEADLINE_MILLIS
public static final ResponseContext.Key TIMEOUT_AT
public static final ResponseContext.Key NUM_SCANNED_ROWS
ScanQueryEngine.
Named "count" for backwards compatibility with older data servers that still send this, even though it's now
marked as internal.public static final ResponseContext.Key CPU_CONSUMED_NANOS
CPUTimeMetricQueryRunnerpublic static final ResponseContext.Key TRUNCATED
ResponseContext was truncated during serialization.public static final ResponseContext.Keys INSTANCE
public static ResponseContext.Keys instance()
public void registerKey(ResponseContext.Key key)
IllegalArgumentException - if the key has already been registered.public void registerKeys(ResponseContext.Key[] keys)
public ResponseContext.Key keyOf(String name)
IllegalStateException - if a corresponding key has not been registered.public ResponseContext.Key find(String name)
null if the key is not registered. This form is for testing
and for deserialization when the existence of the key is suspect.Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.