Package org.apache.druid.query.search
Class DefaultSearchQueryMetrics
java.lang.Object
org.apache.druid.query.search.DefaultSearchQueryMetrics
- All Implemented Interfaces:
QueryMetrics<SearchQuery>,SearchQueryMetrics
This class is implemented with delegation to another QueryMetrics for compatibility, see "Making subinterfaces of
QueryMetrics for emitting custom dimensions and/or metrics for specific query types" section in
QueryMetrics
javadoc.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontext(SearchQuery query) SetsQuery.getContext()of the given query as dimension.voiddataSource(SearchQuery query) SetsQuery.getDataSource()of the given query as dimension.voidduration(SearchQuery query) SetsQuery.getDuration()of the given query as dimension.voidemit(ServiceEmitter emitter) Emits all metrics, registered since the lastemit()call on this QueryMetrics object.voidfilterBundle(FilterBundle.BundleInfo bundleInfo) voidgranularity(SearchQuery query) Sets the granularity ofBaseQuery.getGranularity()of the given query as dimension.voidhasFilters(SearchQuery query) SetsQuery.hasFilters()of the given query as dimension.voidSets identity of the requester for a query.voidinterval(SearchQuery query) SetsQuery.getIntervals()of the given query as dimension.makeBitmapResultFactory(BitmapFactory factory) Creates aBitmapResultFactorywhich may record some information along bitmap construction fromQueryMetrics.filterBundle(FilterBundle.BundleInfo).voidparallelMergeParallelism(int parallelism) Sets broker merge parallelism, if parallel merges are enabled.voidprojection(String projection) If a projection was used during segment processing, set its name as the projection dimensionvoidquery(SearchQuery query) Pulls all information from the query object into dimensions of future metrics.voidSets id of the given query as dimension.voidqueryId(SearchQuery query) SetsQuery.getId()of the given query as dimension.voidqueryType(SearchQuery query) SetsQuery.getType()of the given query as dimension.voidremoteAddress(String remoteAddress) reportBackPressureTime(long timeNs) Registers "time that channel is unreadable (backpressure)" metric.reportBitmapConstructionTime(long timeNs) Reports the time spent constructing bitmap fromQueryMetrics.filterBundle(FilterBundle.BundleInfo)of the query.reportCpuTime(long timeNs) Registers "cpu time" metric.reportNodeBytes(long byteCount) Registers "node bytes" metric.reportNodeTime(long timeNs) Registers "node time" metric.reportNodeTimeToFirstByte(long timeNs) Registers "time to first byte" metric.reportParallelMergeFastestPartitionTime(long timeNs) Reports broker "wall" time in nanoseconds for the fastest parallel merge sequence partition to be 'initialized', where 'initialized' is time to the first result batch is populated from data servers and merging can begin.reportParallelMergeInputRows(long numRows) Reports total number of input rows processed by the broker during parallel merge.reportParallelMergeInputSequences(long numSequences) Reports total number of input sequences processed by the broker during parallel merge.reportParallelMergeOutputRows(long numRows) Reports broker total number of output rows after merging and combining input sequences (should be less than or equal to the value supplied toQueryMetrics.reportParallelMergeInputRows(long).reportParallelMergeParallelism(int parallelism) Reports number of parallel tasks the broker used to process the query during parallel merge.reportParallelMergeSlowestPartitionTime(long timeNs) Reports broker "wall" time in nanoseconds for the slowest parallel merge sequence partition to be 'initialized', where 'initialized' is time to the first result batch is populated from data servers and merging can begin.reportParallelMergeTaskCount(long numTasks) Reports broker total number of fork join pool tasks required to complete queryreportParallelMergeTotalCpuTime(long timeNs) Reports broker total CPU time in nanoseconds where fork join merge combine tasks were doing workreportParallelMergeTotalTime(long timeNs) Reports broker total "wall" time in nanoseconds from parallel merge start sequence creation to total consumption.reportPreFilteredRows(long numRows) Reports the number of rows to scan in the segment after applyingQueryMetrics.filterBundle(FilterBundle.BundleInfo).reportQueriedSegmentCount(long segmentCount) Registers "segments queried count" metric.reportQueryBytes(long byteCount) Registers "query bytes" metric.reportQueryTime(long timeNs) Registers "query time" metric.reportResultCachePoll(boolean hit) Emits iff a given query polled the result-level cache and the success of that operation.reportSegmentAndCacheTime(long timeNs) Registers "segmentAndCache time" metric.reportSegmentOnDemandLoadBytes(long byteCount) Registers the total number of bytes added to the cache when loading segments on demand, summing the sizes loaded by individual segement load threads.reportSegmentOnDemandLoadCount(long count) Registers the total numer of segments loaded on demand.reportSegmentOnDemandLoadTime(long timeNs) Registers the apparent time spent loading segments on demand, before queing up for processing.reportSegmentOnDemandLoadTimeAvg(long timeNs) Registers the average time spent loading segments on demand across threads.reportSegmentOnDemandLoadTimeMax(long timeNs) Registers the maximum time spent waiting for a thread to start loading segments on demand across all load threads.reportSegmentOnDemandLoadWaitTimeAvg(long timeNs) Registers the average time spent waiting for a thread to start loading segments on demand across threads.reportSegmentOnDemandLoadWaitTimeMax(long timeNs) Registers the maximum time spent loading segments on demand across all load threads.reportSegmentRows(long numRows) Reports the total number of rows in the processed segment.reportSegmentTime(long timeNs) Registers "segment time" metric.reportWaitTime(long timeNs) Registers "wait time" metric.voidvoidvoidsqlQueryId(String sqlQueryId) Sets sqlQueryId as a dimensionvoidsqlQueryId(SearchQuery query) SetsQuery.getSqlQueryId()of the given query as dimensionvoidvoidstatusCode(int code) Sets the query status code SeeDruidMetrics.computeStatusCode(java.lang.Throwable).voidsubQueryId(SearchQuery query) SetsQuery.getSubQueryId()of the given query as dimension.voidsuccess(boolean success) voidvectorized(boolean vectorized) Sets whether or not a segment scan has been vectorized.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.query.QueryMetrics
postFilters, preFilters
-
Constructor Details
-
DefaultSearchQueryMetrics
-
-
Method Details
-
query
Description copied from interface:QueryMetricsPulls all information from the query object into dimensions of future metrics.- Specified by:
queryin interfaceQueryMetrics<SearchQuery>
-
dataSource
Description copied from interface:QueryMetricsSetsQuery.getDataSource()of the given query as dimension.- Specified by:
dataSourcein interfaceQueryMetrics<SearchQuery>
-
queryType
Description copied from interface:QueryMetricsSetsQuery.getType()of the given query as dimension.- Specified by:
queryTypein interfaceQueryMetrics<SearchQuery>
-
interval
Description copied from interface:QueryMetricsSetsQuery.getIntervals()of the given query as dimension.- Specified by:
intervalin interfaceQueryMetrics<SearchQuery>
-
hasFilters
Description copied from interface:QueryMetricsSetsQuery.hasFilters()of the given query as dimension.- Specified by:
hasFiltersin interfaceQueryMetrics<SearchQuery>
-
duration
Description copied from interface:QueryMetricsSetsQuery.getDuration()of the given query as dimension.- Specified by:
durationin interfaceQueryMetrics<SearchQuery>
-
queryId
Description copied from interface:QueryMetricsSetsQuery.getId()of the given query as dimension.- Specified by:
queryIdin interfaceQueryMetrics<SearchQuery>
-
queryId
Description copied from interface:QueryMetricsSets id of the given query as dimension.- Specified by:
queryIdin interfaceQueryMetrics<SearchQuery>
-
subQueryId
Description copied from interface:QueryMetricsSetsQuery.getSubQueryId()of the given query as dimension.- Specified by:
subQueryIdin interfaceQueryMetrics<SearchQuery>
-
sqlQueryId
Description copied from interface:QueryMetricsSetsQuery.getSqlQueryId()of the given query as dimension- Specified by:
sqlQueryIdin interfaceQueryMetrics<SearchQuery>
-
sqlQueryId
Description copied from interface:QueryMetricsSets sqlQueryId as a dimension- Specified by:
sqlQueryIdin interfaceQueryMetrics<SearchQuery>
-
granularity
Description copied from interface:SearchQueryMetricsSets the granularity ofBaseQuery.getGranularity()of the given query as dimension. This method is going to be used in "full" metrics impl, see https://github.com/apache/druid/pull/4570#issuecomment-319458229- Specified by:
granularityin interfaceSearchQueryMetrics
-
context
Description copied from interface:QueryMetricsSetsQuery.getContext()of the given query as dimension.- Specified by:
contextin interfaceQueryMetrics<SearchQuery>
-
server
- Specified by:
serverin interfaceQueryMetrics<SearchQuery>
-
remoteAddress
- Specified by:
remoteAddressin interfaceQueryMetrics<SearchQuery>
-
status
- Specified by:
statusin interfaceQueryMetrics<SearchQuery>
-
success
public void success(boolean success) - Specified by:
successin interfaceQueryMetrics<SearchQuery>
-
statusCode
public void statusCode(int code) Description copied from interface:QueryMetricsSets the query status code SeeDruidMetrics.computeStatusCode(java.lang.Throwable).- Specified by:
statusCodein interfaceQueryMetrics<SearchQuery>
-
segment
- Specified by:
segmentin interfaceQueryMetrics<SearchQuery>
-
projection
Description copied from interface:QueryMetricsIf a projection was used during segment processing, set its name as the projection dimension- Specified by:
projectionin interfaceQueryMetrics<SearchQuery>
-
filterBundle
- Specified by:
filterBundlein interfaceQueryMetrics<SearchQuery>
-
identity
Description copied from interface:QueryMetricsSets identity of the requester for a query. SeeAuthenticationResult.- Specified by:
identityin interfaceQueryMetrics<SearchQuery>
-
vectorized
public void vectorized(boolean vectorized) Description copied from interface:QueryMetricsSets whether or not a segment scan has been vectorized. Generally expected to only be attached to segment-level metrics, since at whole-query level we might have a mix of vectorized and non-vectorized segment scans.- Specified by:
vectorizedin interfaceQueryMetrics<SearchQuery>
-
parallelMergeParallelism
public void parallelMergeParallelism(int parallelism) Description copied from interface:QueryMetricsSets broker merge parallelism, if parallel merges are enabled. This will only appear in broker level metrics. This value is identical to theQueryMetrics.reportParallelMergeParallelism(int)metric value, but optionally also available as a dimension.- Specified by:
parallelMergeParallelismin interfaceQueryMetrics<SearchQuery>
-
makeBitmapResultFactory
Description copied from interface:QueryMetricsCreates aBitmapResultFactorywhich may record some information along bitmap construction fromQueryMetrics.filterBundle(FilterBundle.BundleInfo). The returned BitmapResultFactory may add some dimensions to this QueryMetrics from it'sBitmapResultFactory.toImmutableBitmap(Object)method. SeeBitmapResultFactoryJavadoc for more information.- Specified by:
makeBitmapResultFactoryin interfaceQueryMetrics<SearchQuery>
-
reportQueryTime
Description copied from interface:QueryMetricsRegisters "query time" metric. Measures the time between a Jetty thread starting to handle a query, and the response being fully written to the response output stream. Does not include time spent waiting in a queue before the query runs.- Specified by:
reportQueryTimein interfaceQueryMetrics<SearchQuery>
-
reportQueryBytes
Description copied from interface:QueryMetricsRegisters "query bytes" metric. Measures the total number of bytes written by the query server thread to the response output stream. Emitted once per query.- Specified by:
reportQueryBytesin interfaceQueryMetrics<SearchQuery>
-
reportWaitTime
Description copied from interface:QueryMetricsRegisters "wait time" metric. Measures the total time segment-processing runnables spent waiting for execution in the processing thread pool. Emitted once per segment.- Specified by:
reportWaitTimein interfaceQueryMetrics<SearchQuery>
-
reportSegmentTime
Description copied from interface:QueryMetricsRegisters "segment time" metric. Measures the total wall-clock time spent operating on segments in processing threads. Emitted once per segment.- Specified by:
reportSegmentTimein interfaceQueryMetrics<SearchQuery>
-
reportSegmentAndCacheTime
Description copied from interface:QueryMetricsRegisters "segmentAndCache time" metric. Measures the total wall-clock time spent in processing threads, either operating on segments or retrieving items from cache. Emitted once per segment.- Specified by:
reportSegmentAndCacheTimein interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadTime
Description copied from interface:QueryMetricsRegisters the apparent time spent loading segments on demand, before queing up for processing. This measurement is wall-clock time to when the last segment is finished loading and ready for processing.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadTimein interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadTimeAvg
Description copied from interface:QueryMetricsRegisters the average time spent loading segments on demand across threads.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadTimeAvgin interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadWaitTimeMax
Description copied from interface:QueryMetricsRegisters the maximum time spent loading segments on demand across all load threads.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadWaitTimeMaxin interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadWaitTimeAvg
Description copied from interface:QueryMetricsRegisters the average time spent waiting for a thread to start loading segments on demand across threads.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadWaitTimeAvgin interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadTimeMax
Description copied from interface:QueryMetricsRegisters the maximum time spent waiting for a thread to start loading segments on demand across all load threads.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadTimeMaxin interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadBytes
Description copied from interface:QueryMetricsRegisters the total number of bytes added to the cache when loading segments on demand, summing the sizes loaded by individual segement load threads.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadBytesin interfaceQueryMetrics<SearchQuery>
-
reportSegmentOnDemandLoadCount
Description copied from interface:QueryMetricsRegisters the total numer of segments loaded on demand.Emitted once per query
- Specified by:
reportSegmentOnDemandLoadCountin interfaceQueryMetrics<SearchQuery>
-
reportResultCachePoll
Description copied from interface:QueryMetricsEmits iff a given query polled the result-level cache and the success of that operation.- Specified by:
reportResultCachePollin interfaceQueryMetrics<SearchQuery>
-
reportCpuTime
Description copied from interface:QueryMetricsRegisters "cpu time" metric.- Specified by:
reportCpuTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeTimeToFirstByte
Description copied from interface:QueryMetricsRegisters "time to first byte" metric.- Specified by:
reportNodeTimeToFirstBytein interfaceQueryMetrics<SearchQuery>
-
reportBackPressureTime
Description copied from interface:QueryMetricsRegisters "time that channel is unreadable (backpressure)" metric.- Specified by:
reportBackPressureTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeTime
Description copied from interface:QueryMetricsRegisters "node time" metric.- Specified by:
reportNodeTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeBytes
Description copied from interface:QueryMetricsRegisters "node bytes" metric.- Specified by:
reportNodeBytesin interfaceQueryMetrics<SearchQuery>
-
reportBitmapConstructionTime
Description copied from interface:QueryMetricsReports the time spent constructing bitmap fromQueryMetrics.filterBundle(FilterBundle.BundleInfo)of the query. Not reported, if there are no indexes.- Specified by:
reportBitmapConstructionTimein interfaceQueryMetrics<SearchQuery>
-
reportSegmentRows
Description copied from interface:QueryMetricsReports the total number of rows in the processed segment.- Specified by:
reportSegmentRowsin interfaceQueryMetrics<SearchQuery>
-
reportPreFilteredRows
Description copied from interface:QueryMetricsReports the number of rows to scan in the segment after applyingQueryMetrics.filterBundle(FilterBundle.BundleInfo). If the are no indexes, this metric is equal toQueryMetrics.reportSegmentRows(long).- Specified by:
reportPreFilteredRowsin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeParallelism
Description copied from interface:QueryMetricsReports number of parallel tasks the broker used to process the query during parallel merge. This value is identical to theQueryMetrics.parallelMergeParallelism(int)dimension value, but optionally also available as a metric.- Specified by:
reportParallelMergeParallelismin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeInputSequences
Description copied from interface:QueryMetricsReports total number of input sequences processed by the broker during parallel merge.- Specified by:
reportParallelMergeInputSequencesin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeInputRows
Description copied from interface:QueryMetricsReports total number of input rows processed by the broker during parallel merge.- Specified by:
reportParallelMergeInputRowsin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeOutputRows
Description copied from interface:QueryMetricsReports broker total number of output rows after merging and combining input sequences (should be less than or equal to the value supplied toQueryMetrics.reportParallelMergeInputRows(long).- Specified by:
reportParallelMergeOutputRowsin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeTaskCount
Description copied from interface:QueryMetricsReports broker total number of fork join pool tasks required to complete query- Specified by:
reportParallelMergeTaskCountin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeTotalCpuTime
Description copied from interface:QueryMetricsReports broker total CPU time in nanoseconds where fork join merge combine tasks were doing work- Specified by:
reportParallelMergeTotalCpuTimein interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeTotalTime
Description copied from interface:QueryMetricsReports broker total "wall" time in nanoseconds from parallel merge start sequence creation to total consumption.- Specified by:
reportParallelMergeTotalTimein interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeFastestPartitionTime
Description copied from interface:QueryMetricsReports broker "wall" time in nanoseconds for the fastest parallel merge sequence partition to be 'initialized', where 'initialized' is time to the first result batch is populated from data servers and merging can begin. Similar to query 'time to first byte' metrics, except is a composite of the whole group of data servers which are present in the merge partition, which all must supply an initial result batch before merging can actually begin.- Specified by:
reportParallelMergeFastestPartitionTimein interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeSlowestPartitionTime
Description copied from interface:QueryMetricsReports broker "wall" time in nanoseconds for the slowest parallel merge sequence partition to be 'initialized', where 'initialized' is time to the first result batch is populated from data servers and merging can begin. Similar to query 'time to first byte' metrics, except is a composite of the whole group of data servers which are present in the merge partition, which all must supply an initial result batch before merging can actually begin.- Specified by:
reportParallelMergeSlowestPartitionTimein interfaceQueryMetrics<SearchQuery>
-
reportQueriedSegmentCount
Description copied from interface:QueryMetricsRegisters "segments queried count" metric.- Specified by:
reportQueriedSegmentCountin interfaceQueryMetrics<SearchQuery>
-
emit
Description copied from interface:QueryMetricsEmits all metrics, registered since the lastemit()call on this QueryMetrics object.- Specified by:
emitin interfaceQueryMetrics<SearchQuery>
-