Emit QueryCountMetrics for SQL Queries #17452
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11652.
Description
This pulls out the query count metrics logic from
QueryResource
and places it intoBaseQueryCounterResource
, which allows forSqlResource
to share this codepath. An alternative approach is here, which avoids shared logic between the two resources. As stated in the issue, the ideal change would be to haveSqlResource
inherit, or simply pass on, all query handling toQueryResource
, but that seemed a bit out of scope for this PR (but I can do this).Notes:
QueryResource
andSqlResource
for simplicity, and simply made the counter package-private for accessing in tests. I can add theget()
accessors back if necessary.Release note
Key changed/added classes in this PR
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/controller/http/DartSqlResource.java
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/dart/controller/http/DartSqlResourceTest.java
quidem-ut/src/main/java/org/apache/druid/quidem/ExposedAsBrokerQueryComponentSupplierWrapper.java
server/src/main/java/org/apache/druid/server/BaseQueryCountResource.java
server/src/main/java/org/apache/druid/server/BrokerQueryResource.java
server/src/main/java/org/apache/druid/server/QueryMetricCounter.java
server/src/main/java/org/apache/druid/server/QueryResource.java
server/src/main/java/org/apache/druid/server/QueryResultPusher.java
server/src/test/java/org/apache/druid/server/QueryResourceTest.java
server/src/test/java/org/apache/druid/server/QueryResultPusherTest.java
services/src/main/java/org/apache/druid/cli/CliBroker.java
services/src/main/java/org/apache/druid/cli/CliHistorical.java
services/src/main/java/org/apache/druid/guice/QueryablePeonModule.java
sql/src/main/java/org/apache/druid/sql/http/SqlResource.java
sql/src/test/java/org/apache/druid/sql/http/SqlResourceTest.java
This PR has: