Skip to content

Add controller execution time tracking to query responses#17647

Closed
Akanksha-kedia wants to merge 1 commit intoapache:masterfrom
Akanksha-kedia:feature/add-query-execution-time
Closed

Add controller execution time tracking to query responses#17647
Akanksha-kedia wants to merge 1 commit intoapache:masterfrom
Akanksha-kedia:feature/add-query-execution-time

Conversation

@Akanksha-kedia
Copy link
Contributor

  • Add controllerExecutionTimeMs field to BrokerResponseNative
  • Include in JSON serialization order after timeUsedMs
  • Initialize to -1 to indicate when not applicable
  • Add getter/setter methods with proper JavaDoc

This provides visibility into controller-level query performance for monitoring and debugging purposes.

Instructions:

  1. The PR has to be tagged with at least one of the following labels (*):
    1. feature
    2. bugfix
    3. performance
    4. ui
    5. backward-incompat
    6. release-notes (**)
  2. Remove these instructions before publishing the PR.

(*) Other labels to consider:

  • testing
  • dependencies
  • docker
  • kubernetes
  • observability
  • security
  • code-style
  • extension-point
  • refactor
  • cleanup

(**) Use release-notes label for scenarios like:

  • New configuration options
  • Deprecation of configurations
  • Signature changes to public methods/interfaces
  • New plugins added or old plugins removed

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
10777 2 10775 51
View the top 3 failed test(s) by shortest run time
org.apache.pinot.controller.api.PinotTableRestletResourceTest::testTableTasksCleanupWithNonActiveTasks
Stack Traces | 0.303s run time
org.apache.pinot.common.exception.HttpErrorStatusException: Got error status code: 500 (Internal Server Error) with reason: "Failed to delete job: TaskQueue_SegmentGenerationAndPushTask_Task_SegmentGenerationAndPushTask_52e95dd7-956a-4999-998b-8157760fbc6b_1771228024771 from queue: TaskQueue_SegmentGenerationAndPushTask" while sending request: /tables/testTableTasksCleanup to controller: runnervmjduv7.05rezmjsgo0uhcd5gcpy44asec.ex.internal.cloudapp.net, version: Unknown
org.apache.pinot.controller.api.PinotTableRestletResourceTest::testTableTasksCleanupWithNonActiveTasks
Stack Traces | 0.43s run time
org.apache.pinot.common.exception.HttpErrorStatusException: Got error status code: 500 (Internal Server Error) with reason: "Failed to delete job: TaskQueue_SegmentGenerationAndPushTask_Task_SegmentGenerationAndPushTask_52e95dd7-956a-4999-998b-8157760fbc6b_1771228024771 from queue: TaskQueue_SegmentGenerationAndPushTask" while sending request: /tables/testTableTasksCleanup to controller: runnervmjduv7.05rezmjsgo0uhcd5gcpy44asec.ex.internal.cloudapp.net, version: Unknown
org.apache.pinot.integration.tests.TimeSeriesIntegrationTest::testControllerTimeseriesEndpoints
Stack Traces | 0.537s run time
Status field should not be null in timeseries query response expected object to not be null
org.apache.pinot.integration.tests.TimeSeriesAuthIntegrationTest::testControllerTimeseriesEndpoints
Stack Traces | 0.558s run time
Status field should not be null in timeseries query response expected object to not be null

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@Akanksha-kedia Akanksha-kedia force-pushed the feature/add-query-execution-time branch 3 times, most recently from e02b275 to b6687bc Compare February 6, 2026 09:56
@shauryachats
Copy link
Collaborator

@Akanksha-kedia is this only for queries executed through Controller UI? If yes, could we instead consider modifying only the controller APIs to additionally bundle the controller execution time given that most of the queries would generally be through the broker itself and this increases the response size without providing any additional information for broker queries.

@Akanksha-kedia Akanksha-kedia force-pushed the feature/add-query-execution-time branch 2 times, most recently from 4c72c36 to 4a3ab1b Compare February 14, 2026 15:28
@Akanksha-kedia
Copy link
Contributor Author

