Skip to content

Commit

Permalink
propagate execution context for timelion
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Aug 10, 2021
1 parent fa0d98a commit bf2511c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { i18n } from '@kbn/i18n';
import type { KibanaExecutionContext } from 'kibana/public';
import { KibanaContext, TimeRange, Filter, esQuery, Query } from '../../../data/public';
import { TimelionVisDependencies } from '../plugin';
import { getTimezone } from './get_timezone';
Expand Down Expand Up @@ -60,12 +61,14 @@ export function getTimelionRequestHandler({
query,
visParams,
searchSessionId,
executionContext,
}: {
timeRange: TimeRange;
filters: Filter[];
query: Query;
visParams: TimelionVisParams;
searchSessionId?: string;
executionContext?: KibanaExecutionContext;
}): Promise<TimelionSuccessResponse> {
const dataSearch = getDataSearch();
const expression = visParams.expression;
Expand Down Expand Up @@ -110,6 +113,7 @@ export function getTimelionRequestHandler({
searchSession: searchSessionOptions,
}),
}),
context: executionContext,
});
} catch (e) {
if (e && e.body) {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/vis_type_timelion/public/timelion_vis_fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const getTimelionVisualizationConfig = (
help: '',
},
},
async fn(input, args, { getSearchSessionId }) {
async fn(input, args, { getSearchSessionId, getExecutionContext }) {
const timelionRequestHandler = getTimelionRequestHandler(dependencies);

const visParams = { expression: args.expression, interval: args.interval };
Expand All @@ -70,6 +70,7 @@ export const getTimelionVisualizationConfig = (
filters: get(input, 'filters') as Filter[],
visParams,
searchSessionId: getSearchSessionId(),
executionContext: getExecutionContext(),
});

response.visType = TIMELION_VIS_NAME;
Expand Down

0 comments on commit bf2511c

Please sign in to comment.