Package org.apache.druid.query.search
Class DefaultSearchQueryMetrics
- java.lang.Object
-
- org.apache.druid.query.search.DefaultSearchQueryMetrics
-
- All Implemented Interfaces:
QueryMetrics<SearchQuery>,SearchQueryMetrics
public class DefaultSearchQueryMetrics extends Object implements 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 inQueryMetricsjavadoc.
-
-
Constructor Summary
Constructors Constructor Description DefaultSearchQueryMetrics(QueryMetrics<Query<?>> queryMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontext(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.voididentity(String identity)Sets identity of the requester for a query.voidinterval(SearchQuery query)SetsQuery.getIntervals()of the given query as dimension.BitmapResultFactory<?>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.voidquery(SearchQuery query)Pulls all information from the query object into dimensions of future metrics.voidqueryId(String queryId)Sets 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)QueryMetricsreportBackPressureTime(long timeNs)Registers "time that channel is unreadable (backpressure)" metric.QueryMetricsreportBitmapConstructionTime(long timeNs)Reports the time spent constructing bitmap fromQueryMetrics.filterBundle(FilterBundle.BundleInfo)of the query.QueryMetricsreportCpuTime(long timeNs)Registers "cpu time" metric.QueryMetricsreportNodeBytes(long byteCount)Registers "node bytes" metric.QueryMetricsreportNodeTime(long timeNs)Registers "node time" metric.QueryMetricsreportNodeTimeToFirstByte(long timeNs)Registers "time to first byte" metric.QueryMetricsreportParallelMergeFastestPartitionTime(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.QueryMetricsreportParallelMergeInputRows(long numRows)Reports total number of input rows processed by the broker during parallel merge.QueryMetricsreportParallelMergeInputSequences(long numSequences)Reports total number of input sequences processed by the broker during parallel merge.QueryMetricsreportParallelMergeOutputRows(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).QueryMetricsreportParallelMergeParallelism(int parallelism)Reports number of parallel tasks the broker used to process the query during parallel merge.QueryMetricsreportParallelMergeSlowestPartitionTime(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.QueryMetricsreportParallelMergeTaskCount(long numTasks)Reports broker total number of fork join pool tasks required to complete queryQueryMetricsreportParallelMergeTotalCpuTime(long timeNs)Reports broker total CPU time in nanoseconds where fork join merge combine tasks were doing workQueryMetricsreportParallelMergeTotalTime(long timeNs)Reports broker total "wall" time in nanoseconds from parallel merge start sequence creation to total consumption.QueryMetricsreportPreFilteredRows(long numRows)Reports the number of rows to scan in the segment after applyingQueryMetrics.filterBundle(FilterBundle.BundleInfo).QueryMetricsreportQueriedSegmentCount(long segmentCount)Registers "segments queried count" metric.QueryMetricsreportQueryBytes(long byteCount)Registers "query bytes" metric.QueryMetricsreportQueryTime(long timeNs)Registers "query time" metric.QueryMetricsreportSegmentAndCacheTime(long timeNs)Registers "segmentAndCache time" metric.QueryMetricsreportSegmentRows(long numRows)Reports the total number of rows in the processed segment.QueryMetricsreportSegmentTime(long timeNs)Registers "segment time" metric.QueryMetricsreportWaitTime(long timeNs)Registers "wait time" metric.voidsegment(String segmentIdentifier)voidserver(String host)voidsqlQueryId(String sqlQueryId)Sets sqlQueryId as a dimensionvoidsqlQueryId(SearchQuery query)SetsQuery.getSqlQueryId()of the given query as dimensionvoidstatus(String status)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, wait
-
Methods inherited from interface org.apache.druid.query.QueryMetrics
postFilters, preFilters
-
-
-
-
Constructor Detail
-
DefaultSearchQueryMetrics
public DefaultSearchQueryMetrics(QueryMetrics<Query<?>> queryMetrics)
-
-
Method Detail
-
query
public void query(SearchQuery query)
Description copied from interface:QueryMetricsPulls all information from the query object into dimensions of future metrics.- Specified by:
queryin interfaceQueryMetrics<SearchQuery>
-
dataSource
public void dataSource(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getDataSource()of the given query as dimension.- Specified by:
dataSourcein interfaceQueryMetrics<SearchQuery>
-
queryType
public void queryType(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getType()of the given query as dimension.- Specified by:
queryTypein interfaceQueryMetrics<SearchQuery>
-
interval
public void interval(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getIntervals()of the given query as dimension.- Specified by:
intervalin interfaceQueryMetrics<SearchQuery>
-
hasFilters
public void hasFilters(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.hasFilters()of the given query as dimension.- Specified by:
hasFiltersin interfaceQueryMetrics<SearchQuery>
-
duration
public void duration(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getDuration()of the given query as dimension.- Specified by:
durationin interfaceQueryMetrics<SearchQuery>
-
queryId
public void queryId(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getId()of the given query as dimension.- Specified by:
queryIdin interfaceQueryMetrics<SearchQuery>
-
queryId
public void queryId(String queryId)
Description copied from interface:QueryMetricsSets id of the given query as dimension.- Specified by:
queryIdin interfaceQueryMetrics<SearchQuery>
-
subQueryId
public void subQueryId(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getSubQueryId()of the given query as dimension.- Specified by:
subQueryIdin interfaceQueryMetrics<SearchQuery>
-
sqlQueryId
public void sqlQueryId(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getSqlQueryId()of the given query as dimension- Specified by:
sqlQueryIdin interfaceQueryMetrics<SearchQuery>
-
sqlQueryId
public void sqlQueryId(String sqlQueryId)
Description copied from interface:QueryMetricsSets sqlQueryId as a dimension- Specified by:
sqlQueryIdin interfaceQueryMetrics<SearchQuery>
-
granularity
public void granularity(SearchQuery query)
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
public void context(SearchQuery query)
Description copied from interface:QueryMetricsSetsQuery.getContext()of the given query as dimension.- Specified by:
contextin interfaceQueryMetrics<SearchQuery>
-
server
public void server(String host)
- Specified by:
serverin interfaceQueryMetrics<SearchQuery>
-
remoteAddress
public void remoteAddress(String remoteAddress)
- Specified by:
remoteAddressin interfaceQueryMetrics<SearchQuery>
-
status
public void status(String status)
- Specified by:
statusin interfaceQueryMetrics<SearchQuery>
-
success
public void success(boolean success)
- Specified by:
successin interfaceQueryMetrics<SearchQuery>
-
segment
public void segment(String segmentIdentifier)
- Specified by:
segmentin interfaceQueryMetrics<SearchQuery>
-
filterBundle
public void filterBundle(FilterBundle.BundleInfo bundleInfo)
- Specified by:
filterBundlein interfaceQueryMetrics<SearchQuery>
-
identity
public void identity(String 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
public BitmapResultFactory<?> makeBitmapResultFactory(BitmapFactory factory)
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
public QueryMetrics reportQueryTime(long timeNs)
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
public QueryMetrics reportQueryBytes(long byteCount)
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
public QueryMetrics reportWaitTime(long timeNs)
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
public QueryMetrics reportSegmentTime(long timeNs)
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
public QueryMetrics reportSegmentAndCacheTime(long timeNs)
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>
-
reportCpuTime
public QueryMetrics reportCpuTime(long timeNs)
Description copied from interface:QueryMetricsRegisters "cpu time" metric.- Specified by:
reportCpuTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeTimeToFirstByte
public QueryMetrics reportNodeTimeToFirstByte(long timeNs)
Description copied from interface:QueryMetricsRegisters "time to first byte" metric.- Specified by:
reportNodeTimeToFirstBytein interfaceQueryMetrics<SearchQuery>
-
reportBackPressureTime
public QueryMetrics reportBackPressureTime(long timeNs)
Description copied from interface:QueryMetricsRegisters "time that channel is unreadable (backpressure)" metric.- Specified by:
reportBackPressureTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeTime
public QueryMetrics reportNodeTime(long timeNs)
Description copied from interface:QueryMetricsRegisters "node time" metric.- Specified by:
reportNodeTimein interfaceQueryMetrics<SearchQuery>
-
reportNodeBytes
public QueryMetrics reportNodeBytes(long byteCount)
Description copied from interface:QueryMetricsRegisters "node bytes" metric.- Specified by:
reportNodeBytesin interfaceQueryMetrics<SearchQuery>
-
reportBitmapConstructionTime
public QueryMetrics reportBitmapConstructionTime(long timeNs)
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
public QueryMetrics reportSegmentRows(long numRows)
Description copied from interface:QueryMetricsReports the total number of rows in the processed segment.- Specified by:
reportSegmentRowsin interfaceQueryMetrics<SearchQuery>
-
reportPreFilteredRows
public QueryMetrics reportPreFilteredRows(long numRows)
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
public QueryMetrics reportParallelMergeParallelism(int parallelism)
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
public QueryMetrics reportParallelMergeInputSequences(long numSequences)
Description copied from interface:QueryMetricsReports total number of input sequences processed by the broker during parallel merge.- Specified by:
reportParallelMergeInputSequencesin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeInputRows
public QueryMetrics reportParallelMergeInputRows(long numRows)
Description copied from interface:QueryMetricsReports total number of input rows processed by the broker during parallel merge.- Specified by:
reportParallelMergeInputRowsin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeOutputRows
public QueryMetrics reportParallelMergeOutputRows(long numRows)
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
public QueryMetrics reportParallelMergeTaskCount(long numTasks)
Description copied from interface:QueryMetricsReports broker total number of fork join pool tasks required to complete query- Specified by:
reportParallelMergeTaskCountin interfaceQueryMetrics<SearchQuery>
-
reportParallelMergeTotalCpuTime
public QueryMetrics reportParallelMergeTotalCpuTime(long timeNs)
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
public QueryMetrics reportParallelMergeTotalTime(long timeNs)
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
public QueryMetrics reportParallelMergeFastestPartitionTime(long timeNs)
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
public QueryMetrics reportParallelMergeSlowestPartitionTime(long timeNs)
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
public QueryMetrics reportQueriedSegmentCount(long segmentCount)
Description copied from interface:QueryMetricsRegisters "segments queried count" metric.- Specified by:
reportQueriedSegmentCountin interfaceQueryMetrics<SearchQuery>
-
emit
public void emit(ServiceEmitter emitter)
Description copied from interface:QueryMetricsEmits all metrics, registered since the lastemit()call on this QueryMetrics object.- Specified by:
emitin interfaceQueryMetrics<SearchQuery>
-
-