curl -X POST http://localhost:9001/sql -H "Content-Type: application/json" -d '{"sql":"SELECT COUNT(*) FROM baseballStats"}' | jq .

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1610 100 1566 100 44 28979 814 --:--:-- --:--:-- --:--:-- 29814
{
"resultTable": {
"dataSchema": {
"columnNames": [
"count(*)"
],
"columnDataTypes": [
"LONG"
]
},
"rows": [
[
97889
]
]
},
"numRowsResultSet": 1,
"partialResult": false,
"exceptions": [],
"numGroupsLimitReached": false,
"numGroupsWarningLimitReached": false,
"timeUsedMs": 10,
"controllerExecutionTimeMs": 25,
"requestId": "1648150687000000002",
"clientRequestId": null,
"brokerId": "Broker_localhost_8099",
"numDocsScanned": 97889,
"totalDocs": 97889,
"numEntriesScannedInFilter": 0,
"numEntriesScannedPostFilter": 0,
"numServersQueried": 1,
"numServersResponded": 1,
"numSegmentsQueried": 1,
"numSegmentsProcessed": 1,
"numSegmentsMatched": 1,
"numConsumingSegmentsQueried": 0,
"numConsumingSegmentsProcessed": 0,
"numConsumingSegmentsMatched": 0,
"minConsumingFreshnessTimeMs": 0,
"numSegmentsPrunedByBroker": 0,
"numSegmentsPrunedByServer": 0,
"numSegmentsPrunedInvalid": 0,
"numSegmentsPrunedByLimit": 0,
"numSegmentsPrunedByValue": 0,
"brokerReduceTimeMs": 0,
"offlineThreadCpuTimeNs": 0,
"realtimeThreadCpuTimeNs": 0,
"offlineSystemActivitiesCpuTimeNs": 0,
"realtimeSystemActivitiesCpuTimeNs": 0,
"offlineResponseSerializationCpuTimeNs": 0,
"realtimeResponseSerializationCpuTimeNs": 0,
"offlineTotalCpuTimeNs": 0,
"realtimeTotalCpuTimeNs": 0,
"explainPlanNumEmptyFilterSegments": 0,
"explainPlanNumMatchAllFilterSegments": 0,
"traceInfo": {},
"tablesQueried": [
"baseballStats"
],
"offlineThreadMemAllocatedBytes": 0,
"realtimeThreadMemAllocatedBytes": 0,
"offlineResponseSerMemAllocatedBytes": 0,
"realtimeResponseSerMemAllocatedBytes": 0,
"offlineTotalMemAllocatedBytes": 0,
"realtimeTotalMemAllocatedBytes": 0,
"pools": [
-1
],
"rlsFiltersApplied": false,
"groupsTrimmed": false
}

@Akanksha-kedia
Copy link
Contributor Author

curl -X POST http://localhost:8099/query/sql -H "Content-Type: application/json" -d '{"sql":"SELECT COUNT() FROM baseballStats"}' | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1610 100 1566 100 44 22778 640 --:--:-- --:--:-- --:--:-- 23676
{
"resultTable": {
"dataSchema": {
"columnNames": [
"count(
)"
],
"columnDataTypes": [
"LONG"
]
},
"rows": [
[
97889
]
]
},
"numRowsResultSet": 1,
"partialResult": false,
"exceptions": [],
"numGroupsLimitReached": false,
"numGroupsWarningLimitReached": false,
"timeUsedMs": 37,
"controllerExecutionTimeMs": -1,
"requestId": "1648150687000000004",
"clientRequestId": null,
"brokerId": "Broker_localhost_8099",
"numDocsScanned": 97889,
"totalDocs": 97889,
"numEntriesScannedInFilter": 0,
"numEntriesScannedPostFilter": 0,
"numServersQueried": 1,
"numServersResponded": 1,
"numSegmentsQueried": 1,
"numSegmentsProcessed": 1,
"numSegmentsMatched": 1,
"numConsumingSegmentsQueried": 0,
"numConsumingSegmentsProcessed": 0,
"numConsumingSegmentsMatched": 0,
"minConsumingFreshnessTimeMs": 0,
"numSegmentsPrunedByBroker": 0,
"numSegmentsPrunedByServer": 0,
"numSegmentsPrunedInvalid": 0,
"numSegmentsPrunedByLimit": 0,
"numSegmentsPrunedByValue": 0,
"brokerReduceTimeMs": 0,
"offlineThreadCpuTimeNs": 0,
"realtimeThreadCpuTimeNs": 0,
"offlineSystemActivitiesCpuTimeNs": 0,
"realtimeSystemActivitiesCpuTimeNs": 0,
"offlineResponseSerializationCpuTimeNs": 0,
"realtimeResponseSerializationCpuTimeNs": 0,
"offlineTotalCpuTimeNs": 0,
"realtimeTotalCpuTimeNs": 0,
"explainPlanNumEmptyFilterSegments": 0,
"explainPlanNumMatchAllFilterSegments": 0,
"traceInfo": {},
"tablesQueried": [
"baseballStats"
],
"offlineThreadMemAllocatedBytes": 0,
"realtimeThreadMemAllocatedBytes": 0,
"offlineResponseSerMemAllocatedBytes": 0,
"realtimeResponseSerMemAllocatedBytes": 0,
"offlineTotalMemAllocatedBytes": 0,
"realtimeTotalMemAllocatedBytes": 0,
"pools": [
-1
],
"rlsFiltersApplied": false,
"groupsTrimmed": false
}

@Akanksha-kedia
Copy link
Contributor Author

@shauryachats please see

@Akanksha-kedia Akanksha-kedia force-pushed the feature/add-query-execution-time branch 2 times, most recently from a86cefe to 76e6973 Compare February 16, 2026 06:51
- Add controllerExecutionTimeMs field to BrokerResponseNative with default value -1
- Use @JsonInclude(JsonInclude.Include.NON_DEFAULT) to exclude field when not set
- Update controller's sendRequestRaw to capture broker response, add execution time, and re-serialize
- Field only appears in controller query responses, not in direct broker queries
- Keeps response size minimal for broker queries while providing execution time for controller queries
- Addresses reviewer feedback to avoid increasing response size unnecessarily
@Akanksha-kedia Akanksha-kedia force-pushed the feature/add-query-execution-time branch from 76e6973 to c212060 Compare February 16, 2026 07:07
@Akanksha-kedia Akanksha-kedia deleted the feature/add-query-execution-time branch February 16, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants