Skip to content

Commit

Permalink
Merge branch 'main' into first_second_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 11, 2022
2 parents 1e1253b + c05f891 commit cefe3ce
Show file tree
Hide file tree
Showing 154 changed files with 1,960 additions and 1,695 deletions.
63 changes: 55 additions & 8 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"kibana-buildkite-library": "git+https://[email protected]/elastic/kibana-buildkite-library#b9f6b423059cac7554a7402277f2ad3ecfe132a4"
"kibana-buildkite-library": "git+https://[email protected]/elastic/kibana-buildkite-library#a0037514b7650296a23dbad99b165601d4eab1be"
}
}
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ pageLoadAssetSize:
eventAnnotation: 19334
screenshotting: 22870
synthetics: 40958
expressionXY: 29000
expressionXY: 30000
kibanaUsageCollection: 16463
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,33 @@ describe('createStreamingBatchedFunction()', () => {
});
});

test("doesn't send batch request if all items have been aborted", async () => {
const { fetchStreaming } = setup();
const fn = createStreamingBatchedFunction({
url: '/test',
fetchStreaming,
maxItemAge: 5,
flushOnMaxItems: 3,
getIsCompressionDisabled: () => true,
});

const abortController = new AbortController();
abortController.abort();

expect.assertions(3);
const req1 = fn({ foo: 'bar' }, abortController.signal).catch((e) =>
expect(e).toBeInstanceOf(AbortError)
);
const req2 = fn({ baz: 'quix' }, abortController.signal).catch((e) =>
expect(e).toBeInstanceOf(AbortError)
);

jest.advanceTimersByTime(6);
expect(fetchStreaming).not.toBeCalled();

await Promise.all([req1, req2]);
});

test('sends POST request to correct endpoint with items in array batched sorted in call order', async () => {
const { fetchStreaming } = setup();
const fn = createStreamingBatchedFunction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export const createStreamingBatchedFunction = <Payload, Result extends object>(
return !item.signal?.aborted;
});

if (items.length === 0) {
return; // all items have been aborted before a request has been sent
}

const donePromises: Array<Promise<any>> = items.map((item) => {
return new Promise<void>((resolve) => {
const { promise: abortPromise, cleanup } = item.signal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createCompressedStream = <Response>(
): Stream => {
const output = new PassThrough();

const sub = results
results
.pipe(
concatMap((message: Response) => {
const strMessage = JSON.stringify(message);
Expand All @@ -50,7 +50,6 @@ export const createCompressedStream = <Response>(
}),
finalize(() => {
output.end();
sub.unsubscribe();
})
)
.subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe('interpreter/functions#gauge', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ export const gaugeFunction = (): GaugeExpressionFunctionDefinition => ({
}

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const logTable = prepareLogTable(
data,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe('interpreter/functions#heatmap', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ export const heatmapFunction = (): HeatmapExpressionFunctionDefinition => ({
validateAccessor(args.splitColumnAccessor, data.columns);

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const argsTable: Dimension[] = [];
if (args.valueAccessor) {
prepareHeatmapLogTable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('interpreter/functions#metric', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ export const metricVisFunction = (): MetricVisExpressionFunctionDefinition => ({
validateAccessor(args.bucket, input.columns);

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const argsTable: Dimension[] = [
[
args.metric,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe('interpreter/functions#mosaicVis', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export const mosaicVisFunction = (): MosaicVisExpressionFunctionDefinition => ({
};

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const logTable = prepareLogTable(
context,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('interpreter/functions#pieVis', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export const pieVisFunction = (): PieVisExpressionFunctionDefinition => ({
};

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const logTable = prepareLogTable(
context,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe('interpreter/functions#treemapVis', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export const treemapVisFunction = (): TreemapVisExpressionFunctionDefinition =>
};

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const logTable = prepareLogTable(
context,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe('interpreter/functions#waffleVis', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export const waffleVisFunction = (): WaffleVisExpressionFunctionDefinition => ({
};

if (handlers?.inspectorAdapters?.tables) {
handlers.inspectorAdapters.tables.reset();
handlers.inspectorAdapters.tables.allowCsvExport = true;

const logTable = prepareLogTable(
context,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe('interpreter/functions#tagcloud', () => {
logDatatable: (name: string, datatable: Datatable) => {
loggedTable = datatable;
},
reset: () => {},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const XY_VIS = 'xyVis';
export const LAYERED_XY_VIS = 'layeredXyVis';
export const Y_CONFIG = 'yConfig';
export const EXTENDED_Y_CONFIG = 'extendedYConfig';
export const MULTITABLE = 'lens_multitable';
export const DATA_LAYER = 'dataLayer';
export const EXTENDED_DATA_LAYER = 'extendedDataLayer';
export const LEGEND_CONFIG = 'legendConfig';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const commonDataLayerArgs: CommonDataLayerFnArgs = {
help: strings.getXAccessorHelp(),
},
seriesType: {
aliases: ['_'],
types: ['string'],
options: [...Object.values(SeriesTypes)],
help: strings.getSeriesTypeHelp(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ExtendedDataLayerFn } from '../types';
import { EXTENDED_DATA_LAYER, LayerTypes } from '../constants';
import { strings } from '../i18n';
import { commonDataLayerArgs } from './common_data_layer_args';
import { getAccessors } from '../helpers';

export const extendedDataLayerFunction: ExtendedDataLayerFn = {
name: EXTENDED_DATA_LAYER,
Expand All @@ -29,12 +30,13 @@ export const extendedDataLayerFunction: ExtendedDataLayerFn = {
},
},
fn(input, args) {
const table = args.table ?? input;
return {
type: EXTENDED_DATA_LAYER,
...args,
accessors: args.accessors ?? [],
...getAccessors(args, table),
layerType: LayerTypes.DATA,
table: args.table ?? input,
table,
};
},
};
Loading

0 comments on commit cefe3ce

Please sign in to comment.