Skip to content

Commit a775ff3

Browse files
committed
Merge remote-tracking branch 'elastic/master' into monitoring/restore_legacy_alerts
2 parents 83886c4 + a0ce7b5 commit a775ff3

116 files changed

Lines changed: 1984 additions & 1202 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.

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
/src/legacy/server/warnings/ @elastic/kibana-operations
151151
/.ci/es-snapshots/ @elastic/kibana-operations
152152
/vars/ @elastic/kibana-operations
153+
/.bazelignore @elastic/kibana-operations
154+
/.bazeliskversion @elastic/kibana-operations
155+
/.bazelrc @elastic/kibana-operations
156+
/.bazelrc.common @elastic/kibana-operations
157+
/.bazelversion @elastic/kibana-operations
158+
/WORKSPACE.bazel @elastic/kibana-operations
153159
#CC# /packages/kbn-expect/ @elastic/kibana-operations
154160

155161
# Quality Assurance

docs/developer/contributing/development-ci-metrics.asciidoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ All metrics are collected from the `tar.gz` archive produced for the linux platf
4444
[[ci-metric-distributable-file-count]] `distributable file count` ::
4545
The number of files included in the default distributable.
4646

47-
[[ci-metric-oss-distributable-file-count]] `oss distributable file count` ::
48-
The number of files included in the OSS distributable.
49-
5047
[[ci-metric-distributable-size]] `distributable size` ::
5148
The size, in bytes, of the default distributable. _(not reported on PRs)_
5249

53-
[[ci-metric-oss-distributable-size]] `oss distributable size` ::
54-
The size, in bytes, of the OSS distributable. _(not reported on PRs)_
55-
5650

5751
[[ci-metric-types-saved-object-field-counts]]
5852
==== Saved Object field counts

docs/developer/getting-started/development-plugin-resources.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ You can use the <<automatic-plugin-generator>> to get a basic structure for a ne
1414
{kib} repo should be developed inside the `plugins` folder. If you are building a new plugin to check in to the {kib} repo,
1515
you will choose between a few locations:
1616

17-
- {kib-repo}tree/{branch}/x-pack/plugins[x-pack/plugins] for commercially licensed plugins
18-
- {kib-repo}tree/{branch}/src/plugins[src/plugins] for open source licensed plugins
17+
- {kib-repo}tree/{branch}/x-pack/plugins[x-pack/plugins] for plugins related to subscription features
18+
- {kib-repo}tree/{branch}/src/plugins[src/plugins] for plugins related to free features
1919
- {kib-repo}tree/{branch}/examples[examples] for developer example plugins (these will not be included in the distributables)
2020

2121
[discrete]

docs/user/alerting/geo-alert-types.asciidoc

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
[role="xpack"]
2-
[[geo-alert-types]]
3-
== Geo alert types
2+
[[geo-alerting]]
3+
== Geo alerting
44

5-
Two additional stack alerts are available:
6-
<<alert-type-tracking-threshold>> and <<alert-type-tracking-containment>>.
5+
Alerting now includes one additional stack alert: <<alert-type-tracking-containment>>.
76

87
As with other stack alerts, you need `all` access to the *Stack Alerts* feature
9-
to be able to create and edit either of the geo alerts.
8+
to be able to create and edit a geo alert.
109
See <<kibana-feature-privileges, feature privileges>> for more information on configuring roles that provide access to this feature.
1110

1211
[float]
13-
=== Geo alert requirements
14-
15-
To create either a *Tracking threshold* or a *Tracking containment* alert, the
16-
following requirements must be present:
12+
=== Geo alerting requirements
13+
To create a *Tracking containment* alert, the following requirements must be present:
1714

1815
- *Tracks index or index pattern*: An index containing a `geo_point` field, `date` field,
1916
and some form of entity identifier. An entity identifier is a `keyword` or `number`
@@ -33,62 +30,12 @@ than the current time minus the amount of the interval. If data older than
3330

3431
[float]
3532
=== Creating a geo alert
36-
Both *threshold* and *containment* alerts can be created by clicking the *Create*
37-
button in the <<alert-management, alert management UI>>.
33+
Click the *Create* button in the <<alert-management, alert management UI>>.
3834
Complete the <<defining-alerts-general-details, general alert details>>.
39-
Select <<alert-type-tracking-threshold>> to generate an alert when an entity crosses a boundary, and you desire the
40-
ability to highlight lines of crossing on a custom map.
41-
Select
42-
<<alert-type-tracking-containment>> if an entity should send out constant alerts
43-
while contained within a boundary (this feature is optional) or if the alert is generally
44-
just more focused around activity when an entity exists within a shape.
4535

4636
[role="screenshot"]
4737
image::images/alert-types-tracking-select.png[Choosing a tracking alert type]
4838

49-
[NOTE]
50-
==================================================
51-
With recent advances in the alerting framework, most of the features
52-
available in Tracking threshold alerts can be replicated with just
53-
a little more work in Tracking containment alerts. The capabilities of Tracking
54-
threshold alerts may be deprecated or folded into Tracking containment alerts
55-
in the future.
56-
==================================================
57-
58-
[float]
59-
[[alert-type-tracking-threshold]]
60-
=== Tracking threshold
61-
The Tracking threshold alert type runs an {es} query over indices, comparing the latest
62-
entity locations with their previous locations. In the event that an entity has crossed a
63-
boundary from the selected boundary index, an alert may be generated.
64-
65-
[float]
66-
==== Defining the conditions
67-
Tracking threshold has a *Delayed evaluation offset* and 4 clauses that define the
68-
condition to detect, as well as 2 Kuery bars used to provide additional filtering
69-
context for each of the indices.
70-
71-
[role="screenshot"]
72-
image::images/alert-types-tracking-threshold-conditions.png[Five clauses define the condition to detect]
73-
74-
75-
Delayed evaluation offset:: If a data source lags or is intermittent, you may supply
76-
an optional value to evaluate alert conditions following a fixed delay. For instance, if data
77-
is consistently indexed 5-10 minutes following its original timestamp, a *Delayed evaluation
78-
offset* of `10 minutes` would ensure that alertable instances are still captured.
79-
Index (entity):: This clause requires an *index or index pattern*, a *time field* that will be used for the *time window*, and a *`geo_point` field* for tracking.
80-
By:: This clause specifies the field to use in the previously provided
81-
*index or index pattern* for tracking Entities. An entity is a `keyword`
82-
or `number` field that consistently identifies the entity to be tracked.
83-
When entity:: This clause specifies which crossing option to track. The values
84-
*Entered*, *Exited*, and *Crossed* can be selected to indicate which crossing conditions
85-
should trigger an alert. *Entered* alerts on entry into a boundary, *Exited* alerts on exit
86-
from a boundary, and *Crossed* alerts on all boundary crossings whether they be entrances
87-
or exits.
88-
Index (Boundary):: This clause requires an *index or index pattern*, a *`geo_shape` field*
89-
identifying boundaries, and an optional *Human-readable boundary name* for better alerting
90-
messages.
91-
9239
[float]
9340
[[alert-type-tracking-containment]]
9441
=== Tracking containment
-7.45 KB
Loading

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@
558558
"@types/webpack": "^4.41.3",
559559
"@types/webpack-env": "^1.15.3",
560560
"@types/webpack-merge": "^4.1.5",
561+
"@types/webpack-sources": "^0.1.4",
561562
"@types/write-pkg": "^3.1.0",
562563
"@types/xml-crypto": "^1.4.1",
563564
"@types/xml2js": "^0.4.5",
@@ -714,7 +715,6 @@
714715
"leaflet": "1.5.1",
715716
"leaflet-draw": "0.4.14",
716717
"leaflet-responsive-popup": "0.6.4",
717-
"leaflet-vega": "^0.8.6",
718718
"leaflet.heat": "0.2.0",
719719
"less": "npm:@elastic/less@2.7.3-kibana",
720720
"license-checker": "^16.0.0",
@@ -833,6 +833,7 @@
833833
"val-loader": "^1.1.1",
834834
"vega": "^5.19.1",
835835
"vega-lite": "^4.17.0",
836+
"vega-spec-injector": "^0.0.2",
836837
"vega-schema-url-parser": "^2.1.0",
837838
"vega-tooltip": "^0.25.0",
838839
"venn.js": "0.2.20",
@@ -843,6 +844,7 @@
843844
"webpack-cli": "^3.3.12",
844845
"webpack-dev-server": "^3.11.0",
845846
"webpack-merge": "^4.2.2",
847+
"webpack-sources": "^1.4.1",
846848
"write-pkg": "^4.0.0",
847849
"xml-crypto": "^2.0.0",
848850
"xmlbuilder": "13.0.2",

packages/kbn-dev-utils/src/ci_stats_reporter/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
*/
88

99
export * from './ci_stats_reporter';
10+
export * from './ship_ci_stats_cli';
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
import Path from 'path';
10+
import Fs from 'fs';
11+
12+
import { CiStatsReporter } from './ci_stats_reporter';
13+
import { run, createFlagError } from '../run';
14+
15+
export function shipCiStatsCli() {
16+
run(
17+
async ({ log, flags }) => {
18+
let metricPaths = flags.metrics;
19+
if (typeof metricPaths === 'string') {
20+
metricPaths = [metricPaths];
21+
} else if (!Array.isArray(metricPaths) || !metricPaths.every((p) => typeof p === 'string')) {
22+
throw createFlagError('expected --metrics to be a string');
23+
}
24+
25+
const reporter = CiStatsReporter.fromEnv(log);
26+
for (const path of metricPaths) {
27+
// resolve path from CLI relative to CWD
28+
const abs = Path.resolve(path);
29+
const json = Fs.readFileSync(abs, 'utf8');
30+
await reporter.metrics(JSON.parse(json));
31+
log.success('shipped metrics from', path);
32+
}
33+
},
34+
{
35+
description: 'ship ci-stats which have been written to files',
36+
usage: `node scripts/ship_ci_stats`,
37+
log: {
38+
defaultLevel: 'debug',
39+
},
40+
flags: {
41+
string: ['metrics'],
42+
help: `
43+
--metrics [path] A path to a JSON file that includes metrics which should be sent. Multiple instances supported
44+
`,
45+
},
46+
}
47+
);
48+
}

packages/kbn-optimizer/src/cli.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ import Path from 'path';
1212

1313
import { REPO_ROOT } from '@kbn/utils';
1414
import { lastValueFrom } from '@kbn/std';
15-
import { run, createFlagError, CiStatsReporter } from '@kbn/dev-utils';
15+
import { run, createFlagError } from '@kbn/dev-utils';
1616

1717
import { logOptimizerState } from './log_optimizer_state';
1818
import { OptimizerConfig } from './optimizer';
19-
import { reportOptimizerStats } from './report_optimizer_stats';
2019
import { runOptimizer } from './run_optimizer';
2120
import { validateLimitsForAllBundles, updateBundleLimits } from './limits';
2221

@@ -120,17 +119,7 @@ run(
120119
return;
121120
}
122121

123-
let update$ = runOptimizer(config);
124-
125-
if (reportStats) {
126-
const reporter = CiStatsReporter.fromEnv(log);
127-
128-
if (!reporter.isEnabled()) {
129-
log.warning('Unable to initialize CiStatsReporter from env');
130-
}
131-
132-
update$ = update$.pipe(reportOptimizerStats(reporter, config, log));
133-
}
122+
const update$ = runOptimizer(config);
134123

135124
await lastValueFrom(update$.pipe(logOptimizerState(log, config)));
136125

@@ -153,7 +142,6 @@ run(
153142
'cache',
154143
'profile',
155144
'inspect-workers',
156-
'report-stats',
157145
'validate-limits',
158146
'update-limits',
159147
],
@@ -179,7 +167,6 @@ run(
179167
--dist create bundles that are suitable for inclusion in the Kibana distributable, enabled when running with --update-limits
180168
--scan-dir add a directory to the list of directories scanned for plugins (specify as many times as necessary)
181169
--no-inspect-workers when inspecting the parent process, don't inspect the workers
182-
--report-stats attempt to report stats about this execution of the build to the kibana-ci-stats service using this name
183170
--validate-limits validate the limits.yml config to ensure that there are limits defined for every bundle
184171
--update-limits run a build and rewrite the limits file to include the current bundle sizes +5kb
185172
`,

packages/kbn-optimizer/src/common/bundle.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ it('creates cache keys', () => {
4242
"id": "bar",
4343
"manifestPath": undefined,
4444
"outputDir": "/foo/bar/target",
45+
"pageLoadAssetSizeLimit": undefined,
4546
"publicDirNames": Array [
4647
"public",
4748
],
@@ -79,6 +80,7 @@ it('parses bundles from JSON specs', () => {
7980
"id": "bar",
8081
"manifestPath": undefined,
8182
"outputDir": "/foo/bar/target",
83+
"pageLoadAssetSizeLimit": undefined,
8284
"publicDirNames": Array [
8385
"public",
8486
],

0 commit comments

Comments
 (0)