leventov closed pull request #6473: QueryCountStatsMonitor: emit query/count
URL: https://github.com/apache/incubator-druid/pull/6473
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/content/operations/metrics.md
b/docs/content/operations/metrics.md
index e08aecb04b2..5144b0acb04 100644
--- a/docs/content/operations/metrics.md
+++ b/docs/content/operations/metrics.md
@@ -35,6 +35,7 @@ Available Metrics
|`query/node/ttfb`|Time to first byte. Milliseconds elapsed until broker
starts receiving the response from individual historical/realtime nodes.|id,
status, server.|< 1s|
|`query/node/backpressure`|Milliseconds that the channel to this node has
spent suspended due to backpressure.|id, status, server.| |
|`query/intervalChunk/time`|Only emitted if interval chunking is enabled.
Milliseconds required to query an interval chunk.|id, status, chunkInterval (if
interval chunking is enabled).|< 1s|
+|`query/count`|number of total queries|This metric is only available if the
QueryCountStatsMonitor module is included.||
|`query/success/count`|number of queries successfully processed|This metric is
only available if the QueryCountStatsMonitor module is included.||
|`query/failed/count`|number of failed queries|This metric is only available
if the QueryCountStatsMonitor module is included.||
|`query/interrupted/count`|number of queries interrupted due to cancellation
or timeout|This metric is only available if the QueryCountStatsMonitor module
is included.||
@@ -49,6 +50,7 @@ Available Metrics
|`segment/scan/pending`|Number of segments in queue waiting to be
scanned.||Close to 0|
|`query/segmentAndCache/time`|Milliseconds taken to query individual segment
or hit the cache (if it is enabled on the historical node).|id,
segment.|several hundred milliseconds|
|`query/cpu/time`|Microseconds of CPU time taken to complete a query|Common:
dataSource, type, interval, hasFilters, duration, context, remoteAddress, id.
Aggregation Queries: numMetrics, numComplexMetrics. GroupBy: numDimensions.
TopN: threshold, dimension.|Varies|
+|`query/count`|number of total queries|This metric is only available if the
QueryCountStatsMonitor module is included.||
|`query/success/count`|number of queries successfully processed|This metric is
only available if the QueryCountStatsMonitor module is included.||
|`query/failed/count`|number of failed queries|This metric is only available
if the QueryCountStatsMonitor module is included.||
|`query/interrupted/count`|number of queries interrupted due to cancellation
or timeout|This metric is only available if the QueryCountStatsMonitor module
is included.||
@@ -60,6 +62,7 @@ Available Metrics
|`query/time`|Milliseconds taken to complete a query.|Common: dataSource,
type, interval, hasFilters, duration, context, remoteAddress, id. Aggregation
Queries: numMetrics, numComplexMetrics. GroupBy: numDimensions. TopN:
threshold, dimension.|< 1s|
|`query/wait/time`|Milliseconds spent waiting for a segment to be scanned.|id,
segment.|several hundred milliseconds|
|`segment/scan/pending`|Number of segments in queue waiting to be
scanned.||Close to 0|
+|`query/count`|number of total queries|This metric is only available if the
QueryCountStatsMonitor module is included.||
|`query/success/count`|number of queries successfully processed|This metric is
only available if the QueryCountStatsMonitor module is included.||
|`query/failed/count`|number of failed queries|This metric is only available
if the QueryCountStatsMonitor module is included.||
|`query/interrupted/count`|number of queries interrupted due to cancellation
or timeout|This metric is only available if the QueryCountStatsMonitor module
is included.||
diff --git
a/server/src/main/java/org/apache/druid/server/metrics/QueryCountStatsMonitor.java
b/server/src/main/java/org/apache/druid/server/metrics/QueryCountStatsMonitor.java
index 6d88dc66950..e217e8de804 100644
---
a/server/src/main/java/org/apache/druid/server/metrics/QueryCountStatsMonitor.java
+++
b/server/src/main/java/org/apache/druid/server/metrics/QueryCountStatsMonitor.java
@@ -44,11 +44,16 @@ public QueryCountStatsMonitor(
public boolean doMonitor(ServiceEmitter emitter)
{
final ServiceMetricEvent.Builder builder = new
ServiceMetricEvent.Builder();
+ final long successfulQueryCount = statsProvider.getSuccessfulQueryCount();
+ final long failedQueryCount = statsProvider.getFailedQueryCount();
+ final long interruptedQueryCount =
statsProvider.getInterruptedQueryCount();
Map<String, Long> diff = keyedDiff.to(
"queryCountStats",
- ImmutableMap.of("query/success/count",
statsProvider.getSuccessfulQueryCount(),
- "query/failed/count",
statsProvider.getFailedQueryCount(),
- "query/interrupted/count",
statsProvider.getInterruptedQueryCount()
+ ImmutableMap.of(
+ "query/count", successfulQueryCount + failedQueryCount +
interruptedQueryCount,
+ "query/success/count", successfulQueryCount,
+ "query/failed/count", failedQueryCount,
+ "query/interrupted/count", interruptedQueryCount
)
);
if (diff != null) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]