Skip to content

Commit f433f50

Browse files
Merge branch '7.5' into backport/7.5/pr-51781
2 parents 4b461ed + a4fca06 commit f433f50

32 files changed

Lines changed: 593 additions & 225 deletions

docs/setup/production.asciidoc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* <<enabling-ssl>>
77
* <<load-balancing>>
88
* <<high-availability>>
9+
* <<memory>>
910

1011
How you deploy Kibana largely depends on your use case. If you are the only user,
1112
you can run Kibana on your local machine and configure it to point to whatever
@@ -27,7 +28,7 @@ You can use {ref}/elasticsearch-security.html[{stack} {security-features}]
2728
to control what {es} data users can access through Kibana.
2829

2930
When {security-features} are enabled, Kibana users have to log in. They need to
30-
have a role granting <<kibana-privileges, Kibana privileges>> as well as access
31+
have a role granting <<kibana-privileges, Kibana privileges>> as well as access
3132
to the indices they will be working with in Kibana.
3233

3334
If a user loads a Kibana dashboard that accesses data in an index that they
@@ -125,4 +126,17 @@ elasticsearch.hosts:
125126
--------
126127

127128
Related configurations include `elasticsearch.sniffInterval`, `elasticsearch.sniffOnStart`, and `elasticsearch.sniffOnConnectionFault`.
128-
These can be used to automatically update the list of hosts as a cluster is resized. Parameters can be found on the {kibana-ref}/settings.html[settings page].
129+
These can be used to automatically update the list of hosts as a cluster is resized. Parameters can be found on the {kibana-ref}/settings.html[settings page].
130+
131+
[float]
132+
[[memory]]
133+
=== Memory
134+
Kibana has a default maximum memory limit of 1.4 GB, and in most cases, we recommend leaving this unconfigured. In some scenarios, such as large reporting jobs,
135+
it may make sense to tweak limits to meet more specific requirements.
136+
137+
You can modify this limit by setting `--max-old-space-size` in the `NODE_OPTIONS` environment variable. For deb and rpm, packages this is passed in via `/etc/default/kibana` and can be appended to the bottom of the file.
138+
139+
The option accepts a limit in MB:
140+
--------
141+
NODE_OPTIONS="--max-old-space-size=2048" bin/kibana
142+
--------

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
"@types/redux-actions": "^2.2.1",
341341
"@types/request": "^2.48.2",
342342
"@types/rimraf": "^2.0.2",
343-
"@types/selenium-webdriver": "^4.0.3",
343+
"@types/selenium-webdriver": "^4.0.5",
344344
"@types/semver": "^5.5.0",
345345
"@types/sinon": "^7.0.13",
346346
"@types/strip-ansi": "^3.0.0",
@@ -362,7 +362,7 @@
362362
"chance": "1.0.18",
363363
"cheerio": "0.22.0",
364364
"chokidar": "3.2.1",
365-
"chromedriver": "78.0.1",
365+
"chromedriver": "79.0.0",
366366
"classnames": "2.2.6",
367367
"dedent": "^0.7.0",
368368
"delete-empty": "^2.0.0",

packages/kbn-dev-utils/src/kbn_client/kbn_client_requester.ts

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ export interface ReqOptions {
6262
query?: Record<string, any>;
6363
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
6464
body?: any;
65-
attempt?: number;
66-
maxAttempts?: number;
65+
retries?: number;
6766
}
6867

6968
const delay = (ms: number) =>
@@ -87,44 +86,47 @@ export class KbnClientRequester {
8786
async request<T>(options: ReqOptions): Promise<T> {
8887
const url = Url.resolve(this.pickUrl(), options.path);
8988
const description = options.description || `${options.method} ${url}`;
90-
const attempt = options.attempt === undefined ? 1 : options.attempt;
91-
const maxAttempts =
92-
options.maxAttempts === undefined ? DEFAULT_MAX_ATTEMPTS : options.maxAttempts;
93-
94-
try {
95-
const response = await Axios.request<T>({
96-
method: options.method,
97-
url,
98-
data: options.body,
99-
params: options.query,
100-
headers: {
101-
'kbn-xsrf': 'kbn-client',
102-
},
103-
});
104-
105-
return response.data;
106-
} catch (error) {
107-
let retryErrorMsg: string | undefined;
108-
if (isAxiosRequestError(error)) {
109-
retryErrorMsg = `[${description}] request failed (attempt=${attempt})`;
110-
} else if (isConcliftOnGetError(error)) {
111-
retryErrorMsg = `Conflict on GET (path=${options.path}, attempt=${attempt})`;
112-
}
89+
let attempt = 0;
90+
const maxAttempts = options.retries === undefined ? DEFAULT_MAX_ATTEMPTS : options.retries;
91+
92+
while (true) {
93+
attempt += 1;
94+
95+
try {
96+
const response = await Axios.request<T>({
97+
method: options.method,
98+
url,
99+
data: options.body,
100+
params: options.query,
101+
headers: {
102+
'kbn-xsrf': 'kbn-client',
103+
},
104+
});
105+
106+
return response.data;
107+
} catch (error) {
108+
const conflictOnGet = isConcliftOnGetError(error);
109+
const requestedRetries = options.retries !== undefined;
110+
const failedToGetResponse = isAxiosRequestError(error);
111+
112+
let errorMessage;
113+
if (conflictOnGet) {
114+
errorMessage = `Conflict on GET (path=${options.path}, attempt=${attempt}/${maxAttempts})`;
115+
this.log.error(errorMessage);
116+
} else if (requestedRetries || failedToGetResponse) {
117+
errorMessage = `[${description}] request failed (attempt=${attempt}/${maxAttempts})`;
118+
this.log.error(errorMessage);
119+
} else {
120+
throw error;
121+
}
113122

114-
if (retryErrorMsg) {
115123
if (attempt < maxAttempts) {
116-
this.log.error(retryErrorMsg);
117124
await delay(1000 * attempt);
118-
return await this.request<T>({
119-
...options,
120-
attempt: attempt + 1,
121-
});
125+
continue;
122126
}
123127

124-
throw new Error(retryErrorMsg + ' and ran out of retries');
128+
throw new Error(`${errorMessage} -- and ran out of retries`);
125129
}
126-
127-
throw error;
128130
}
129131
}
130132
}

packages/kbn-dev-utils/src/kbn_client/kbn_client_ui_settings.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class KbnClientUiSettings {
4040

4141
async get(setting: string) {
4242
const all = await this.getAll();
43-
const value = all.settings[setting] ? all.settings[setting].userValue : undefined;
43+
const value = all[setting] === undefined ? undefined : all[setting].userValue;
4444

4545
this.log.verbose('uiSettings.value: %j', value);
4646
return value;
@@ -68,24 +68,24 @@ export class KbnClientUiSettings {
6868
* with some defaults
6969
*/
7070
async replace(doc: UiSettingValues) {
71-
const all = await this.getAll();
72-
for (const [name, { isOverridden }] of Object.entries(all.settings)) {
73-
if (!isOverridden) {
74-
await this.unset(name);
71+
this.log.debug('replacing kibana config doc: %j', doc);
72+
73+
const changes: Record<string, any> = {
74+
...this.defaults,
75+
...doc,
76+
};
77+
78+
for (const [name, { isOverridden }] of Object.entries(await this.getAll())) {
79+
if (!isOverridden && !changes.hasOwnProperty(name)) {
80+
changes[name] = null;
7581
}
7682
}
7783

78-
this.log.debug('replacing kibana config doc: %j', doc);
79-
8084
await this.requester.request({
8185
method: 'POST',
8286
path: '/api/kibana/settings',
83-
body: {
84-
changes: {
85-
...this.defaults,
86-
...doc,
87-
},
88-
},
87+
body: { changes },
88+
retries: 5,
8989
});
9090
}
9191

@@ -105,9 +105,11 @@ export class KbnClientUiSettings {
105105
}
106106

107107
private async getAll() {
108-
return await this.requester.request<UiSettingsApiResponse>({
108+
const resp = await this.requester.request<UiSettingsApiResponse>({
109109
path: '/api/kibana/settings',
110110
method: 'GET',
111111
});
112+
113+
return resp.settings;
112114
}
113115
}

packages/kbn-dev-utils/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "target",
5+
"target": "ES2019",
56
"declaration": true
67
},
78
"include": [

packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.test.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ it('rewrites ftr reports with minimal changes', async () => {
7373
===================================================================
7474
--- ftr.xml [object Object]
7575
+++ ftr.xml
76-
@@ -2,52 +2,56 @@
76+
@@ -1,53 +1,56 @@
77+
‹?xml version="1.0" encoding="utf-8"?›
7778
‹testsuites›
7879
‹testsuite timestamp="2019-06-05T23:37:10" time="903.670" tests="129" failures="5" skipped="71"›
7980
‹testcase name="maps app maps loaded from sample data ecommerce &quot;before all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps/sample_data·js" time="154.378"›
80-
‹system-out›
81+
- ‹system-out›
8182
- ‹![CDATA[[00:00:00] │
83+
+ ‹system-out›Failed Tests Reporter:
84+
+ - foo bar
85+
+
86+
+
8287
+ [00:00:00] │
8388
[00:07:04] └-: maps app
8489
...
@@ -94,13 +99,8 @@ it('rewrites ftr reports with minimal changes', async () => {
9499
at process._tickCallback (internal/process/next_tick.js:68:7)
95100
at lastError (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:28:9)
96101
- at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13)]]›
97-
- ‹/failure›
98102
+ at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13)
99-
+
100-
+
101-
+Failed Tests Reporter:
102-
+ - foo bar
103-
+‹/failure›
103+
‹/failure›
104104
‹/testcase›
105105
‹testcase name="maps app &quot;after all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179"›
106106
‹system-out›
@@ -181,11 +181,11 @@ it('rewrites jest reports with minimal changes', async () => {
181181
+ ‹failure›‹![CDATA[
182182
+ TypeError: Cannot read property '0' of undefined
183183
+ at Object.‹anonymous›.test (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.test.ts:166:10)
184-
+
185-
+
186-
+Failed Tests Reporter:
184+
+ ]]›‹/failure›
185+
+ ‹system-out›Failed Tests Reporter:
187186
+ - foo bar
188-
+]]›‹/failure›
187+
+
188+
+‹/system-out›
189189
‹/testcase›
190190
‹testcase classname="X-Pack Jest Tests.x-pack/legacy/plugins/code/server/lsp" name="passive launcher can start and end a process" time="0.435"/›
191191
‹testcase classname="X-Pack Jest Tests.x-pack/legacy/plugins/code/server/lsp" name="passive launcher should restart a process if a process died before connected" time="1.502"/›
@@ -216,12 +216,17 @@ it('rewrites mocha reports with minimal changes', async () => {
216216
===================================================================
217217
--- mocha.xml [object Object]
218218
+++ mocha.xml
219-
@@ -2,12 +2,12 @@
219+
@@ -1,13 +1,16 @@
220+
‹?xml version="1.0" encoding="utf-8"?›
220221
‹testsuites›
221222
‹testsuite timestamp="2019-06-13T23:29:36" time="30.739" tests="1444" failures="2" skipped="3"›
222223
‹testcase name="code in multiple nodes &quot;before all&quot; hook" classname="X-Pack Mocha Tests.x-pack/legacy/plugins/code/server/__tests__/multi_node·ts" time="0.121"›
223-
‹system-out›
224+
- ‹system-out›
224225
- ‹![CDATA[]]›
226+
+ ‹system-out›Failed Tests Reporter:
227+
+ - foo bar
228+
+
229+
+
225230
+
226231
‹/system-out›
227232
- ‹failure›
@@ -232,19 +237,15 @@ it('rewrites mocha reports with minimal changes', async () => {
232237
‹head›‹title›503 Service Temporarily Unavailable‹/title›‹/head›
233238
‹body bgcolor="white"›
234239
‹center›‹h1›503 Service Temporarily Unavailable‹/h1›‹/center›
235-
@@ -15,24 +15,28 @@
240+
@@ -15,24 +18,24 @@
236241
‹/body›
237242
‹/html›
238243
239244
at Function.getSnapshot (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/packages/kbn-es/src/artifact.js:95:13)
240245
- at process._tickCallback (internal/process/next_tick.js:68:7)]]›
241246
- ‹/failure›
242247
+ at process._tickCallback (internal/process/next_tick.js:68:7)
243-
+
244-
+
245-
+Failed Tests Reporter:
246-
+ - foo bar
247-
+]]›‹/failure›
248+
+ ]]›‹/failure›
248249
‹/testcase›
249250
‹testcase name="code in multiple nodes &quot;after all&quot; hook" classname="X-Pack Mocha Tests.x-pack/legacy/plugins/code/server/__tests__/multi_node·ts" time="0.003"›
250251
‹system-out›
@@ -324,11 +325,11 @@ it('rewrites karma reports with minimal changes', async () => {
324325
+ at Generator.prototype.‹computed› [as next] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:114:21)
325326
+ at asyncGeneratorStep (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158772:103)
326327
+ at _next (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158774:194)
327-
+
328-
+
329-
+Failed Tests Reporter:
330-
+ - foo bar
331328
+]]›‹/failure›
329+
+ ‹system-out›Failed Tests Reporter:
330+
+ - foo bar
331+
+
332+
+‹/system-out›
332333
‹/testcase›
333334
‹testcase name="CoordinateMapsVisualizationTest CoordinateMapsVisualization - basics should toggle to Heatmap OK" time="0.055" classname="Browser Unit Tests.CoordinateMapsVisualizationTest"/›
334335
‹testcase name="VegaParser._parseSchema should warn on vega-lite version too new to be supported" time="0.001" classname="Browser Unit Tests.VegaParser·_parseSchema"/›

packages/kbn-test/src/failed_tests_reporter/add_messages_to_report.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,20 @@ export async function addMessagesToReport(options: {
5757
}
5858

5959
log.info(`${classname} - ${name}:${messageList}`);
60-
const append = `\n\nFailed Tests Reporter:${messageList}\n`;
60+
const output = `Failed Tests Reporter:${messageList}\n\n`;
6161

62-
const [failure] = testCase.failure;
63-
if (typeof failure === 'object') {
64-
failure._ += append;
65-
} else {
66-
testCase.failure[0] = String(failure) + append;
62+
if (!testCase['system-out']) {
63+
testCase['system-out'] = [output];
64+
continue;
6765
}
66+
67+
if (typeof testCase['system-out'][0] === 'string') {
68+
testCase['system-out'][0] = output + String(testCase['system-out'][0]);
69+
continue;
70+
}
71+
72+
const [current] = testCase['system-out'];
73+
current._ = output + current._;
6874
}
6975

7076
const builder = new xml2js.Builder({

0 commit comments

Comments
 (0)