Skip to content

Commit 05a54a0

Browse files
Merge branch 'master' into nls/test-fixes
2 parents a5e55a3 + 2a54db7 commit 05a54a0

193 files changed

Lines changed: 6627 additions & 2239 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/settings/alert-action-settings.asciidoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,10 @@ Use `full` to perform hostname verification, `certificate` to skip hostname veri
207207
[[alert-settings]]
208208
==== Alerting settings
209209

210-
You do not need to configure any additional settings to use alerting in {kib}.
210+
[cols="2*<"]
211+
|===
212+
213+
| `xpack.alerting.maxEphemeralActionsPerAlert`
214+
| Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <<task-manager-settings,`xpack.task_manager.ephemeral_tasks.enabled`>>
215+
216+
|===

docs/settings/security-settings.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ You can configure the following settings in the `kibana.yml` file.
271271

272272
|[[xpack-session-idleTimeout]] `xpack.security.session.idleTimeout` {ess-icon}
273273
| Ensures that user sessions will expire after a period of inactivity. This and <<xpack-session-lifespan,`xpack.security.session.lifespan`>> are both
274-
highly recommended. You can also specify this setting for <<xpack-security-provider-session-idleTimeout, every provider separately>>. If this is _not_ set or set to `0`, then sessions will never expire due to inactivity. By default, this setting is not set.
274+
highly recommended. You can also specify this setting for <<xpack-security-provider-session-idleTimeout, every provider separately>>. If this is set to `0`, then sessions will never expire due to inactivity. By default, this value is 1 hour.
275275

276276
2+a|
277277
[TIP]
@@ -281,8 +281,8 @@ Use a string of `<count>[ms\|s\|m\|h\|d\|w\|M\|Y]` (e.g. '20m', '24h', '7d', '1w
281281

282282
|[[xpack-session-lifespan]] `xpack.security.session.lifespan` {ess-icon}
283283
| Ensures that user sessions will expire after the defined time period. This behavior is also known as an "absolute timeout". If
284-
this is _not_ set or set to `0`, user sessions could stay active indefinitely. This and <<xpack-session-idleTimeout, `xpack.security.session.idleTimeout`>> are both highly
285-
recommended. You can also specify this setting for <<xpack-security-provider-session-lifespan, every provider separately>>. By default, this setting is not set.
284+
this is set to `0`, user sessions could stay active indefinitely. This and <<xpack-session-idleTimeout, `xpack.security.session.idleTimeout`>> are both highly
285+
recommended. You can also specify this setting for <<xpack-security-provider-session-lifespan, every provider separately>>. By default, this value is 30 days.
286286

287287
2+a|
288288
[TIP]

docs/settings/task-manager-settings.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ Task Manager runs background tasks by polling for work on an interval. You can
3737
`monitored_stats_health_verbose_log.`
3838
`warn_delayed_task_start_in_seconds`
3939
| The amount of seconds we allow a task to delay before printing a warning server log. Defaults to 60.
40+
41+
| `xpack.task_manager.ephemeral_tasks.enabled`
42+
| Enables an experimental feature that executes a limited (and configurable) number of actions in the same task as the alert which triggered them.
43+
These action tasks will reduce the latency of the time it takes an action to run after it's triggered, but are not persisted as SavedObjects.
44+
These non-persisted action tasks have a risk that they won't be run at all if the Kibana instance running them exits unexpectedly. Defaults to false.
45+
46+
| `xpack.task_manager.ephemeral_tasks.request_capacity`
47+
| Sets the size of the ephemeral queue defined above. Defaults to 10.
4048
|===
4149

4250
[float]

docs/user/security/session-management.asciidoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ To manage user sessions programmatically, {kib} exposes <<session-management-api
1212
==== Session idle timeout
1313

1414
You can use `xpack.security.session.idleTimeout` to expire sessions after a period of inactivity. This and `xpack.security.session.lifespan` are both highly recommended.
15-
By default, sessions don't expire because of inactivity. To define a sliding session expiration, set the property in the `kibana.yml` configuration file. The idle timeout is formatted as a duration of `<count>[ms|s|m|h|d|w|M|Y]` (e.g. '20m', '24h', '7d', '1w'). For example, set the idle timeout to expire sessions after 1 hour of inactivity:
15+
By default, sessions expire after 1 hour of inactivity. To define another value for a sliding session expiration, set the property in the `kibana.yml` configuration file. The idle timeout is formatted as a duration of `<count>[ms|s|m|h|d|w|M|Y]` (e.g. '20m', '24h', '7d', '1w'). For example, set the idle timeout to expire sessions after 30 minutes of inactivity:
1616

1717
--
1818
[source,yaml]
1919
--------------------------------------------------------------------------------
20-
xpack.security.session.idleTimeout: "1h"
20+
xpack.security.session.idleTimeout: "30m"
2121
--------------------------------------------------------------------------------
2222
--
2323

2424
[[session-lifespan]]
2525
==== Session lifespan
2626

27-
You can use `xpack.security.session.lifespan` to configure the maximum session duration or "lifespan" -- also known as the "absolute timeout". This and `xpack.security.session.idleTimeout` are both highly recommended. By default, sessions don't have a fixed lifespan, and if an idle timeout is defined, a session can still be extended indefinitely. To define a maximum session lifespan, set the property in the `kibana.yml` configuration file. The lifespan is formatted as a duration of `<count>[ms|s|m|h|d|w|M|Y]` (e.g. '20m', '24h', '7d', '1w'). For example, set the lifespan to expire sessions after 30 days:
27+
You can use `xpack.security.session.lifespan` to configure the maximum session duration or "lifespan" -- also known as the "absolute timeout". This and `xpack.security.session.idleTimeout` are both highly recommended. By default, a maximum session lifespan is 30 days. To define another lifespan, set the property in the `kibana.yml` configuration file. The lifespan is formatted as a duration of `<count>[ms|s|m|h|d|w|M|Y]` (e.g. '20m', '24h', '7d', '1w'). For example, set the lifespan to expire sessions after 7 days:
2828

2929
--
3030
[source,yaml]
3131
--------------------------------------------------------------------------------
32-
xpack.security.session.lifespan: "30d"
32+
xpack.security.session.lifespan: "7d"
3333
--------------------------------------------------------------------------------
3434
--
3535

@@ -38,7 +38,7 @@ xpack.security.session.lifespan: "30d"
3838

3939
[IMPORTANT]
4040
============================================================================
41-
If you specify neither session idle timeout nor lifespan, then {kib} will not automatically remove session information from the index unless you explicitly log out. This might lead to an infinitely growing session index. Configure the idle timeout and lifespan settings for the {kib} sessions so that they can be cleaned up even if you don't explicitly log out.
41+
If you disable session idle timeout and lifespan, then Kibana will not automatically remove session information from the index unless you explicitly log out. This might lead to an infinitely growing session index. As long as either idle timeout or lifespan is configured, Kibana sessions will be cleaned up even if you don't explicitly log out.
4242
============================================================================
4343

4444
You can configure the interval at which {kib} tries to remove expired and invalid sessions from the session index. By default, this value is 1 hour and cannot be less than 10 seconds. To define another interval, set the `xpack.security.session.cleanupInterval` property in the `kibana.yml` configuration file. The interval is formatted as a duration of `<count>[ms|s|m|h|d|w|M|Y]` (e.g. '20m', '24h', '7d', '1w'). For example, schedule the session index cleanup to perform once a day:

packages/kbn-optimizer/limits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pageLoadAssetSize:
107107
dataVisualizer: 27530
108108
banners: 17946
109109
mapsEms: 26072
110-
timelines: 251886
110+
timelines: 330000
111111
screenshotMode: 17856
112112
visTypePie: 35583
113113
expressionRevealImage: 25675

packages/kbn-optimizer/src/__fixtures__/mock_repo/packages/kbn-ui-shared-deps/src/public_path_module_creator.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import cpy from 'cpy';
1515
import del from 'del';
1616
import { tap, filter } from 'rxjs/operators';
1717
import { REPO_ROOT } from '@kbn/utils';
18-
import { ToolingLog } from '@kbn/dev-utils';
18+
import { ToolingLog, createReplaceSerializer } from '@kbn/dev-utils';
1919
import { runOptimizer, OptimizerConfig, OptimizerUpdate, logOptimizerState } from '../index';
2020

2121
import { allValuesFrom } from '../common';
@@ -29,6 +29,8 @@ expect.addSnapshotSerializer({
2929
test: (value: any) => typeof value === 'string' && value.includes(REPO_ROOT),
3030
});
3131

32+
expect.addSnapshotSerializer(createReplaceSerializer(/\w+-fastbuild/, '<platform>-fastbuild'));
33+
3234
const log = new ToolingLog({
3335
level: 'error',
3436
writeTo: {
@@ -130,7 +132,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
130132
expect(foo.cache.getModuleCount()).toBe(6);
131133
expect(foo.cache.getReferencedFiles()).toMatchInlineSnapshot(`
132134
Array [
133-
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/packages/kbn-ui-shared-deps/src/public_path_module_creator.ts,
135+
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
134136
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/kibana.json,
135137
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/async_import.ts,
136138
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/ext.ts,
@@ -153,7 +155,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
153155
<absolute path>/node_modules/@kbn/optimizer/postcss.config.js,
154156
<absolute path>/node_modules/css-loader/package.json,
155157
<absolute path>/node_modules/style-loader/package.json,
156-
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/packages/kbn-ui-shared-deps/src/public_path_module_creator.ts,
158+
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
157159
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/kibana.json,
158160
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.scss,
159161
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.ts,
@@ -173,7 +175,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
173175

174176
expect(baz.cache.getReferencedFiles()).toMatchInlineSnapshot(`
175177
Array [
176-
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/packages/kbn-ui-shared-deps/src/public_path_module_creator.ts,
178+
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
177179
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/kibana.json,
178180
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/public/index.ts,
179181
<absolute path>/packages/kbn-optimizer/src/worker/entry_point_creator.ts,

packages/kbn-optimizer/src/optimizer/watcher.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export class Watcher {
3838

3939
private readonly watchpack = new Watchpack({
4040
aggregateTimeout: 0,
41-
ignored: /node_modules\/([^\/]+[\/])*(?!package.json)([^\/]+)$/,
4241
});
4342

4443
private readonly change$ = Rx.fromEvent<[string]>(this.watchpack, 'change').pipe(share());

packages/kbn-optimizer/src/worker/populate_bundle_cache_plugin.ts

Lines changed: 27 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Side Public License, v 1.
77
*/
88

9+
import Fs from 'fs';
910
import Path from 'path';
1011
import { inspect } from 'util';
1112

@@ -21,20 +22,6 @@ import {
2122
getModulePath,
2223
} from './webpack_helpers';
2324

24-
function tryToResolveRewrittenPath(from: string, toResolve: string) {
25-
try {
26-
return require.resolve(toResolve);
27-
} catch (error) {
28-
if (error.code === 'MODULE_NOT_FOUND') {
29-
throw new Error(
30-
`attempted to rewrite bazel-out path [${from}] to [${toResolve}] but couldn't find the rewrite target`
31-
);
32-
}
33-
34-
throw error;
35-
}
36-
}
37-
3825
/**
3926
* sass-loader creates about a 40% overhead on the overall optimizer runtime, and
4027
* so this constant is used to indicate to assignBundlesToWorkers() that there is
@@ -44,6 +31,20 @@ function tryToResolveRewrittenPath(from: string, toResolve: string) {
4431
*/
4532
const EXTRA_SCSS_WORK_UNITS = 100;
4633

34+
const isBazelPackageCache = new Map<string, boolean>();
35+
function isBazelPackage(pkgJsonPath: string) {
36+
const cached = isBazelPackageCache.get(pkgJsonPath);
37+
if (typeof cached === 'boolean') {
38+
return cached;
39+
}
40+
41+
const path = parseFilePath(Fs.realpathSync(pkgJsonPath, 'utf-8'));
42+
const match = !!path.matchDirs('bazel-out', /-fastbuild$/, 'bin', 'packages');
43+
isBazelPackageCache.set(pkgJsonPath, match);
44+
45+
return match;
46+
}
47+
4748
export class PopulateBundleCachePlugin {
4849
constructor(private readonly workerConfig: WorkerConfig, private readonly bundle: Bundle) {}
4950

@@ -71,44 +72,16 @@ export class PopulateBundleCachePlugin {
7172
let path = getModulePath(module);
7273
let parsedPath = parseFilePath(path);
7374

74-
const bazelOut = parsedPath.matchDirs(
75-
'bazel-out',
76-
/-fastbuild$/,
77-
'bin',
78-
'packages',
79-
/.*/,
80-
'target'
81-
);
82-
83-
// if the module is referenced from one of our packages and resolved to the `bazel-out` dir
84-
// we should rewrite our reference to point to the source file so that we can track the
85-
// modified time of that file rather than the built output which is rebuilt all the time
86-
// without actually changing
87-
if (bazelOut) {
88-
const packageDir = parsedPath.dirs[bazelOut.endIndex - 1];
89-
const subDirs = parsedPath.dirs.slice(bazelOut.endIndex + 1);
90-
path = tryToResolveRewrittenPath(
91-
path,
92-
Path.join(
93-
workerConfig.repoRoot,
94-
'packages',
95-
packageDir,
96-
'src',
97-
...subDirs,
98-
parsedPath.filename
99-
? Path.basename(parsedPath.filename, Path.extname(parsedPath.filename))
100-
: ''
101-
)
75+
const bazelOutIndex = parsedPath.dirs.indexOf('bazel-out');
76+
if (bazelOutIndex >= 0) {
77+
path = Path.resolve(
78+
this.workerConfig.repoRoot,
79+
...parsedPath.dirs.slice(bazelOutIndex),
80+
parsedPath.filename ?? ''
10281
);
10382
parsedPath = parseFilePath(path);
10483
}
10584

106-
if (parsedPath.matchDirs('bazel-out')) {
107-
throw new Error(
108-
`a bazel-out dir is being referenced by module [${path}] and not getting rewritten to its source location`
109-
);
110-
}
111-
11285
if (!parsedPath.dirs.includes('node_modules')) {
11386
referencedFiles.add(path);
11487

@@ -125,13 +98,13 @@ export class PopulateBundleCachePlugin {
12598

12699
const nmIndex = parsedPath.dirs.lastIndexOf('node_modules');
127100
const isScoped = parsedPath.dirs[nmIndex + 1].startsWith('@');
128-
referencedFiles.add(
129-
Path.join(
130-
parsedPath.root,
131-
...parsedPath.dirs.slice(0, nmIndex + 1 + (isScoped ? 2 : 1)),
132-
'package.json'
133-
)
101+
const pkgJsonPath = Path.join(
102+
parsedPath.root,
103+
...parsedPath.dirs.slice(0, nmIndex + 1 + (isScoped ? 2 : 1)),
104+
'package.json'
134105
);
106+
107+
referencedFiles.add(isBazelPackage(pkgJsonPath) ? path : pkgJsonPath);
135108
continue;
136109
}
137110

src/dev/precommit_hook/casing_check_config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ export const IGNORE_FILE_GLOBS = [
7878
*
7979
* @type {Array}
8080
*/
81-
export const KEBAB_CASE_DIRECTORY_GLOBS = [
82-
'packages/*',
83-
'x-pack',
84-
'packages/kbn-optimizer/src/__fixtures__/mock_repo/packages/kbn-ui-shared-deps',
85-
];
81+
export const KEBAB_CASE_DIRECTORY_GLOBS = ['packages/*', 'x-pack'];
8682

8783
/**
8884
* These patterns are matched against directories and indicate

0 commit comments

Comments
 (0)