gianm commented on code in PR #18121:
URL: https://github.com/apache/druid/pull/18121#discussion_r2178274043
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -553,11 +554,31 @@ private MSQTaskReportPayload runInternal(final
QueryListener queryListener, fina
countersSnapshot,
null
);
- // Emit summary metrics
+ // Emit metrics
+ emitQueryMetrics(queryDef, taskStateForReport.isSuccess());
emitSummaryMetrics(msqTaskReportPayload, querySpec);
return msqTaskReportPayload;
}
+ private void emitQueryMetrics(@Nullable final QueryDefinition queryDef,
final boolean success)
+ {
+ final Set<String> datasources = new HashSet<>();
+ final Set<Interval> intervals = new HashSet<>();
+ if (queryDef != null) {
+ for (StageDefinition stageDefinition : queryDef.getStageDefinitions()) {
+ datasources.addAll(MSQMetricUtils.getDatasources(stageDefinition));
+ intervals.addAll(MSQMetricUtils.getIntervals(stageDefinition));
+ }
+ }
+
+ long startTime =
DateTimeUtils.getInstantMillis(MultiStageQueryContext.getStartTime(querySpec.getContext()));
+ context.emitMetric(
+ "query/time",
+ MSQMetricUtils.createQueryMetricDimensions(datasources, intervals,
success),
+ startTime - System.currentTimeMillis()
Review Comment:
Ah, yes, that would work too. It's kind of equivalent (the `metricBuilder`
has a metric name, value, and dimensions in it) but bundled together more
nicely. @adarshsanjeev - could you try this approach? It looks like it could be
cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]