Configurable brokerService for console queries#19069
Conversation
|
There is also the case where broker1 watches ["t1","t2"] and broker2 watches ["t3","t4"]. In this case, to get a complete view both need to be queried. Would this case work as well? |
Thanks for the review @abhishek-chouhan! This case is not covered. This would be more invasive as it requires merging BrokerServerView from broker1 and broker2. In this scenario I think it would be simpler to spin up an additional broker (e.g. druid/broker-admin) which watches all tiers and configure consoleBrokerService to point there. |
|
|
||
| // Broker service name to use for all console SQL queries (for tier isolation) | ||
| // This injects "brokerService" into the query context for routing via the manual strategy | ||
| consoleBrokerService?: string; |
There was a problem hiding this comment.
What do you think about exposing this config via web-console-config.tsx as well? It has this dialog on the console, which seems cool:
I think web-console-config.tsx is session-based that stores config overrides in the browser, while the ConsoleConfig from console-config.js is persistent via the build. Not super familiar with the web-console code here, so correct me if I'm missing something here.
Can console-config.js be overridden per environment, given that this file is baked into the build as part of the source code?
There was a problem hiding this comment.
Thanks for the review @abhishekrb19!
Yeah the console-config.js is persistent via the build, so overriding per environment is not possible. For our own use case this would still be fine, since it would fall back to the default druid/broker if the configured brokerService doesn't exist. Let me take a look at web-console-config.tsx
| } | ||
| : sqlQueryPayload; | ||
|
|
||
| sqlResultResp = await Api.instance.post('/druid/v2/sql', payload, { signal }); |
There was a problem hiding this comment.
I see that https://github.com/apache/druid/blob/master/web-console/src/views/explore-view/explore-view.tsx#L64
directly calls the /druid/v2/sql endpoint without invoking queryDruidSql. Should we update it to use this function instead, so the context is appended for the Explore view as well?
There was a problem hiding this comment.
Since the Explore tab is more for user-issued queries I thought to leave it out for now. I wanted to limit the scope of this to just Router console queries
There was a problem hiding this comment.
Ah I see, thanks for clarifying. I got tripped up by the name consoleBrokerService - I assumed all queries originating from the console would use this, but it sounds like only the console-generated system queries would use it.
What do you think about renaming this to something less ambiguous, like consoleSystemQueryBrokerService? Alternatively, we could leave the name as-is if we expect the scope to expand in the future and instead clarify it in the help text and documentation along with the limitation that @abhishek-chouhan mentioned with watch tiers (this can be done separately in a follow up PR)
There was a problem hiding this comment.
Thanks @abhishekrb19 this makes sense. Let me update the name to make clear that it is only for system queries
I do think we need the merging functionality to support the watchedTiers functionality in its entirety. While the workaround with a separate broker works, its too heavy of a workaround just to make the console work with watchedTiers. |
There was a problem hiding this comment.
Since brokerService is part of the query context, would setting baseQueryContext or defaultQueryContext in console-config.js work out of the box?
There was a problem hiding this comment.
These settings only apply to queries run from the Query tab and not the console queries
abhishekrb19
left a comment
There was a problem hiding this comment.
Lgtm, thanks @aho135!

Description
When using the manual routing strategy in combination with
druid.broker.segment.watchedTierswe are losing console visibility for Historicals. This can happen with the combination of configurationsRouter
broker1
broker2
Since the Router query goes to druid/broker1 which has limited segment visibility, the console will incorrectly report Historicals in t3/t4 as having no data. This patch allows us to configure Router console queries to go to druid/broker2 instead so that the console can have full visibility over Historicals.
Release note
Allows operators to configure brokerService for Router console queries. This can be accomplished by setting something like
in web-console/console-config.js
Key changed/added classes in this PR
druid-query.tsentry.tsxThis PR has: