Skip to content

Add controller execution time tracking to query responses #17709

Open
Akanksha-kedia wants to merge 1 commit intoapache:masterfrom
Akanksha-kedia:fix-timeseries-controller-status-field
Open

Add controller execution time tracking to query responses #17709
Akanksha-kedia wants to merge 1 commit intoapache:masterfrom
Akanksha-kedia:fix-timeseries-controller-status-field

Conversation

@Akanksha-kedia
Copy link
Contributor

…meseries responses

  • Add sendTimeSeriesRequestRaw method to handle timeseries responses without parsing as BrokerResponseNative
  • Update sendTimeSeriesRequestToBroker to use raw forwarding for both GET and POST endpoints
  • Fix GET endpoint method signature to use proper executeTimeSeriesQueryCatching parameters
  • Ensures controller preserves broker's PinotBrokerTimeSeriesResponse structure with status field
  • Resolves test failure: 'Status field should not be null in timeseries query response'

The issue was that controller was incorrectly trying to parse timeseries responses as BrokerResponseNative and add execution time, but timeseries responses use PinotBrokerTimeSeriesResponse with different structure. This fix preserves the original Prometheus-compatible response format from the broker.

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

…meseries responses

- Add sendTimeSeriesRequestRaw method to handle timeseries responses without parsing as BrokerResponseNative
- Update sendTimeSeriesRequestToBroker to use raw forwarding for both GET and POST endpoints
- Fix GET endpoint method signature to use proper executeTimeSeriesQueryCatching parameters
- Ensures controller preserves broker's PinotBrokerTimeSeriesResponse structure with status field
- Resolves test failure: 'Status field should not be null in timeseries query response'

The issue was that controller was incorrectly trying to parse timeseries responses as BrokerResponseNative
and add execution time, but timeseries responses use PinotBrokerTimeSeriesResponse with different structure.
This fix preserves the original Prometheus-compatible response format from the broker.
@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
}

(#17647 (comment))
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 @xiangfu0 @Jackie-Jiang please review

@Akanksha-kedia Akanksha-kedia changed the title Fix TimeSeriesIntegrationTest: Preserve status field in controller ti… Add controller execution time tracking to query responses Feb 16, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 16.00000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.21%. Comparing base (ca952da) to head (d6e986e).
⚠️ Report is 39 commits behind head on master.

Files with missing lines Patch % Lines
...t/controller/api/resources/PinotQueryResource.java 0.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             master   #17709    +/-   ##
==========================================
  Coverage     63.20%   63.21%            
- Complexity     1499     1502     +3     
==========================================
  Files          3173     3179     +6     
  Lines        190257   190731   +474     
  Branches      29072    29153    +81     
==========================================
+ Hits         120261   120574   +313     
- Misses        60662    60775   +113     
- Partials       9334     9382    +48     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 63.19% <16.00%> (+0.01%) ⬆️
java-21 63.16% <16.00%> (+<0.01%) ⬆️
temurin 63.21% <16.00%> (+<0.01%) ⬆️
unittests 63.21% <16.00%> (+<0.01%) ⬆️
unittests1 55.61% <100.00%> (+0.01%) ⬆️
unittests2 34.06% <16.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants