-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Configurable brokerService for console queries #19069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -322,13 +322,35 @@ export class DruidError extends Error { | |
| } | ||
| } | ||
|
|
||
| // Broker service to use for all console queries (for tier isolation) | ||
| let consoleBrokerService: string | undefined; | ||
|
|
||
| export function setConsoleBrokerService(brokerService: string | undefined): void { | ||
| consoleBrokerService = brokerService; | ||
| } | ||
|
|
||
| export function getConsoleBrokerService(): string | undefined { | ||
| return consoleBrokerService; | ||
| } | ||
|
Comment on lines
+332
to
+334
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this used anywhere? |
||
|
|
||
| export async function queryDruidRune( | ||
| runeQuery: Record<string, any>, | ||
| signal?: AbortSignal, | ||
| ): Promise<any> { | ||
| let runeResultResp: AxiosResponse; | ||
| try { | ||
| runeResultResp = await Api.instance.post('/druid/v2', runeQuery, { signal }); | ||
| // Inject brokerService into context if configured | ||
| const query = consoleBrokerService | ||
| ? { | ||
| ...runeQuery, | ||
| context: { | ||
| ...runeQuery.context, | ||
| brokerService: consoleBrokerService, | ||
| }, | ||
| } | ||
| : runeQuery; | ||
|
|
||
| runeResultResp = await Api.instance.post('/druid/v2', query, { signal }); | ||
| } catch (e) { | ||
| throw new Error(getDruidErrorMessage(e)); | ||
| } | ||
|
|
@@ -341,7 +363,18 @@ export async function queryDruidSql<T = any>( | |
| ): Promise<T[]> { | ||
| let sqlResultResp: AxiosResponse; | ||
| try { | ||
| sqlResultResp = await Api.instance.post('/druid/v2/sql', sqlQueryPayload, { signal }); | ||
| // Inject brokerService into context if configured | ||
| const payload = consoleBrokerService | ||
| ? { | ||
| ...sqlQueryPayload, | ||
| context: { | ||
| ...sqlQueryPayload.context, | ||
| brokerService: consoleBrokerService, | ||
| }, | ||
| } | ||
| : sqlQueryPayload; | ||
|
|
||
| sqlResultResp = await Api.instance.post('/druid/v2/sql', payload, { signal }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that https://github.com/apache/druid/blob/master/web-console/src/views/explore-view/explore-view.tsx#L64 |
||
| } catch (e) { | ||
| throw new Error(getDruidErrorMessage(e)); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about exposing this config via
web-console-config.tsxas well? It has this dialog on the console, which seems cool:I think
web-console-config.tsxis session-based that stores config overrides in the browser, while theConsoleConfigfromconsole-config.jsis 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.jsbe overridden per environment, given that this file is baked into the build as part of the source code?