diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index a64ab63494b35..61369a37ec3c2 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -177,6 +177,8 @@
/x-pack/test/functional/services/ml/ @elastic/ml-ui
/x-pack/test/functional_basic/apps/ml/ @elastic/ml-ui
/x-pack/test/functional_with_es_ssl/apps/ml/ @elastic/ml-ui
+/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ml_rule_types/ @elastic/ml-ui
+/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/transform_rule_types/ @elastic/ml-ui
# ML team owns and maintains the transform plugin despite it living in the Data management section.
/x-pack/plugins/transform/ @elastic/ml-ui
diff --git a/NOTICE.txt b/NOTICE.txt
index 4ede43610ca7b..1694193892e16 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -295,7 +295,7 @@ MIT License http://www.opensource.org/licenses/mit-license
---
This product includes code that is adapted from mapbox-gl-js, which is
available under a "BSD-3-Clause" license.
-https://github.com/mapbox/mapbox-gl-js/blob/master/src/util/image.js
+https://github.com/mapbox/mapbox-gl-js/blob/v1.13.2/src/util/image.js
Copyright (c) 2016, Mapbox
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
index 8f6f1f6c98ab2..63c29df44019d 100644
--- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
@@ -290,7 +290,14 @@ readonly links: {
}>;
readonly watcher: Record;
readonly ccs: Record;
- readonly plugins: Record;
+ readonly plugins: {
+ azureRepo: string;
+ gcsRepo: string;
+ hdfsRepo: string;
+ s3Repo: string;
+ snapshotRestoreRepos: string;
+ mapperSize: string;
+ };
readonly snapshotRestore: Record;
readonly ingest: Record;
readonly fleet: Readonly<{
diff --git a/docs/settings/apm-settings.asciidoc b/docs/settings/apm-settings.asciidoc
index 77a250a14f929..27ea7f4dc7cd0 100644
--- a/docs/settings/apm-settings.asciidoc
+++ b/docs/settings/apm-settings.asciidoc
@@ -101,8 +101,8 @@ Changing these settings may disable features of the APM App.
| `xpack.apm.indices.sourcemap` {ess-icon}
| Matcher for all source map indices. Defaults to `apm-*`.
-| `xpack.apm.autocreateApmIndexPattern` {ess-icon}
- | Set to `false` to disable the automatic creation of the APM index pattern when the APM app is opened. Defaults to `true`.
+| `xpack.apm.autoCreateApmDataView` {ess-icon}
+ | Set to `false` to disable the automatic creation of the APM data view when the APM app is opened. Defaults to `true`.
|===
-// end::general-apm-settings[]
\ No newline at end of file
+// end::general-apm-settings[]
diff --git a/docs/settings/fleet-settings.asciidoc b/docs/settings/fleet-settings.asciidoc
index f0dfeb619bb38..a088f31937cc8 100644
--- a/docs/settings/fleet-settings.asciidoc
+++ b/docs/settings/fleet-settings.asciidoc
@@ -87,6 +87,7 @@ Optional properties are:
`data_output_id`:: ID of the output to send data (Need to be identical to `monitoring_output_id`)
`monitoring_output_id`:: ID of the output to send monitoring data. (Need to be identical to `data_output_id`)
`package_policies`:: List of integration policies to add to this policy.
+ `id`::: Unique ID of the integration policy. The ID may be a number or string.
`name`::: (required) Name of the integration policy.
`package`::: (required) Integration that this policy configures
`name`:::: Name of the integration associated with this policy.
@@ -128,6 +129,7 @@ xpack.fleet.agentPolicies:
- package:
name: system
name: System Integration
+ id: preconfigured-system
inputs:
- type: system/metrics
enabled: true
diff --git a/docs/settings/monitoring-settings.asciidoc b/docs/settings/monitoring-settings.asciidoc
index d8bc26b7b3987..8bc98a028b8f6 100644
--- a/docs/settings/monitoring-settings.asciidoc
+++ b/docs/settings/monitoring-settings.asciidoc
@@ -72,6 +72,9 @@ For more information, see
| `monitoring.ui.elasticsearch.ssl`
| Shares the same configuration as <>. These settings configure encrypted communication between {kib} and the monitoring cluster.
+| `monitoring.cluster_alerts.allowedSpaces` {ess-icon}
+ | Specifies the spaces where cluster Stack Monitoring alerts can be created. You must specify all spaces where you want to generate alerts, including the default space. Defaults to `[ "default" ]`.
+
|===
[float]
diff --git a/docs/settings/spaces-settings.asciidoc b/docs/settings/spaces-settings.asciidoc
index dd37943101145..3eb91a0d884ef 100644
--- a/docs/settings/spaces-settings.asciidoc
+++ b/docs/settings/spaces-settings.asciidoc
@@ -12,11 +12,3 @@ The maximum number of spaces that you can use with the {kib} instance. Some {kib
return all spaces using a single `_search` from {es}, so you must
configure this setting lower than the `index.max_result_window` in {es}.
The default is `1000`.
-
-`monitoring.cluster_alerts.allowedSpaces` {ess-icon}::
-Specifies the spaces where cluster alerts are automatically generated.
-You must specify all spaces where you want to generate alerts, including the default space.
-When the default space is unspecified, {kib} is unable to generate an alert for the default space.
-{es} clusters that run on {es} services are all containers. To send monitoring data
-from your self-managed {es} installation to {es} services, set to `false`.
-The default is `true`.
diff --git a/package.json b/package.json
index 6b7d6662eb70b..cc0ef06b39136 100644
--- a/package.json
+++ b/package.json
@@ -109,7 +109,6 @@
"@elastic/ems-client": "8.0.0",
"@elastic/eui": "41.0.0",
"@elastic/filesaver": "1.1.2",
- "@elastic/maki": "6.3.0",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
"@elastic/react-search-ui": "^1.6.0",
@@ -196,8 +195,10 @@
"archiver": "^5.2.0",
"axios": "^0.21.1",
"base64-js": "^1.3.1",
+ "bitmap-sdf": "^1.0.3",
"brace": "0.11.1",
"broadcast-channel": "^4.7.0",
+ "canvg": "^3.0.9",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
"chokidar": "^3.4.3",
@@ -567,7 +568,9 @@
"@types/kbn__config": "link:bazel-bin/packages/kbn-config/npm_module_types",
"@types/kbn__config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module_types",
"@types/kbn__crypto": "link:bazel-bin/packages/kbn-crypto/npm_module_types",
+ "@types/kbn__dev-utils": "link:bazel-bin/packages/kbn-dev-utils/npm_module_types",
"@types/kbn__docs-utils": "link:bazel-bin/packages/kbn-docs-utils/npm_module_types",
+ "@types/kbn__es-archiver": "link:bazel-bin/packages/kbn-es-archiver/npm_module_types",
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
"@types/license-checker": "15.0.0",
diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel
index aa90c3c122171..a7f0707575fcd 100644
--- a/packages/BUILD.bazel
+++ b/packages/BUILD.bazel
@@ -86,7 +86,9 @@ filegroup(
"//packages/kbn-config:build_types",
"//packages/kbn-config-schema:build_types",
"//packages/kbn-crypto:build_types",
+ "//packages/kbn-dev-utils:build_types",
"//packages/kbn-docs-utils:build_types",
+ "//packages/kbn-es-archiver:build_types",
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react:build_types",
],
diff --git a/packages/elastic-eslint-config-kibana/react.js b/packages/elastic-eslint-config-kibana/react.js
index 29000bdb15684..0b1cce15de9ad 100644
--- a/packages/elastic-eslint-config-kibana/react.js
+++ b/packages/elastic-eslint-config-kibana/react.js
@@ -1,5 +1,5 @@
const semver = require('semver');
-const { kibanaPackageJson: PKG } = require('@kbn/dev-utils');
+const { kibanaPackageJson: PKG } = require('@kbn/utils');
module.exports = {
plugins: [
diff --git a/packages/elastic-eslint-config-kibana/typescript.js b/packages/elastic-eslint-config-kibana/typescript.js
index 1a0ef81ae2f1e..3ada725cb1805 100644
--- a/packages/elastic-eslint-config-kibana/typescript.js
+++ b/packages/elastic-eslint-config-kibana/typescript.js
@@ -4,7 +4,7 @@
// as this package was moved from typescript-eslint-parser to @typescript-eslint/parser
const semver = require('semver');
-const { kibanaPackageJson: PKG } = require('@kbn/dev-utils');
+const { kibanaPackageJson: PKG } = require('@kbn/utils');
const eslintConfigPrettierTypescriptEslintRules = require('eslint-config-prettier/@typescript-eslint').rules;
diff --git a/packages/kbn-cli-dev-mode/BUILD.bazel b/packages/kbn-cli-dev-mode/BUILD.bazel
index dfb441dffc6ef..cdc40e85c972a 100644
--- a/packages/kbn-cli-dev-mode/BUILD.bazel
+++ b/packages/kbn-cli-dev-mode/BUILD.bazel
@@ -50,7 +50,7 @@ RUNTIME_DEPS = [
TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
"//packages/kbn-config-schema:npm_module_types",
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-logging",
"//packages/kbn-optimizer",
"//packages/kbn-server-http-tools",
diff --git a/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts b/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts
index e5e009e51e69e..0066644d0825a 100644
--- a/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts
+++ b/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts
@@ -8,11 +8,9 @@
import Path from 'path';
import * as Rx from 'rxjs';
-import {
- REPO_ROOT,
- createAbsolutePathSerializer,
- createAnyInstanceSerializer,
-} from '@kbn/dev-utils';
+import { createAbsolutePathSerializer, createAnyInstanceSerializer } from '@kbn/dev-utils';
+
+import { REPO_ROOT } from '@kbn/utils';
import { TestLog } from './log';
import { CliDevMode, SomeCliArgs } from './cli_dev_mode';
diff --git a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts
index 2396b316aa3a2..9cf688b675e67 100644
--- a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts
+++ b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts
@@ -22,7 +22,8 @@ import {
takeUntil,
} from 'rxjs/operators';
import { CliArgs } from '@kbn/config';
-import { REPO_ROOT, CiStatsReporter } from '@kbn/dev-utils';
+import { CiStatsReporter } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Log, CliLog } from './log';
import { Optimizer } from './optimizer';
diff --git a/packages/kbn-cli-dev-mode/src/get_server_watch_paths.test.ts b/packages/kbn-cli-dev-mode/src/get_server_watch_paths.test.ts
index 06ded8d8bf526..25bc59bf78458 100644
--- a/packages/kbn-cli-dev-mode/src/get_server_watch_paths.test.ts
+++ b/packages/kbn-cli-dev-mode/src/get_server_watch_paths.test.ts
@@ -8,7 +8,8 @@
import Path from 'path';
-import { REPO_ROOT, createAbsolutePathSerializer } from '@kbn/dev-utils';
+import { createAbsolutePathSerializer } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { getServerWatchPaths } from './get_server_watch_paths';
diff --git a/packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts b/packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
index f075dc806b6ec..acfc9aeecdc80 100644
--- a/packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
+++ b/packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
@@ -9,7 +9,7 @@
import Path from 'path';
import Fs from 'fs';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
interface Options {
pluginPaths: string[];
diff --git a/packages/kbn-crypto/BUILD.bazel b/packages/kbn-crypto/BUILD.bazel
index 81ee6d770103c..f71c8b866fd5d 100644
--- a/packages/kbn-crypto/BUILD.bazel
+++ b/packages/kbn-crypto/BUILD.bazel
@@ -34,7 +34,7 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"@npm//@types/flot",
"@npm//@types/jest",
"@npm//@types/node",
diff --git a/packages/kbn-dev-utils/BUILD.bazel b/packages/kbn-dev-utils/BUILD.bazel
index 4fd99e0144cb6..89df1870a3cec 100644
--- a/packages/kbn-dev-utils/BUILD.bazel
+++ b/packages/kbn-dev-utils/BUILD.bazel
@@ -1,9 +1,10 @@
-load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
-load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
-load("//src/dev/bazel:index.bzl", "jsts_transpiler")
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_BASE_NAME = "kbn-dev-utils"
PKG_REQUIRE_NAME = "@kbn/dev-utils"
+TYPES_PKG_REQUIRE_NAME = "@types/kbn__dev-utils"
SOURCE_FILES = glob(
[
@@ -43,7 +44,6 @@ NPM_MODULE_EXTRA_FILES = [
]
RUNTIME_DEPS = [
- "//packages/kbn-std",
"//packages/kbn-utils",
"@npm//@babel/core",
"@npm//axios",
@@ -66,7 +66,6 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-std",
"//packages/kbn-utils",
"@npm//@babel/parser",
"@npm//@babel/types",
@@ -124,7 +123,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
- deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
+ deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
@@ -143,3 +142,20 @@ filegroup(
],
visibility = ["//visibility:public"],
)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = TYPES_PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [
+ ":npm_module_types",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/kbn-dev-utils/package.json b/packages/kbn-dev-utils/package.json
index 9d6e6dde86fac..ab4f489e7d345 100644
--- a/packages/kbn-dev-utils/package.json
+++ b/packages/kbn-dev-utils/package.json
@@ -4,7 +4,6 @@
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target_node/index.js",
- "types": "./target_types/index.d.ts",
"kibana": {
"devOnly": true
}
diff --git a/packages/kbn-dev-utils/src/index.ts b/packages/kbn-dev-utils/src/index.ts
index 381e99ac677f5..9b207ad9e9966 100644
--- a/packages/kbn-dev-utils/src/index.ts
+++ b/packages/kbn-dev-utils/src/index.ts
@@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
-export * from '@kbn/utils';
export { withProcRunner, ProcRunner } from './proc_runner';
export * from './tooling_log';
export * from './serializers';
diff --git a/packages/kbn-docs-utils/BUILD.bazel b/packages/kbn-docs-utils/BUILD.bazel
index 37e5bb06377cc..edfd3ee96c181 100644
--- a/packages/kbn-docs-utils/BUILD.bazel
+++ b/packages/kbn-docs-utils/BUILD.bazel
@@ -38,7 +38,7 @@ RUNTIME_DEPS = [
TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-utils",
"@npm//ts-morph",
"@npm//@types/dedent",
diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts
index 2e4ce08540714..3c9137b260a3e 100644
--- a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts
+++ b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts
@@ -9,7 +9,8 @@
import Fs from 'fs';
import Path from 'path';
-import { REPO_ROOT, run, CiStatsReporter, createFlagError } from '@kbn/dev-utils';
+import { run, CiStatsReporter, createFlagError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Project } from 'ts-morph';
import { writePluginDocs } from './mdx/write_plugin_mdx_docs';
@@ -241,7 +242,7 @@ export function runBuildApiDocsCli() {
boolean: ['references'],
help: `
--plugin Optionally, run for only a specific plugin
- --stats Optionally print API stats. Must be one or more of: any, comments or exports.
+ --stats Optionally print API stats. Must be one or more of: any, comments or exports.
--references Collect references for API items
`,
},
diff --git a/packages/kbn-docs-utils/src/api_docs/find_plugins.ts b/packages/kbn-docs-utils/src/api_docs/find_plugins.ts
index 78cba3f3a9476..774452a6f1f9f 100644
--- a/packages/kbn-docs-utils/src/api_docs/find_plugins.ts
+++ b/packages/kbn-docs-utils/src/api_docs/find_plugins.ts
@@ -12,7 +12,8 @@ import globby from 'globby';
import loadJsonFile from 'load-json-file';
import { getPluginSearchPaths } from '@kbn/config';
-import { simpleKibanaPlatformPluginDiscovery, REPO_ROOT } from '@kbn/dev-utils';
+import { simpleKibanaPlatformPluginDiscovery } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { ApiScope, PluginOrPackage } from './types';
export function findPlugins(): PluginOrPackage[] {
diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel
index 2dc311ed74406..da8aaf913ab67 100644
--- a/packages/kbn-es-archiver/BUILD.bazel
+++ b/packages/kbn-es-archiver/BUILD.bazel
@@ -1,9 +1,10 @@
-load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
-load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
-load("//src/dev/bazel:index.bzl", "jsts_transpiler")
+load("@npm//@bazel/typescript:index.bzl", "ts_config")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_BASE_NAME = "kbn-es-archiver"
PKG_REQUIRE_NAME = "@kbn/es-archiver"
+TYPES_PKG_REQUIRE_NAME = "@types/kbn__es-archiver"
SOURCE_FILES = glob(
[
@@ -43,7 +44,7 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-test",
"//packages/kbn-utils",
"@npm//@elastic/elasticsearch",
@@ -90,7 +91,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
- deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
+ deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
@@ -109,3 +110,20 @@ filegroup(
],
visibility = ["//visibility:public"],
)
+
+pkg_npm_types(
+ name = "npm_module_types",
+ srcs = SRCS,
+ deps = [":tsc_types"],
+ package_name = TYPES_PKG_REQUIRE_NAME,
+ tsconfig = ":tsconfig",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "build_types",
+ srcs = [
+ ":npm_module_types",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/packages/kbn-es-archiver/package.json b/packages/kbn-es-archiver/package.json
index 0cce08eaf0352..bff3990a0c1bc 100644
--- a/packages/kbn-es-archiver/package.json
+++ b/packages/kbn-es-archiver/package.json
@@ -4,7 +4,6 @@
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": "true",
"main": "target_node/index.js",
- "types": "target_types/index.d.ts",
"kibana": {
"devOnly": true
}
diff --git a/packages/kbn-es-archiver/src/actions/load.ts b/packages/kbn-es-archiver/src/actions/load.ts
index 0a7235c566b52..c5bea5e29a687 100644
--- a/packages/kbn-es-archiver/src/actions/load.ts
+++ b/packages/kbn-es-archiver/src/actions/load.ts
@@ -9,7 +9,8 @@
import { resolve, relative } from 'path';
import { createReadStream } from 'fs';
import { Readable } from 'stream';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { KbnClient } from '@kbn/test';
import type { Client } from '@elastic/elasticsearch';
import { createPromiseFromStreams, concatStreamProviders } from '@kbn/utils';
diff --git a/packages/kbn-es-archiver/src/actions/rebuild_all.ts b/packages/kbn-es-archiver/src/actions/rebuild_all.ts
index 360fdb438f2db..27fcae0c7cec5 100644
--- a/packages/kbn-es-archiver/src/actions/rebuild_all.ts
+++ b/packages/kbn-es-archiver/src/actions/rebuild_all.ts
@@ -10,8 +10,8 @@ import { resolve, relative } from 'path';
import { Stats, createReadStream, createWriteStream } from 'fs';
import { stat, rename } from 'fs/promises';
import { Readable, Writable } from 'stream';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
-import { createPromiseFromStreams } from '@kbn/utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { createPromiseFromStreams, REPO_ROOT } from '@kbn/utils';
import {
prioritizeMappings,
readDirectory,
diff --git a/packages/kbn-es-archiver/src/actions/save.ts b/packages/kbn-es-archiver/src/actions/save.ts
index 9cb5be05ac060..e5e3f06b8436d 100644
--- a/packages/kbn-es-archiver/src/actions/save.ts
+++ b/packages/kbn-es-archiver/src/actions/save.ts
@@ -10,8 +10,8 @@ import { resolve, relative } from 'path';
import { createWriteStream, mkdirSync } from 'fs';
import { Readable, Writable } from 'stream';
import type { Client } from '@elastic/elasticsearch';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
-import { createListStream, createPromiseFromStreams } from '@kbn/utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { createListStream, createPromiseFromStreams, REPO_ROOT } from '@kbn/utils';
import {
createStats,
diff --git a/packages/kbn-es-archiver/src/actions/unload.ts b/packages/kbn-es-archiver/src/actions/unload.ts
index 1c5f4cd5d7d03..22830b7289174 100644
--- a/packages/kbn-es-archiver/src/actions/unload.ts
+++ b/packages/kbn-es-archiver/src/actions/unload.ts
@@ -10,9 +10,9 @@ import { resolve, relative } from 'path';
import { createReadStream } from 'fs';
import { Readable, Writable } from 'stream';
import type { Client } from '@elastic/elasticsearch';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
-import { createPromiseFromStreams } from '@kbn/utils';
+import { createPromiseFromStreams, REPO_ROOT } from '@kbn/utils';
import {
isGzip,
diff --git a/packages/kbn-es-archiver/src/es_archiver.ts b/packages/kbn-es-archiver/src/es_archiver.ts
index 354197a98fa46..e13e20f25a703 100644
--- a/packages/kbn-es-archiver/src/es_archiver.ts
+++ b/packages/kbn-es-archiver/src/es_archiver.ts
@@ -10,7 +10,8 @@ import Fs from 'fs';
import Path from 'path';
import type { Client } from '@elastic/elasticsearch';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { KbnClient } from '@kbn/test';
import {
diff --git a/packages/kbn-es-archiver/src/lib/docs/generate_doc_records_stream.test.ts b/packages/kbn-es-archiver/src/lib/docs/generate_doc_records_stream.test.ts
index ae21649690a99..2590074a25411 100644
--- a/packages/kbn-es-archiver/src/lib/docs/generate_doc_records_stream.test.ts
+++ b/packages/kbn-es-archiver/src/lib/docs/generate_doc_records_stream.test.ts
@@ -6,13 +6,14 @@
* Side Public License, v 1.
*/
+import { ToolingLog } from '@kbn/dev-utils';
+
import {
createListStream,
createPromiseFromStreams,
createConcatStream,
createMapStream,
- ToolingLog,
-} from '@kbn/dev-utils';
+} from '@kbn/utils';
import { createGenerateDocRecordsStream } from './generate_doc_records_stream';
import { Progress } from '../progress';
diff --git a/packages/kbn-es-archiver/src/lib/docs/index_doc_records_stream.test.ts b/packages/kbn-es-archiver/src/lib/docs/index_doc_records_stream.test.ts
index bcf28a4976a1c..9c0ff4a8f91ec 100644
--- a/packages/kbn-es-archiver/src/lib/docs/index_doc_records_stream.test.ts
+++ b/packages/kbn-es-archiver/src/lib/docs/index_doc_records_stream.test.ts
@@ -6,12 +6,9 @@
* Side Public License, v 1.
*/
-import {
- createListStream,
- createPromiseFromStreams,
- ToolingLog,
- createRecursiveSerializer,
-} from '@kbn/dev-utils';
+import { ToolingLog, createRecursiveSerializer } from '@kbn/dev-utils';
+
+import { createListStream, createPromiseFromStreams } from '@kbn/utils';
import { Progress } from '../progress';
import { createIndexDocRecordsStream } from './index_doc_records_stream';
diff --git a/packages/kbn-es/BUILD.bazel b/packages/kbn-es/BUILD.bazel
index 91dc48cec7d0c..2ea9c32858dd3 100644
--- a/packages/kbn-es/BUILD.bazel
+++ b/packages/kbn-es/BUILD.bazel
@@ -1,5 +1,5 @@
-load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
-load("//src/dev/bazel:index.bzl", "jsts_transpiler")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm")
PKG_BASE_NAME = "kbn-es"
PKG_REQUIRE_NAME = "@kbn/es"
diff --git a/packages/kbn-es/src/artifact.test.js b/packages/kbn-es/src/artifact.test.js
index c65109bc34610..884804ed75a65 100644
--- a/packages/kbn-es/src/artifact.test.js
+++ b/packages/kbn-es/src/artifact.test.js
@@ -90,10 +90,10 @@ const artifactTest = (requestedLicense, expectedLicense, fetchTimesCalled = 1) =
`${PERMANENT_SNAPSHOT_BASE_URL}/${MOCK_VERSION}/manifest.json`
);
}
- expect(artifact.getUrl()).toEqual(MOCK_URL + `/${expectedLicense}`);
- expect(artifact.getChecksumUrl()).toEqual(MOCK_URL + `/${expectedLicense}.sha512`);
- expect(artifact.getChecksumType()).toEqual('sha512');
- expect(artifact.getFilename()).toEqual(MOCK_FILENAME + `-${ARCHITECTURE}.${expectedLicense}`);
+ expect(artifact.spec.url).toEqual(MOCK_URL + `/${expectedLicense}`);
+ expect(artifact.spec.checksumUrl).toEqual(MOCK_URL + `/${expectedLicense}.sha512`);
+ expect(artifact.spec.checksumType).toEqual('sha512');
+ expect(artifact.spec.filename).toEqual(MOCK_FILENAME + `-${ARCHITECTURE}.${expectedLicense}`);
};
};
@@ -158,7 +158,7 @@ describe('Artifact', () => {
it('should return artifact metadata for the correct architecture', async () => {
const artifact = await Artifact.getSnapshot('oss', MOCK_VERSION, log);
- expect(artifact.getFilename()).toEqual(MOCK_FILENAME + `-${ARCHITECTURE}.oss`);
+ expect(artifact.spec.filename).toEqual(MOCK_FILENAME + `-${ARCHITECTURE}.oss`);
});
});
@@ -182,7 +182,7 @@ describe('Artifact', () => {
describe('with latest unverified snapshot', () => {
beforeEach(() => {
- process.env.KBN_ES_SNAPSHOT_USE_UNVERIFIED = 1;
+ process.env.KBN_ES_SNAPSHOT_USE_UNVERIFIED = '1';
mockFetch(MOCKS.valid);
});
diff --git a/packages/kbn-es/src/artifact.js b/packages/kbn-es/src/artifact.ts
similarity index 65%
rename from packages/kbn-es/src/artifact.js
rename to packages/kbn-es/src/artifact.ts
index 0fa2c7a1727d0..9c5935c96e8cd 100644
--- a/packages/kbn-es/src/artifact.js
+++ b/packages/kbn-es/src/artifact.ts
@@ -6,25 +6,69 @@
* Side Public License, v 1.
*/
-const fetch = require('node-fetch');
-const AbortController = require('abort-controller');
-const fs = require('fs');
-const { promisify } = require('util');
-const { pipeline, Transform } = require('stream');
-const chalk = require('chalk');
-const { createHash } = require('crypto');
-const path = require('path');
+import fs from 'fs';
+import { promisify } from 'util';
+import path from 'path';
+import { createHash } from 'crypto';
+import { pipeline, Transform } from 'stream';
+import { setTimeout } from 'timers/promises';
+
+import fetch, { Headers } from 'node-fetch';
+import AbortController from 'abort-controller';
+import chalk from 'chalk';
+import { ToolingLog } from '@kbn/dev-utils';
+
+import { cache } from './utils/cache';
+import { resolveCustomSnapshotUrl } from './custom_snapshots';
+import { createCliError, isCliError } from './errors';
const asyncPipeline = promisify(pipeline);
const DAILY_SNAPSHOTS_BASE_URL = 'https://storage.googleapis.com/kibana-ci-es-snapshots-daily';
const PERMANENT_SNAPSHOTS_BASE_URL =
'https://storage.googleapis.com/kibana-ci-es-snapshots-permanent';
-const { cache } = require('./utils');
-const { resolveCustomSnapshotUrl } = require('./custom_snapshots');
-const { createCliError, isCliError } = require('./errors');
+type ChecksumType = 'sha512';
+export type ArtifactLicense = 'oss' | 'basic' | 'trial';
+
+interface ArtifactManifest {
+ id: string;
+ bucket: string;
+ branch: string;
+ sha: string;
+ sha_short: string;
+ version: string;
+ generated: string;
+ archives: Array<{
+ filename: string;
+ checksum: string;
+ url: string;
+ version: string;
+ platform: string;
+ architecture: string;
+ license: string;
+ }>;
+}
+
+export interface ArtifactSpec {
+ url: string;
+ checksumUrl: string;
+ checksumType: ChecksumType;
+ filename: string;
+}
+
+interface ArtifactDownloaded {
+ cached: false;
+ checksum: string;
+ etag?: string;
+ contentLength: number;
+ first500Bytes: Buffer;
+ headers: Headers;
+}
+interface ArtifactCached {
+ cached: true;
+}
-function getChecksumType(checksumUrl) {
+function getChecksumType(checksumUrl: string): ChecksumType {
if (checksumUrl.endsWith('.sha512')) {
return 'sha512';
}
@@ -32,15 +76,18 @@ function getChecksumType(checksumUrl) {
throw new Error(`unable to determine checksum type: ${checksumUrl}`);
}
-function headersToString(headers, indent = '') {
+function headersToString(headers: Headers, indent = '') {
return [...headers.entries()].reduce(
(acc, [key, value]) => `${acc}\n${indent}${key}: ${value}`,
''
);
}
-async function retry(log, fn) {
- async function doAttempt(attempt) {
+async function retry(log: ToolingLog, fn: () => Promise): Promise {
+ let attempt = 0;
+ while (true) {
+ attempt += 1;
+
try {
return await fn();
} catch (error) {
@@ -49,13 +96,10 @@ async function retry(log, fn) {
}
log.warning('...failure, retrying in 5 seconds:', error.message);
- await new Promise((resolve) => setTimeout(resolve, 5000));
+ await setTimeout(5000);
log.info('...retrying');
- return await doAttempt(attempt + 1);
}
}
-
- return await doAttempt(1);
}
// Setting this flag provides an easy way to run the latest un-promoted snapshot without having to look it up
@@ -63,7 +107,7 @@ function shouldUseUnverifiedSnapshot() {
return !!process.env.KBN_ES_SNAPSHOT_USE_UNVERIFIED;
}
-async function fetchSnapshotManifest(url, log) {
+async function fetchSnapshotManifest(url: string, log: ToolingLog) {
log.info('Downloading snapshot manifest from %s', chalk.bold(url));
const abc = new AbortController();
@@ -73,7 +117,11 @@ async function fetchSnapshotManifest(url, log) {
return { abc, resp, json };
}
-async function getArtifactSpecForSnapshot(urlVersion, license, log) {
+async function getArtifactSpecForSnapshot(
+ urlVersion: string,
+ license: string,
+ log: ToolingLog
+): Promise {
const desiredVersion = urlVersion.replace('-SNAPSHOT', '');
const desiredLicense = license === 'oss' ? 'oss' : 'default';
@@ -103,17 +151,16 @@ async function getArtifactSpecForSnapshot(urlVersion, license, log) {
throw new Error(`Unable to read snapshot manifest: ${resp.statusText}\n ${json}`);
}
- const manifest = JSON.parse(json);
-
+ const manifest: ArtifactManifest = JSON.parse(json);
const platform = process.platform === 'win32' ? 'windows' : process.platform;
const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';
const archive = manifest.archives.find(
- (archive) =>
- archive.version === desiredVersion &&
- archive.platform === platform &&
- archive.license === desiredLicense &&
- archive.architecture === arch
+ (a) =>
+ a.version === desiredVersion &&
+ a.platform === platform &&
+ a.license === desiredLicense &&
+ a.architecture === arch
);
if (!archive) {
@@ -130,93 +177,65 @@ async function getArtifactSpecForSnapshot(urlVersion, license, log) {
};
}
-exports.Artifact = class Artifact {
+export class Artifact {
/**
* Fetch an Artifact from the Artifact API for a license level and version
- * @param {('oss'|'basic'|'trial')} license
- * @param {string} version
- * @param {ToolingLog} log
*/
- static async getSnapshot(license, version, log) {
+ static async getSnapshot(license: ArtifactLicense, version: string, log: ToolingLog) {
const urlVersion = `${encodeURIComponent(version)}-SNAPSHOT`;
const customSnapshotArtifactSpec = resolveCustomSnapshotUrl(urlVersion, license);
if (customSnapshotArtifactSpec) {
- return new Artifact(customSnapshotArtifactSpec, log);
+ return new Artifact(log, customSnapshotArtifactSpec);
}
const artifactSpec = await getArtifactSpecForSnapshot(urlVersion, license, log);
- return new Artifact(artifactSpec, log);
+ return new Artifact(log, artifactSpec);
}
/**
* Fetch an Artifact from the Elasticsearch past releases url
- * @param {string} url
- * @param {ToolingLog} log
*/
- static async getArchive(url, log) {
+ static async getArchive(url: string, log: ToolingLog) {
const shaUrl = `${url}.sha512`;
- const artifactSpec = {
- url: url,
+ return new Artifact(log, {
+ url,
filename: path.basename(url),
checksumUrl: shaUrl,
checksumType: getChecksumType(shaUrl),
- };
-
- return new Artifact(artifactSpec, log);
- }
-
- constructor(spec, log) {
- this._spec = spec;
- this._log = log;
- }
-
- getUrl() {
- return this._spec.url;
- }
-
- getChecksumUrl() {
- return this._spec.checksumUrl;
+ });
}
- getChecksumType() {
- return this._spec.checksumType;
- }
-
- getFilename() {
- return this._spec.filename;
- }
+ constructor(private readonly log: ToolingLog, public readonly spec: ArtifactSpec) {}
/**
* Download the artifact to disk, skips the download if the cache is
* up-to-date, verifies checksum when downloaded
- * @param {string} dest
- * @return {Promise}
*/
- async download(dest, { useCached = false }) {
- await retry(this._log, async () => {
+ async download(dest: string, { useCached = false }: { useCached?: boolean } = {}) {
+ await retry(this.log, async () => {
const cacheMeta = cache.readMeta(dest);
const tmpPath = `${dest}.tmp`;
if (useCached) {
if (cacheMeta.exists) {
- this._log.info(
+ this.log.info(
'use-cached passed, forcing to use existing snapshot',
chalk.bold(cacheMeta.ts)
);
return;
} else {
- this._log.info('use-cached passed but no cached snapshot found. Continuing to download');
+ this.log.info('use-cached passed but no cached snapshot found. Continuing to download');
}
}
- const artifactResp = await this._download(tmpPath, cacheMeta.etag, cacheMeta.ts);
+ const artifactResp = await this.fetchArtifact(tmpPath, cacheMeta.etag, cacheMeta.ts);
if (artifactResp.cached) {
return;
}
- await this._verifyChecksum(artifactResp);
+ await this.verifyChecksum(artifactResp);
// cache the etag for future downloads
cache.writeMeta(dest, { etag: artifactResp.etag });
@@ -228,18 +247,18 @@ exports.Artifact = class Artifact {
/**
* Fetch the artifact with an etag
- * @param {string} tmpPath
- * @param {string} etag
- * @param {string} ts
- * @return {{ cached: true }|{ checksum: string, etag: string, first500Bytes: Buffer }}
*/
- async _download(tmpPath, etag, ts) {
- const url = this.getUrl();
+ private async fetchArtifact(
+ tmpPath: string,
+ etag: string,
+ ts: string
+ ): Promise {
+ const url = this.spec.url;
if (etag) {
- this._log.info('verifying cache of %s', chalk.bold(url));
+ this.log.info('verifying cache of %s', chalk.bold(url));
} else {
- this._log.info('downloading artifact from %s', chalk.bold(url));
+ this.log.info('downloading artifact from %s', chalk.bold(url));
}
const abc = new AbortController();
@@ -251,7 +270,7 @@ exports.Artifact = class Artifact {
});
if (resp.status === 304) {
- this._log.info('etags match, reusing cache from %s', chalk.bold(ts));
+ this.log.info('etags match, reusing cache from %s', chalk.bold(ts));
abc.abort();
return {
@@ -270,10 +289,10 @@ exports.Artifact = class Artifact {
}
if (etag) {
- this._log.info('cache invalid, redownloading');
+ this.log.info('cache invalid, redownloading');
}
- const hash = createHash(this.getChecksumType());
+ const hash = createHash(this.spec.checksumType);
let first500Bytes = Buffer.alloc(0);
let contentLength = 0;
@@ -300,8 +319,9 @@ exports.Artifact = class Artifact {
);
return {
+ cached: false,
checksum: hash.digest('hex'),
- etag: resp.headers.get('etag'),
+ etag: resp.headers.get('etag') ?? undefined,
contentLength,
first500Bytes,
headers: resp.headers,
@@ -310,14 +330,12 @@ exports.Artifact = class Artifact {
/**
* Verify the checksum of the downloaded artifact with the checksum at checksumUrl
- * @param {{ checksum: string, contentLength: number, first500Bytes: Buffer }} artifactResp
- * @return {Promise}
*/
- async _verifyChecksum(artifactResp) {
- this._log.info('downloading artifact checksum from %s', chalk.bold(this.getChecksumUrl()));
+ private async verifyChecksum(artifactResp: ArtifactDownloaded) {
+ this.log.info('downloading artifact checksum from %s', chalk.bold(this.spec.checksumUrl));
const abc = new AbortController();
- const resp = await fetch(this.getChecksumUrl(), {
+ const resp = await fetch(this.spec.checksumUrl, {
signal: abc.signal,
});
@@ -338,7 +356,7 @@ exports.Artifact = class Artifact {
const lenString = `${len} / ${artifactResp.contentLength}`;
throw createCliError(
- `artifact downloaded from ${this.getUrl()} does not match expected checksum\n` +
+ `artifact downloaded from ${this.spec.url} does not match expected checksum\n` +
` expected: ${expectedChecksum}\n` +
` received: ${artifactResp.checksum}\n` +
` headers: ${headersToString(artifactResp.headers, ' ')}\n` +
@@ -346,6 +364,6 @@ exports.Artifact = class Artifact {
);
}
- this._log.info('checksum verified');
+ this.log.info('checksum verified');
}
-};
+}
diff --git a/packages/kbn-es/src/custom_snapshots.js b/packages/kbn-es/src/custom_snapshots.ts
similarity index 82%
rename from packages/kbn-es/src/custom_snapshots.js
rename to packages/kbn-es/src/custom_snapshots.ts
index 9dd8097244947..f3e6d3ecaf857 100644
--- a/packages/kbn-es/src/custom_snapshots.js
+++ b/packages/kbn-es/src/custom_snapshots.ts
@@ -6,13 +6,15 @@
* Side Public License, v 1.
*/
-const { basename } = require('path');
+import Path from 'path';
-function isVersionFlag(a) {
+import type { ArtifactSpec } from './artifact';
+
+function isVersionFlag(a: string) {
return a.startsWith('--version');
}
-function getCustomSnapshotUrl() {
+export function getCustomSnapshotUrl() {
// force use of manually created snapshots until ReindexPutMappings fix
if (
!process.env.ES_SNAPSHOT_MANIFEST &&
@@ -28,7 +30,10 @@ function getCustomSnapshotUrl() {
}
}
-function resolveCustomSnapshotUrl(urlVersion, license) {
+export function resolveCustomSnapshotUrl(
+ urlVersion: string,
+ license: string
+): ArtifactSpec | undefined {
const customSnapshotUrl = getCustomSnapshotUrl();
if (!customSnapshotUrl) {
@@ -48,8 +53,6 @@ function resolveCustomSnapshotUrl(urlVersion, license) {
url: overrideUrl,
checksumUrl: overrideUrl + '.sha512',
checksumType: 'sha512',
- filename: basename(overrideUrl),
+ filename: Path.basename(overrideUrl),
};
}
-
-module.exports = { getCustomSnapshotUrl, resolveCustomSnapshotUrl };
diff --git a/packages/kbn-es/src/errors.ts b/packages/kbn-es/src/errors.ts
new file mode 100644
index 0000000000000..a0c526dc48a9c
--- /dev/null
+++ b/packages/kbn-es/src/errors.ts
@@ -0,0 +1,25 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+interface CliError extends Error {
+ isCliError: boolean;
+}
+
+export function createCliError(message: string) {
+ return Object.assign(new Error(message), {
+ isCliError: true,
+ });
+}
+
+function isObj(x: unknown): x is Record {
+ return typeof x === 'object' && x !== null;
+}
+
+export function isCliError(error: unknown): error is CliError {
+ return isObj(error) && error.isCliError === true;
+}
diff --git a/packages/kbn-es/src/index.js b/packages/kbn-es/src/index.ts
similarity index 72%
rename from packages/kbn-es/src/index.js
rename to packages/kbn-es/src/index.ts
index 3b12de68234fa..68fd931794c0c 100644
--- a/packages/kbn-es/src/index.js
+++ b/packages/kbn-es/src/index.ts
@@ -6,5 +6,7 @@
* Side Public License, v 1.
*/
-exports.run = require('./cli').run;
-exports.Cluster = require('./cluster').Cluster;
+// @ts-expect-error not typed yet
+export { run } from './cli';
+// @ts-expect-error not typed yet
+export { Cluster } from './cluster';
diff --git a/packages/kbn-es/src/install/index.js b/packages/kbn-es/src/install/index.ts
similarity index 58%
rename from packages/kbn-es/src/install/index.js
rename to packages/kbn-es/src/install/index.ts
index 07582f73c663a..e827dee2247f9 100644
--- a/packages/kbn-es/src/install/index.js
+++ b/packages/kbn-es/src/install/index.ts
@@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
-exports.installArchive = require('./archive').installArchive;
-exports.installSnapshot = require('./snapshot').installSnapshot;
-exports.downloadSnapshot = require('./snapshot').downloadSnapshot;
-exports.installSource = require('./source').installSource;
+export { installArchive } from './install_archive';
+export { installSnapshot, downloadSnapshot } from './install_snapshot';
+export { installSource } from './install_source';
diff --git a/packages/kbn-es/src/install/archive.js b/packages/kbn-es/src/install/install_archive.ts
similarity index 64%
rename from packages/kbn-es/src/install/archive.js
rename to packages/kbn-es/src/install/install_archive.ts
index 76db5a4427e6d..ee04d9e4b62b5 100644
--- a/packages/kbn-es/src/install/archive.js
+++ b/packages/kbn-es/src/install/install_archive.ts
@@ -6,29 +6,40 @@
* Side Public License, v 1.
*/
-const fs = require('fs');
-const path = require('path');
-const chalk = require('chalk');
-const execa = require('execa');
-const del = require('del');
-const url = require('url');
-const { extract } = require('@kbn/dev-utils');
-const { log: defaultLog } = require('../utils');
-const { BASE_PATH, ES_CONFIG, ES_KEYSTORE_BIN } = require('../paths');
-const { Artifact } = require('../artifact');
-const { parseSettings, SettingsFilter } = require('../settings');
+import fs from 'fs';
+import path from 'path';
+
+import chalk from 'chalk';
+import execa from 'execa';
+import del from 'del';
+import { extract, ToolingLog } from '@kbn/dev-utils';
+
+import { BASE_PATH, ES_CONFIG, ES_KEYSTORE_BIN } from '../paths';
+import { Artifact } from '../artifact';
+import { parseSettings, SettingsFilter } from '../settings';
+import { log as defaultLog } from '../utils/log';
+
+interface InstallArchiveOptions {
+ license?: string;
+ password?: string;
+ basePath?: string;
+ installPath?: string;
+ log?: ToolingLog;
+ esArgs?: string[];
+}
+
+const isHttpUrl = (str: string) => {
+ try {
+ return ['http:', 'https:'].includes(new URL(str).protocol);
+ } catch {
+ return false;
+ }
+};
/**
* Extracts an ES archive and optionally installs plugins
- *
- * @param {String} archive - path to tar
- * @param {Object} options
- * @property {('oss'|'basic'|'trial')} options.license
- * @property {String} options.basePath
- * @property {String} options.installPath
- * @property {ToolingLog} options.log
*/
-exports.installArchive = async function installArchive(archive, options = {}) {
+export async function installArchive(archive: string, options: InstallArchiveOptions = {}) {
const {
license = 'basic',
password = 'changeme',
@@ -39,9 +50,9 @@ exports.installArchive = async function installArchive(archive, options = {}) {
} = options;
let dest = archive;
- if (['http:', 'https:'].includes(url.parse(archive).protocol)) {
+ if (isHttpUrl(archive)) {
const artifact = await Artifact.getArchive(archive, log);
- dest = path.resolve(basePath, 'cache', artifact.getFilename());
+ dest = path.resolve(basePath, 'cache', artifact.spec.filename);
await artifact.download(dest);
}
@@ -75,28 +86,23 @@ exports.installArchive = async function installArchive(archive, options = {}) {
}
return { installPath };
-};
+}
/**
* Appends single line to elasticsearch.yml config file
- *
- * @param {String} installPath
- * @param {String} key
- * @param {String} value
*/
-async function appendToConfig(installPath, key, value) {
+async function appendToConfig(installPath: string, key: string, value: string) {
fs.appendFileSync(path.resolve(installPath, ES_CONFIG), `${key}: ${value}\n`, 'utf8');
}
/**
* Creates and configures Keystore
- *
- * @param {String} installPath
- * @param {ToolingLog} log
- * @param {Array<[string, string]>} secureSettings List of custom Elasticsearch secure settings to
- * add into the keystore.
*/
-async function configureKeystore(installPath, log = defaultLog, secureSettings) {
+async function configureKeystore(
+ installPath: string,
+ log: ToolingLog = defaultLog,
+ secureSettings: Array<[string, string]>
+) {
const env = { JAVA_HOME: '' };
await execa(ES_KEYSTORE_BIN, ['create'], { cwd: installPath, env });
diff --git a/packages/kbn-es/src/install/snapshot.js b/packages/kbn-es/src/install/install_snapshot.ts
similarity index 55%
rename from packages/kbn-es/src/install/snapshot.js
rename to packages/kbn-es/src/install/install_snapshot.ts
index cf1ce50f7e413..84d713745eb82 100644
--- a/packages/kbn-es/src/install/snapshot.js
+++ b/packages/kbn-es/src/install/install_snapshot.ts
@@ -6,56 +6,58 @@
* Side Public License, v 1.
*/
-const chalk = require('chalk');
-const path = require('path');
-const { BASE_PATH } = require('../paths');
-const { installArchive } = require('./archive');
-const { log: defaultLog } = require('../utils');
-const { Artifact } = require('../artifact');
+import path from 'path';
+
+import chalk from 'chalk';
+import { ToolingLog } from '@kbn/dev-utils';
+
+import { BASE_PATH } from '../paths';
+import { installArchive } from './install_archive';
+import { log as defaultLog } from '../utils/log';
+import { Artifact, ArtifactLicense } from '../artifact';
+
+interface DownloadSnapshotOptions {
+ version: string;
+ license?: ArtifactLicense;
+ basePath?: string;
+ installPath?: string;
+ log?: ToolingLog;
+ useCached?: boolean;
+}
/**
* Download an ES snapshot
- *
- * @param {Object} options
- * @property {('oss'|'basic'|'trial')} options.license
- * @property {String} options.version
- * @property {String} options.basePath
- * @property {String} options.installPath
- * @property {ToolingLog} options.log
*/
-exports.downloadSnapshot = async function installSnapshot({
+export async function downloadSnapshot({
license = 'basic',
version,
basePath = BASE_PATH,
installPath = path.resolve(basePath, version),
log = defaultLog,
useCached = false,
-}) {
+}: DownloadSnapshotOptions) {
log.info('version: %s', chalk.bold(version));
log.info('install path: %s', chalk.bold(installPath));
log.info('license: %s', chalk.bold(license));
const artifact = await Artifact.getSnapshot(license, version, log);
- const dest = path.resolve(basePath, 'cache', artifact.getFilename());
+ const dest = path.resolve(basePath, 'cache', artifact.spec.filename);
await artifact.download(dest, { useCached });
return {
downloadPath: dest,
};
-};
+}
+
+interface InstallSnapshotOptions extends DownloadSnapshotOptions {
+ password?: string;
+ esArgs?: string[];
+}
/**
* Installs ES from snapshot
- *
- * @param {Object} options
- * @property {('oss'|'basic'|'trial')} options.license
- * @property {String} options.password
- * @property {String} options.version
- * @property {String} options.basePath
- * @property {String} options.installPath
- * @property {ToolingLog} options.log
*/
-exports.installSnapshot = async function installSnapshot({
+export async function installSnapshot({
license = 'basic',
password = 'password',
version,
@@ -64,8 +66,8 @@ exports.installSnapshot = async function installSnapshot({
log = defaultLog,
esArgs,
useCached = false,
-}) {
- const { downloadPath } = await exports.downloadSnapshot({
+}: InstallSnapshotOptions) {
+ const { downloadPath } = await downloadSnapshot({
license,
version,
basePath,
@@ -82,4 +84,4 @@ exports.installSnapshot = async function installSnapshot({
log,
esArgs,
});
-};
+}
diff --git a/packages/kbn-es/src/install/source.js b/packages/kbn-es/src/install/install_source.ts
similarity index 73%
rename from packages/kbn-es/src/install/source.js
rename to packages/kbn-es/src/install/install_source.ts
index 81a1019509906..d8c272677058e 100644
--- a/packages/kbn-es/src/install/source.js
+++ b/packages/kbn-es/src/install/install_source.ts
@@ -6,28 +6,35 @@
* Side Public License, v 1.
*/
-const path = require('path');
-const fs = require('fs');
-const os = require('os');
-const chalk = require('chalk');
-const crypto = require('crypto');
-const simpleGit = require('simple-git/promise');
-const { installArchive } = require('./archive');
-const { log: defaultLog, cache, buildSnapshot, archiveForPlatform } = require('../utils');
-const { BASE_PATH } = require('../paths');
+import path from 'path';
+import fs from 'fs';
+import os from 'os';
+import crypto from 'crypto';
+
+import chalk from 'chalk';
+import simpleGit from 'simple-git/promise';
+import { ToolingLog } from '@kbn/dev-utils';
+
+import { installArchive } from './install_archive';
+import { log as defaultLog } from '../utils/log';
+import { cache } from '../utils/cache';
+import { buildSnapshot, archiveForPlatform } from '../utils/build_snapshot';
+import { BASE_PATH } from '../paths';
+
+interface InstallSourceOptions {
+ sourcePath: string;
+ license?: string;
+ password?: string;
+ basePath?: string;
+ installPath?: string;
+ log?: ToolingLog;
+ esArgs?: string[];
+}
/**
* Installs ES from source
- *
- * @param {Object} options
- * @property {('oss'|'basic'|'trial')} options.license
- * @property {String} options.password
- * @property {String} options.sourcePath
- * @property {String} options.basePath
- * @property {String} options.installPath
- * @property {ToolingLog} options.log
*/
-exports.installSource = async function installSource({
+export async function installSource({
license = 'basic',
password = 'changeme',
sourcePath,
@@ -35,7 +42,7 @@ exports.installSource = async function installSource({
installPath = path.resolve(basePath, 'source'),
log = defaultLog,
esArgs,
-}) {
+}: InstallSourceOptions) {
log.info('source path: %s', chalk.bold(sourcePath));
log.info('install path: %s', chalk.bold(installPath));
log.info('license: %s', chalk.bold(license));
@@ -62,14 +69,9 @@ exports.installSource = async function installSource({
log,
esArgs,
});
-};
+}
-/**
- *
- * @param {String} cwd
- * @param {ToolingLog} log
- */
-async function sourceInfo(cwd, license, log = defaultLog) {
+async function sourceInfo(cwd: string, license: string, log: ToolingLog = defaultLog) {
if (!fs.existsSync(cwd)) {
throw new Error(`${cwd} does not exist`);
}
diff --git a/packages/kbn-es/src/paths.js b/packages/kbn-es/src/paths.js
deleted file mode 100644
index 5c8d3b654ecf9..0000000000000
--- a/packages/kbn-es/src/paths.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-const os = require('os');
-const path = require('path');
-
-function maybeUseBat(bin) {
- return os.platform().startsWith('win') ? `${bin}.bat` : bin;
-}
-
-const tempDir = os.tmpdir();
-
-exports.BASE_PATH = path.resolve(tempDir, 'kbn-es');
-
-exports.GRADLE_BIN = maybeUseBat('./gradlew');
-exports.ES_BIN = maybeUseBat('bin/elasticsearch');
-exports.ES_CONFIG = 'config/elasticsearch.yml';
-
-exports.ES_KEYSTORE_BIN = maybeUseBat('./bin/elasticsearch-keystore');
diff --git a/packages/kbn-es/src/paths.ts b/packages/kbn-es/src/paths.ts
new file mode 100644
index 0000000000000..c1b859af4e1f5
--- /dev/null
+++ b/packages/kbn-es/src/paths.ts
@@ -0,0 +1,24 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import Os from 'os';
+import Path from 'path';
+
+function maybeUseBat(bin: string) {
+ return Os.platform().startsWith('win') ? `${bin}.bat` : bin;
+}
+
+const tempDir = Os.tmpdir();
+
+export const BASE_PATH = Path.resolve(tempDir, 'kbn-es');
+
+export const GRADLE_BIN = maybeUseBat('./gradlew');
+export const ES_BIN = maybeUseBat('bin/elasticsearch');
+export const ES_CONFIG = 'config/elasticsearch.yml';
+
+export const ES_KEYSTORE_BIN = maybeUseBat('./bin/elasticsearch-keystore');
diff --git a/packages/kbn-es/src/utils/build_snapshot.js b/packages/kbn-es/src/utils/build_snapshot.ts
similarity index 53%
rename from packages/kbn-es/src/utils/build_snapshot.js
rename to packages/kbn-es/src/utils/build_snapshot.ts
index ec26ba69e658b..542e63dcc0748 100644
--- a/packages/kbn-es/src/utils/build_snapshot.js
+++ b/packages/kbn-es/src/utils/build_snapshot.ts
@@ -6,25 +6,25 @@
* Side Public License, v 1.
*/
-const execa = require('execa');
-const path = require('path');
-const os = require('os');
-const readline = require('readline');
-const { createCliError } = require('../errors');
-const { findMostRecentlyChanged } = require('../utils');
-const { GRADLE_BIN } = require('../paths');
+import path from 'path';
+import os from 'os';
-const onceEvent = (emitter, event) => new Promise((resolve) => emitter.once(event, resolve));
+import { ToolingLog, withProcRunner } from '@kbn/dev-utils';
+
+import { createCliError } from '../errors';
+import { findMostRecentlyChanged } from './find_most_recently_changed';
+import { GRADLE_BIN } from '../paths';
+
+interface BuildSnapshotOptions {
+ license: string;
+ sourcePath: string;
+ log: ToolingLog;
+ platform?: string;
+}
/**
* Creates archive from source
*
- * @param {Object} options
- * @property {('oss'|'basic'|'trial')} options.license
- * @property {String} options.sourcePath
- * @property {ToolingLog} options.log
- * @returns {Object} containing archive and optional plugins
- *
* Gradle tasks:
* $ ./gradlew tasks --all | grep 'distribution.*assemble\s'
* :distribution:archives:darwin-tar:assemble
@@ -34,39 +34,27 @@ const onceEvent = (emitter, event) => new Promise((resolve) => emitter.once(even
* :distribution:archives:oss-linux-tar:assemble
* :distribution:archives:oss-windows-zip:assemble
*/
-exports.buildSnapshot = async ({ license, sourcePath, log, platform = os.platform() }) => {
+export async function buildSnapshot({
+ license,
+ sourcePath,
+ log,
+ platform = os.platform(),
+}: BuildSnapshotOptions) {
const { task, ext } = exports.archiveForPlatform(platform, license);
const buildArgs = [`:distribution:archives:${task}:assemble`];
log.info('%s %s', GRADLE_BIN, buildArgs.join(' '));
log.debug('cwd:', sourcePath);
- const build = execa(GRADLE_BIN, buildArgs, {
- cwd: sourcePath,
- stdio: ['ignore', 'pipe', 'pipe'],
+ await withProcRunner(log, async (procs) => {
+ await procs.run('gradle', {
+ cmd: GRADLE_BIN,
+ args: buildArgs,
+ cwd: sourcePath,
+ wait: true,
+ });
});
- const stdout = readline.createInterface({ input: build.stdout });
- const stderr = readline.createInterface({ input: build.stderr });
-
- stdout.on('line', (line) => log.debug(line));
- stderr.on('line', (line) => log.error(line));
-
- const [exitCode] = await Promise.all([
- Promise.race([
- onceEvent(build, 'exit'),
- onceEvent(build, 'error').then((error) => {
- throw createCliError(`Error spawning gradle: ${error.message}`);
- }),
- ]),
- onceEvent(stdout, 'close'),
- onceEvent(stderr, 'close'),
- ]);
-
- if (exitCode > 0) {
- throw createCliError('unable to build ES');
- }
-
const archivePattern = `distribution/archives/${task}/build/distributions/elasticsearch-*.${ext}`;
const esArchivePath = findMostRecentlyChanged(path.resolve(sourcePath, archivePattern));
@@ -75,9 +63,9 @@ exports.buildSnapshot = async ({ license, sourcePath, log, platform = os.platfor
}
return esArchivePath;
-};
+}
-exports.archiveForPlatform = (platform, license) => {
+export function archiveForPlatform(platform: NodeJS.Platform, license: string) {
const taskPrefix = license === 'oss' ? 'oss-' : '';
switch (platform) {
@@ -88,6 +76,6 @@ exports.archiveForPlatform = (platform, license) => {
case 'linux':
return { format: 'tar', ext: 'tar.gz', task: `${taskPrefix}linux-tar`, platform: 'linux' };
default:
- throw new Error(`unknown platform: ${platform}`);
+ throw new Error(`unsupported platform: ${platform}`);
}
-};
+}
diff --git a/packages/kbn-es/src/utils/cache.js b/packages/kbn-es/src/utils/cache.js
deleted file mode 100644
index 248faf23bbc46..0000000000000
--- a/packages/kbn-es/src/utils/cache.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-const fs = require('fs');
-const path = require('path');
-
-exports.readMeta = function readMeta(file) {
- try {
- const meta = fs.readFileSync(`${file}.meta`, {
- encoding: 'utf8',
- });
-
- return {
- exists: fs.existsSync(file),
- ...JSON.parse(meta),
- };
- } catch (e) {
- if (e.code !== 'ENOENT') {
- throw e;
- }
-
- return {
- exists: false,
- };
- }
-};
-
-exports.writeMeta = function readMeta(file, details = {}) {
- const meta = {
- ts: new Date(),
- ...details,
- };
-
- fs.mkdirSync(path.dirname(file), { recursive: true });
- fs.writeFileSync(`${file}.meta`, JSON.stringify(meta, null, 2));
-};
diff --git a/packages/kbn-es/src/utils/cache.ts b/packages/kbn-es/src/utils/cache.ts
new file mode 100644
index 0000000000000..819119b6ce010
--- /dev/null
+++ b/packages/kbn-es/src/utils/cache.ts
@@ -0,0 +1,40 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import Fs from 'fs';
+import Path from 'path';
+
+export const cache = {
+ readMeta(path: string) {
+ try {
+ const meta = Fs.readFileSync(`${path}.meta`, {
+ encoding: 'utf8',
+ });
+
+ return {
+ ...JSON.parse(meta),
+ };
+ } catch (e) {
+ if (e.code !== 'ENOENT') {
+ throw e;
+ }
+
+ return {};
+ }
+ },
+
+ writeMeta(path: string, details = {}) {
+ const meta = {
+ ts: new Date(),
+ ...details,
+ };
+
+ Fs.mkdirSync(Path.dirname(path), { recursive: true });
+ Fs.writeFileSync(`${path}.meta`, JSON.stringify(meta, null, 2));
+ },
+};
diff --git a/packages/kbn-es/src/utils/find_most_recently_changed.test.js b/packages/kbn-es/src/utils/find_most_recently_changed.test.ts
similarity index 93%
rename from packages/kbn-es/src/utils/find_most_recently_changed.test.js
rename to packages/kbn-es/src/utils/find_most_recently_changed.test.ts
index 8198495e7197f..721e5baba7513 100644
--- a/packages/kbn-es/src/utils/find_most_recently_changed.test.js
+++ b/packages/kbn-es/src/utils/find_most_recently_changed.test.ts
@@ -6,6 +6,8 @@
* Side Public License, v 1.
*/
+import { findMostRecentlyChanged } from './find_most_recently_changed';
+
jest.mock('fs', () => ({
statSync: jest.fn().mockImplementation((path) => {
if (path.includes('oldest')) {
@@ -31,8 +33,6 @@ jest.mock('fs', () => ({
}),
}));
-const { findMostRecentlyChanged } = require('./find_most_recently_changed');
-
test('returns newest file', () => {
const file = findMostRecentlyChanged('/data/*.yml');
expect(file).toEqual('/data/newest.yml');
diff --git a/packages/kbn-es/src/utils/find_most_recently_changed.js b/packages/kbn-es/src/utils/find_most_recently_changed.ts
similarity index 65%
rename from packages/kbn-es/src/utils/find_most_recently_changed.js
rename to packages/kbn-es/src/utils/find_most_recently_changed.ts
index 16d300f080b8d..29e1edcc5fcc9 100644
--- a/packages/kbn-es/src/utils/find_most_recently_changed.js
+++ b/packages/kbn-es/src/utils/find_most_recently_changed.ts
@@ -6,25 +6,22 @@
* Side Public License, v 1.
*/
-const path = require('path');
-const fs = require('fs');
-const glob = require('glob');
+import path from 'path';
+import fs from 'fs';
+import glob from 'glob';
/**
* Find the most recently modified file that matches the pattern pattern
- *
- * @param {String} pattern absolute path with glob expressions
- * @return {String} Absolute path
*/
-exports.findMostRecentlyChanged = function findMostRecentlyChanged(pattern) {
+export function findMostRecentlyChanged(pattern: string) {
if (!path.isAbsolute(pattern)) {
throw new TypeError(`Pattern must be absolute, got ${pattern}`);
}
- const ctime = (path) => fs.statSync(path).ctime.getTime();
+ const ctime = (p: string) => fs.statSync(p).ctime.getTime();
return glob
.sync(pattern)
.sort((a, b) => ctime(a) - ctime(b))
.pop();
-};
+}
diff --git a/packages/kbn-es/src/utils/index.js b/packages/kbn-es/src/utils/index.js
deleted file mode 100644
index ed83495e5310a..0000000000000
--- a/packages/kbn-es/src/utils/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-exports.cache = require('./cache');
-exports.log = require('./log').log;
-exports.parseEsLog = require('./parse_es_log').parseEsLog;
-exports.findMostRecentlyChanged = require('./find_most_recently_changed').findMostRecentlyChanged;
-exports.extractConfigFiles = require('./extract_config_files').extractConfigFiles;
-exports.NativeRealm = require('./native_realm').NativeRealm;
-exports.buildSnapshot = require('./build_snapshot').buildSnapshot;
-exports.archiveForPlatform = require('./build_snapshot').archiveForPlatform;
diff --git a/packages/kbn-es/src/utils/index.ts b/packages/kbn-es/src/utils/index.ts
new file mode 100644
index 0000000000000..ce0a222dafd3b
--- /dev/null
+++ b/packages/kbn-es/src/utils/index.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export { cache } from './cache';
+export { log } from './log';
+// @ts-expect-error not typed yet
+export { parseEsLog } from './parse_es_log';
+export { findMostRecentlyChanged } from './find_most_recently_changed';
+// @ts-expect-error not typed yet
+export { extractConfigFiles } from './extract_config_files';
+// @ts-expect-error not typed yet
+export { NativeRealm } from './native_realm';
+export { buildSnapshot } from './build_snapshot';
+export { archiveForPlatform } from './build_snapshot';
diff --git a/packages/kbn-es/src/utils/log.js b/packages/kbn-es/src/utils/log.ts
similarity index 80%
rename from packages/kbn-es/src/utils/log.js
rename to packages/kbn-es/src/utils/log.ts
index b33ae509c6c45..a0299f885cf6a 100644
--- a/packages/kbn-es/src/utils/log.js
+++ b/packages/kbn-es/src/utils/log.ts
@@ -6,11 +6,9 @@
* Side Public License, v 1.
*/
-const { ToolingLog } = require('@kbn/dev-utils');
+import { ToolingLog } from '@kbn/dev-utils';
-const log = new ToolingLog({
+export const log = new ToolingLog({
level: 'verbose',
writeTo: process.stdout,
});
-
-exports.log = log;
diff --git a/packages/kbn-eslint-plugin-eslint/helpers/exports.js b/packages/kbn-eslint-plugin-eslint/helpers/exports.js
index b7af8e83d7661..971364633356c 100644
--- a/packages/kbn-eslint-plugin-eslint/helpers/exports.js
+++ b/packages/kbn-eslint-plugin-eslint/helpers/exports.js
@@ -9,7 +9,7 @@
const Fs = require('fs');
const Path = require('path');
const ts = require('typescript');
-const { REPO_ROOT } = require('@kbn/dev-utils');
+const { REPO_ROOT } = require('@kbn/utils');
const { ExportSet } = require('./export_set');
/** @typedef {import("@typescript-eslint/types").TSESTree.ExportAllDeclaration} ExportAllDeclaration */
diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel
index a389086c9ee3c..3bd41249e2d51 100644
--- a/packages/kbn-optimizer/BUILD.bazel
+++ b/packages/kbn-optimizer/BUILD.bazel
@@ -38,10 +38,12 @@ RUNTIME_DEPS = [
"//packages/kbn-ui-shared-deps-npm",
"//packages/kbn-ui-shared-deps-src",
"//packages/kbn-utils",
+ "@npm//@babel/core",
"@npm//chalk",
"@npm//clean-webpack-plugin",
"@npm//compression-webpack-plugin",
"@npm//cpy",
+ "@npm//dedent",
"@npm//del",
"@npm//execa",
"@npm//jest-diff",
@@ -64,7 +66,7 @@ RUNTIME_DEPS = [
TYPES_DEPS = [
"//packages/kbn-config:npm_module_types",
"//packages/kbn-config-schema:npm_module_types",
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-std",
"//packages/kbn-ui-shared-deps-npm",
"//packages/kbn-ui-shared-deps-src",
@@ -79,7 +81,9 @@ TYPES_DEPS = [
"@npm//pirates",
"@npm//rxjs",
"@npm//zlib",
+ "@npm//@types/babel__core",
"@npm//@types/compression-webpack-plugin",
+ "@npm//@types/dedent",
"@npm//@types/jest",
"@npm//@types/json-stable-stringify",
"@npm//@types/js-yaml",
diff --git a/packages/kbn-optimizer/src/babel_runtime_helpers/find_babel_runtime_helpers_in_entry_bundles.ts b/packages/kbn-optimizer/src/babel_runtime_helpers/find_babel_runtime_helpers_in_entry_bundles.ts
index f00905f3f4920..c07a9764af76f 100644
--- a/packages/kbn-optimizer/src/babel_runtime_helpers/find_babel_runtime_helpers_in_entry_bundles.ts
+++ b/packages/kbn-optimizer/src/babel_runtime_helpers/find_babel_runtime_helpers_in_entry_bundles.ts
@@ -8,7 +8,8 @@
import Path from 'path';
-import { run, REPO_ROOT } from '@kbn/dev-utils';
+import { run } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { OptimizerConfig } from '../optimizer';
import { parseStats, inAnyEntryChunk } from './parse_stats';
diff --git a/packages/kbn-optimizer/src/node/node_auto_tranpilation.ts b/packages/kbn-optimizer/src/node/node_auto_tranpilation.ts
index 6f5dabf410ffa..2710ba8a54210 100644
--- a/packages/kbn-optimizer/src/node/node_auto_tranpilation.ts
+++ b/packages/kbn-optimizer/src/node/node_auto_tranpilation.ts
@@ -39,7 +39,7 @@ import Crypto from 'crypto';
import * as babel from '@babel/core';
import { addHook } from 'pirates';
-import { REPO_ROOT, UPSTREAM_BRANCH } from '@kbn/dev-utils';
+import { REPO_ROOT, UPSTREAM_BRANCH } from '@kbn/utils';
import sourceMapSupport from 'source-map-support';
import { Cache } from './cache';
diff --git a/packages/kbn-optimizer/src/optimizer/get_changes.test.ts b/packages/kbn-optimizer/src/optimizer/get_changes.test.ts
index d3cc5cceefddf..d1754248dba17 100644
--- a/packages/kbn-optimizer/src/optimizer/get_changes.test.ts
+++ b/packages/kbn-optimizer/src/optimizer/get_changes.test.ts
@@ -9,7 +9,8 @@
jest.mock('execa');
import { getChanges } from './get_changes';
-import { REPO_ROOT, createAbsolutePathSerializer } from '@kbn/dev-utils';
+import { createAbsolutePathSerializer } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
const execa: jest.Mock = jest.requireMock('execa');
diff --git a/packages/kbn-optimizer/src/optimizer/get_changes.ts b/packages/kbn-optimizer/src/optimizer/get_changes.ts
index c5f8abe99c322..b59f938eb8c37 100644
--- a/packages/kbn-optimizer/src/optimizer/get_changes.ts
+++ b/packages/kbn-optimizer/src/optimizer/get_changes.ts
@@ -10,7 +10,7 @@ import Path from 'path';
import execa from 'execa';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
export type Changes = Map;
diff --git a/packages/kbn-plugin-generator/BUILD.bazel b/packages/kbn-plugin-generator/BUILD.bazel
index c935d1763dae8..488f09bdd5d52 100644
--- a/packages/kbn-plugin-generator/BUILD.bazel
+++ b/packages/kbn-plugin-generator/BUILD.bazel
@@ -51,7 +51,7 @@ RUNTIME_DEPS = [
TYPES_DEPS = [
"//packages/kbn-utils",
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"@npm//del",
"@npm//execa",
"@npm//globby",
diff --git a/packages/kbn-plugin-helpers/BUILD.bazel b/packages/kbn-plugin-helpers/BUILD.bazel
index d7744aecac26e..47f205f1530b7 100644
--- a/packages/kbn-plugin-helpers/BUILD.bazel
+++ b/packages/kbn-plugin-helpers/BUILD.bazel
@@ -42,7 +42,7 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-optimizer",
"//packages/kbn-utils",
"@npm//del",
diff --git a/packages/kbn-rule-data-utils/src/technical_field_names.ts b/packages/kbn-rule-data-utils/src/technical_field_names.ts
index 349719c019c22..fde8deade36b5 100644
--- a/packages/kbn-rule-data-utils/src/technical_field_names.ts
+++ b/packages/kbn-rule-data-utils/src/technical_field_names.ts
@@ -24,6 +24,7 @@ const VERSION = `${KIBANA_NAMESPACE}.version` as const;
// Fields pertaining to the alert
const ALERT_ACTION_GROUP = `${ALERT_NAMESPACE}.action_group` as const;
+const ALERT_BUILDING_BLOCK_TYPE = `${ALERT_NAMESPACE}.building_block_type` as const;
const ALERT_DURATION = `${ALERT_NAMESPACE}.duration.us` as const;
const ALERT_END = `${ALERT_NAMESPACE}.end` as const;
const ALERT_EVALUATION_THRESHOLD = `${ALERT_NAMESPACE}.evaluation.threshold` as const;
@@ -91,6 +92,7 @@ const fields = {
TAGS,
TIMESTAMP,
ALERT_ACTION_GROUP,
+ ALERT_BUILDING_BLOCK_TYPE,
ALERT_DURATION,
ALERT_END,
ALERT_EVALUATION_THRESHOLD,
@@ -141,6 +143,7 @@ const fields = {
export {
ALERT_ACTION_GROUP,
+ ALERT_BUILDING_BLOCK_TYPE,
ALERT_DURATION,
ALERT_END,
ALERT_EVALUATION_THRESHOLD,
diff --git a/packages/kbn-storybook/BUILD.bazel b/packages/kbn-storybook/BUILD.bazel
index f2a7bf25fb407..5dbe22b56c63f 100644
--- a/packages/kbn-storybook/BUILD.bazel
+++ b/packages/kbn-storybook/BUILD.bazel
@@ -32,6 +32,7 @@ RUNTIME_DEPS = [
"//packages/kbn-dev-utils",
"//packages/kbn-ui-shared-deps-npm",
"//packages/kbn-ui-shared-deps-src",
+ "//packages/kbn-utils",
"@npm//@storybook/addons",
"@npm//@storybook/api",
"@npm//@storybook/components",
@@ -47,9 +48,10 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-ui-shared-deps-npm",
"//packages/kbn-ui-shared-deps-src",
+ "//packages/kbn-utils",
"@npm//@storybook/addons",
"@npm//@storybook/api",
"@npm//@storybook/components",
diff --git a/packages/kbn-storybook/src/lib/constants.ts b/packages/kbn-storybook/src/lib/constants.ts
index 722f789fde786..69b05c94ea1b0 100644
--- a/packages/kbn-storybook/src/lib/constants.ts
+++ b/packages/kbn-storybook/src/lib/constants.ts
@@ -7,7 +7,7 @@
*/
import { resolve } from 'path';
-import { REPO_ROOT as KIBANA_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT as KIBANA_ROOT } from '@kbn/utils';
export const REPO_ROOT = KIBANA_ROOT;
export const ASSET_DIR = resolve(KIBANA_ROOT, 'built_assets/storybook');
diff --git a/packages/kbn-telemetry-tools/BUILD.bazel b/packages/kbn-telemetry-tools/BUILD.bazel
index 1183de2586424..d2ea3a704f154 100644
--- a/packages/kbn-telemetry-tools/BUILD.bazel
+++ b/packages/kbn-telemetry-tools/BUILD.bazel
@@ -38,8 +38,9 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-utility-types",
+ "@npm//tslib",
"@npm//@types/glob",
"@npm//@types/jest",
"@npm//@types/listr",
diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel
index 1d1d95d639861..eae0fe2cdf5dc 100644
--- a/packages/kbn-test/BUILD.bazel
+++ b/packages/kbn-test/BUILD.bazel
@@ -44,11 +44,13 @@ RUNTIME_DEPS = [
"@npm//axios",
"@npm//@babel/traverse",
"@npm//chance",
+ "@npm//dedent",
"@npm//del",
"@npm//enzyme",
"@npm//execa",
"@npm//exit-hook",
"@npm//form-data",
+ "@npm//getopts",
"@npm//globby",
"@npm//he",
"@npm//history",
@@ -59,6 +61,7 @@ RUNTIME_DEPS = [
"@npm//@jest/reporters",
"@npm//joi",
"@npm//mustache",
+ "@npm//normalize-path",
"@npm//parse-link-header",
"@npm//prettier",
"@npm//react-dom",
@@ -72,13 +75,17 @@ RUNTIME_DEPS = [
]
TYPES_DEPS = [
- "//packages/kbn-dev-utils",
+ "//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-i18n-react:npm_module_types",
+ "//packages/kbn-std",
"//packages/kbn-utils",
"@npm//@elastic/elasticsearch",
+ "@npm//axios",
"@npm//elastic-apm-node",
"@npm//del",
+ "@npm//exit-hook",
"@npm//form-data",
+ "@npm//getopts",
"@npm//jest",
"@npm//jest-cli",
"@npm//jest-snapshot",
@@ -86,6 +93,7 @@ TYPES_DEPS = [
"@npm//rxjs",
"@npm//xmlbuilder",
"@npm//@types/chance",
+ "@npm//@types/dedent",
"@npm//@types/enzyme",
"@npm//@types/he",
"@npm//@types/history",
@@ -93,6 +101,7 @@ TYPES_DEPS = [
"@npm//@types/joi",
"@npm//@types/lodash",
"@npm//@types/mustache",
+ "@npm//@types/normalize-path",
"@npm//@types/node",
"@npm//@types/parse-link-header",
"@npm//@types/prettier",
diff --git a/packages/kbn-test/src/es/es_test_config.ts b/packages/kbn-test/src/es/es_test_config.ts
index db5d705710a75..70000c8068e9f 100644
--- a/packages/kbn-test/src/es/es_test_config.ts
+++ b/packages/kbn-test/src/es/es_test_config.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { kibanaPackageJson as pkg } from '@kbn/dev-utils';
+import { kibanaPackageJson as pkg } from '@kbn/utils';
import Url from 'url';
import { adminTestUser } from '../kbn';
diff --git a/packages/kbn-test/src/failed_tests_reporter/buildkite_metadata.ts b/packages/kbn-test/src/failed_tests_reporter/buildkite_metadata.ts
new file mode 100644
index 0000000000000..d63f0166390cb
--- /dev/null
+++ b/packages/kbn-test/src/failed_tests_reporter/buildkite_metadata.ts
@@ -0,0 +1,38 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+export interface BuildkiteMetadata {
+ buildId?: string;
+ jobId?: string;
+ url?: string;
+ jobName?: string;
+ jobUrl?: string;
+}
+
+export function getBuildkiteMetadata(): BuildkiteMetadata {
+ // Buildkite steps that use `parallelism` need a numerical suffix added to identify them
+ // We should also increment the number by one, since it's 0-based
+ const jobNumberSuffix = process.env.BUILDKITE_PARALLEL_JOB
+ ? ` #${parseInt(process.env.BUILDKITE_PARALLEL_JOB, 10) + 1}`
+ : '';
+
+ const buildUrl = process.env.BUILDKITE_BUILD_URL;
+ const jobUrl = process.env.BUILDKITE_JOB_ID
+ ? `${buildUrl}#${process.env.BUILDKITE_JOB_ID}`
+ : undefined;
+
+ return {
+ buildId: process.env.BUJILDKITE_BUILD_ID,
+ jobId: process.env.BUILDKITE_JOB_ID,
+ url: buildUrl,
+ jobUrl,
+ jobName: process.env.BUILDKITE_LABEL
+ ? `${process.env.BUILDKITE_LABEL}${jobNumberSuffix}`
+ : undefined,
+ };
+}
diff --git a/packages/kbn-test/src/failed_tests_reporter/github_api.ts b/packages/kbn-test/src/failed_tests_reporter/github_api.ts
index adaae11b7aa16..bb7570225a013 100644
--- a/packages/kbn-test/src/failed_tests_reporter/github_api.ts
+++ b/packages/kbn-test/src/failed_tests_reporter/github_api.ts
@@ -42,6 +42,7 @@ export class GithubApi {
private readonly token: string | undefined;
private readonly dryRun: boolean;
private readonly x: AxiosInstance;
+ private requestCount: number = 0;
/**
* Create a GithubApi helper object, if token is undefined requests won't be
@@ -68,6 +69,10 @@ export class GithubApi {
});
}
+ getRequestCount() {
+ return this.requestCount;
+ }
+
private failedTestIssuesPageCache: {
pages: GithubIssue[][];
nextRequest: RequestOptions | undefined;
@@ -191,53 +196,50 @@ export class GithubApi {
}> {
const executeRequest = !this.dryRun || options.safeForDryRun;
const maxAttempts = options.maxAttempts || 5;
- const attempt = options.attempt || 1;
-
- this.log.verbose('Github API', executeRequest ? 'Request' : 'Dry Run', options);
-
- if (!executeRequest) {
- return {
- status: 200,
- statusText: 'OK',
- headers: {},
- data: dryRunResponse,
- };
- }
- try {
- return await this.x.request(options);
- } catch (error) {
- const unableToReachGithub = isAxiosRequestError(error);
- const githubApiFailed = isAxiosResponseError(error) && error.response.status >= 500;
- const errorResponseLog =
- isAxiosResponseError(error) &&
- `[${error.config.method} ${error.config.url}] ${error.response.status} ${error.response.statusText} Error`;
+ let attempt = 0;
+ while (true) {
+ attempt += 1;
+ this.log.verbose('Github API', executeRequest ? 'Request' : 'Dry Run', options);
+
+ if (!executeRequest) {
+ return {
+ status: 200,
+ statusText: 'OK',
+ headers: {},
+ data: dryRunResponse,
+ };
+ }
- if ((unableToReachGithub || githubApiFailed) && attempt < maxAttempts) {
- const waitMs = 1000 * attempt;
+ try {
+ this.requestCount += 1;
+ return await this.x.request(options);
+ } catch (error) {
+ const unableToReachGithub = isAxiosRequestError(error);
+ const githubApiFailed = isAxiosResponseError(error) && error.response.status >= 500;
+ const errorResponseLog =
+ isAxiosResponseError(error) &&
+ `[${error.config.method} ${error.config.url}] ${error.response.status} ${error.response.statusText} Error`;
+
+ if ((unableToReachGithub || githubApiFailed) && attempt < maxAttempts) {
+ const waitMs = 1000 * attempt;
+
+ if (errorResponseLog) {
+ this.log.error(`${errorResponseLog}: waiting ${waitMs}ms to retry`);
+ } else {
+ this.log.error(`Unable to reach github, waiting ${waitMs}ms to retry`);
+ }
+
+ await new Promise((resolve) => setTimeout(resolve, waitMs));
+ continue;
+ }
if (errorResponseLog) {
- this.log.error(`${errorResponseLog}: waiting ${waitMs}ms to retry`);
- } else {
- this.log.error(`Unable to reach github, waiting ${waitMs}ms to retry`);
+ throw new Error(`${errorResponseLog}: ${JSON.stringify(error.response.data)}`);
}
- await new Promise((resolve) => setTimeout(resolve, waitMs));
- return await this.request(
- {
- ...options,
- maxAttempts,
- attempt: attempt + 1,
- },
- dryRunResponse
- );
+ throw error;
}
-
- if (errorResponseLog) {
- throw new Error(`${errorResponseLog}: ${JSON.stringify(error.response.data)}`);
- }
-
- throw error;
}
}
}
diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts b/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts
index e481da019945c..33dab240ec8b4 100644
--- a/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts
+++ b/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts
@@ -14,6 +14,7 @@ import { ToolingLog } from '@kbn/dev-utils';
import { REPO_ROOT } from '@kbn/utils';
import { escape } from 'he';
+import { BuildkiteMetadata } from './buildkite_metadata';
import { TestFailure } from './get_failures';
const findScreenshots = (dirPath: string, allScreenshots: string[] = []) => {
@@ -37,7 +38,11 @@ const findScreenshots = (dirPath: string, allScreenshots: string[] = []) => {
return allScreenshots;
};
-export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) {
+export function reportFailuresToFile(
+ log: ToolingLog,
+ failures: TestFailure[],
+ bkMeta: BuildkiteMetadata
+) {
if (!failures?.length) {
return;
}
@@ -76,28 +81,15 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) {
.flat()
.join('\n');
- // Buildkite steps that use `parallelism` need a numerical suffix added to identify them
- // We should also increment the number by one, since it's 0-based
- const jobNumberSuffix = process.env.BUILDKITE_PARALLEL_JOB
- ? ` #${parseInt(process.env.BUILDKITE_PARALLEL_JOB, 10) + 1}`
- : '';
-
- const buildUrl = process.env.BUILDKITE_BUILD_URL || '';
- const jobUrl = process.env.BUILDKITE_JOB_ID
- ? `${buildUrl}#${process.env.BUILDKITE_JOB_ID}`
- : '';
-
const failureJSON = JSON.stringify(
{
...failure,
hash,
- buildId: process.env.BUJILDKITE_BUILD_ID || '',
- jobId: process.env.BUILDKITE_JOB_ID || '',
- url: buildUrl,
- jobUrl,
- jobName: process.env.BUILDKITE_LABEL
- ? `${process.env.BUILDKITE_LABEL}${jobNumberSuffix}`
- : '',
+ buildId: bkMeta.buildId,
+ jobId: bkMeta.jobId,
+ url: bkMeta.url,
+ jobUrl: bkMeta.jobUrl,
+ jobName: bkMeta.jobName,
},
null,
2
@@ -149,11 +141,11 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) {
${
- jobUrl
+ bkMeta.jobUrl
? `
Buildkite Job
- ${escape(jobUrl)}
+ ${escape(bkMeta.jobUrl)}
`
: ''
diff --git a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts b/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts
index 193bc668ce003..ecd3007685b76 100644
--- a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts
+++ b/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts
@@ -9,7 +9,7 @@
import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
-import { run, createFailError, createFlagError } from '@kbn/dev-utils';
+import { run, createFailError, createFlagError, CiStatsReporter } from '@kbn/dev-utils';
import globby from 'globby';
import normalize from 'normalize-path';
@@ -22,6 +22,7 @@ import { addMessagesToReport } from './add_messages_to_report';
import { getReportMessageIter } from './report_metadata';
import { reportFailuresToEs } from './report_failures_to_es';
import { reportFailuresToFile } from './report_failures_to_file';
+import { getBuildkiteMetadata } from './buildkite_metadata';
const DEFAULT_PATTERNS = [Path.resolve(REPO_ROOT, 'target/junit/**/*.xml')];
@@ -71,108 +72,127 @@ export function runFailedTestsReporterCli() {
dryRun: !updateGithub,
});
- const buildUrl = flags['build-url'] || (updateGithub ? '' : 'http://buildUrl');
- if (typeof buildUrl !== 'string' || !buildUrl) {
- throw createFlagError('Missing --build-url or process.env.BUILD_URL');
- }
+ const bkMeta = getBuildkiteMetadata();
- const patterns = (flags._.length ? flags._ : DEFAULT_PATTERNS).map((p) =>
- normalize(Path.resolve(p))
- );
- log.info('Searching for reports at', patterns);
- const reportPaths = await globby(patterns, {
- absolute: true,
- });
+ try {
+ const buildUrl = flags['build-url'] || (updateGithub ? '' : 'http://buildUrl');
+ if (typeof buildUrl !== 'string' || !buildUrl) {
+ throw createFlagError('Missing --build-url or process.env.BUILD_URL');
+ }
- if (!reportPaths.length) {
- throw createFailError(`Unable to find any junit reports with patterns [${patterns}]`);
- }
+ const patterns = (flags._.length ? flags._ : DEFAULT_PATTERNS).map((p) =>
+ normalize(Path.resolve(p))
+ );
+ log.info('Searching for reports at', patterns);
+ const reportPaths = await globby(patterns, {
+ absolute: true,
+ });
- log.info('found', reportPaths.length, 'junit reports', reportPaths);
- const newlyCreatedIssues: Array<{
- failure: TestFailure;
- newIssue: GithubIssueMini;
- }> = [];
+ if (!reportPaths.length) {
+ throw createFailError(`Unable to find any junit reports with patterns [${patterns}]`);
+ }
- for (const reportPath of reportPaths) {
- const report = await readTestReport(reportPath);
- const messages = Array.from(getReportMessageIter(report));
- const failures = await getFailures(report);
+ log.info('found', reportPaths.length, 'junit reports', reportPaths);
+ const newlyCreatedIssues: Array<{
+ failure: TestFailure;
+ newIssue: GithubIssueMini;
+ }> = [];
- if (indexInEs) {
- await reportFailuresToEs(log, failures);
- }
+ for (const reportPath of reportPaths) {
+ const report = await readTestReport(reportPath);
+ const messages = Array.from(getReportMessageIter(report));
+ const failures = await getFailures(report);
- for (const failure of failures) {
- const pushMessage = (msg: string) => {
- messages.push({
- classname: failure.classname,
- name: failure.name,
- message: msg,
- });
- };
-
- if (failure.likelyIrrelevant) {
- pushMessage(
- 'Failure is likely irrelevant' +
- (updateGithub ? ', so an issue was not created or updated' : '')
- );
- continue;
+ if (indexInEs) {
+ await reportFailuresToEs(log, failures);
}
- let existingIssue: GithubIssueMini | undefined = await githubApi.findFailedTestIssue(
- (i) =>
- getIssueMetadata(i.body, 'test.class') === failure.classname &&
- getIssueMetadata(i.body, 'test.name') === failure.name
- );
+ for (const failure of failures) {
+ const pushMessage = (msg: string) => {
+ messages.push({
+ classname: failure.classname,
+ name: failure.name,
+ message: msg,
+ });
+ };
+
+ if (failure.likelyIrrelevant) {
+ pushMessage(
+ 'Failure is likely irrelevant' +
+ (updateGithub ? ', so an issue was not created or updated' : '')
+ );
+ continue;
+ }
- if (!existingIssue) {
- const newlyCreated = newlyCreatedIssues.find(
- ({ failure: f }) => f.classname === failure.classname && f.name === failure.name
+ let existingIssue: GithubIssueMini | undefined = await githubApi.findFailedTestIssue(
+ (i) =>
+ getIssueMetadata(i.body, 'test.class') === failure.classname &&
+ getIssueMetadata(i.body, 'test.name') === failure.name
);
- if (newlyCreated) {
- existingIssue = newlyCreated.newIssue;
+ if (!existingIssue) {
+ const newlyCreated = newlyCreatedIssues.find(
+ ({ failure: f }) => f.classname === failure.classname && f.name === failure.name
+ );
+
+ if (newlyCreated) {
+ existingIssue = newlyCreated.newIssue;
+ }
}
- }
- if (existingIssue) {
- const newFailureCount = await updateFailureIssue(
- buildUrl,
- existingIssue,
- githubApi,
- branch
- );
- const url = existingIssue.html_url;
- failure.githubIssue = url;
- failure.failureCount = updateGithub ? newFailureCount : newFailureCount - 1;
- pushMessage(`Test has failed ${newFailureCount - 1} times on tracked branches: ${url}`);
- if (updateGithub) {
- pushMessage(`Updated existing issue: ${url} (fail count: ${newFailureCount})`);
+ if (existingIssue) {
+ const newFailureCount = await updateFailureIssue(
+ buildUrl,
+ existingIssue,
+ githubApi,
+ branch
+ );
+ const url = existingIssue.html_url;
+ failure.githubIssue = url;
+ failure.failureCount = updateGithub ? newFailureCount : newFailureCount - 1;
+ pushMessage(
+ `Test has failed ${newFailureCount - 1} times on tracked branches: ${url}`
+ );
+ if (updateGithub) {
+ pushMessage(`Updated existing issue: ${url} (fail count: ${newFailureCount})`);
+ }
+ continue;
}
- continue;
- }
- const newIssue = await createFailureIssue(buildUrl, failure, githubApi, branch);
- pushMessage('Test has not failed recently on tracked branches');
- if (updateGithub) {
- pushMessage(`Created new issue: ${newIssue.html_url}`);
- failure.githubIssue = newIssue.html_url;
+ const newIssue = await createFailureIssue(buildUrl, failure, githubApi, branch);
+ pushMessage('Test has not failed recently on tracked branches');
+ if (updateGithub) {
+ pushMessage(`Created new issue: ${newIssue.html_url}`);
+ failure.githubIssue = newIssue.html_url;
+ }
+ newlyCreatedIssues.push({ failure, newIssue });
+ failure.failureCount = updateGithub ? 1 : 0;
}
- newlyCreatedIssues.push({ failure, newIssue });
- failure.failureCount = updateGithub ? 1 : 0;
- }
- // mutates report to include messages and writes updated report to disk
- await addMessagesToReport({
- report,
- messages,
- log,
- reportPath,
- dryRun: !flags['report-update'],
- });
+ // mutates report to include messages and writes updated report to disk
+ await addMessagesToReport({
+ report,
+ messages,
+ log,
+ reportPath,
+ dryRun: !flags['report-update'],
+ });
- reportFailuresToFile(log, failures);
+ reportFailuresToFile(log, failures, bkMeta);
+ }
+ } finally {
+ await CiStatsReporter.fromEnv(log).metrics([
+ {
+ group: 'github api request count',
+ id: `failed test reporter`,
+ value: githubApi.getRequestCount(),
+ meta: Object.fromEntries(
+ Object.entries(bkMeta).map(
+ ([k, v]) => [`buildkite${k[0].toUpperCase()}${k.slice(1)}`, v] as const
+ )
+ ),
+ },
+ ]);
}
},
{
diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/validate_ci_group_tags.js b/packages/kbn-test/src/functional_test_runner/lib/mocha/validate_ci_group_tags.js
index 3446c5be5d4a7..4f798839d7231 100644
--- a/packages/kbn-test/src/functional_test_runner/lib/mocha/validate_ci_group_tags.js
+++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/validate_ci_group_tags.js
@@ -8,7 +8,7 @@
import Path from 'path';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
/**
* Traverse the suites configured and ensure that each suite has no more than one ciGroup assigned
diff --git a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts b/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts
index e87f316a100a7..53ce4c74c1388 100644
--- a/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts
+++ b/packages/kbn-test/src/functional_test_runner/lib/suite_tracker.test.ts
@@ -14,7 +14,7 @@ jest.mock('@kbn/utils', () => {
return { REPO_ROOT: '/dev/null/root' };
});
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Lifecycle } from './lifecycle';
import { SuiteTracker } from './suite_tracker';
import { Suite } from '../fake_mocha_types';
diff --git a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js b/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js
index 03947f7e267ba..63d2b56350ba1 100644
--- a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js
+++ b/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js
@@ -9,7 +9,7 @@
const Fs = require('fs');
const Path = require('path');
-const { REPO_ROOT: REPO_ROOT_FOLLOWING_SYMLINKS } = require('@kbn/dev-utils');
+const { REPO_ROOT: REPO_ROOT_FOLLOWING_SYMLINKS } = require('@kbn/utils');
const BASE_REPO_ROOT = Path.resolve(
Fs.realpathSync(Path.resolve(REPO_ROOT_FOLLOWING_SYMLINKS, 'package.json')),
'..'
diff --git a/packages/kbn-test/src/functional_tests/tasks.ts b/packages/kbn-test/src/functional_tests/tasks.ts
index 6dde114d3a98e..6a6c7edb98c79 100644
--- a/packages/kbn-test/src/functional_tests/tasks.ts
+++ b/packages/kbn-test/src/functional_tests/tasks.ts
@@ -9,7 +9,8 @@
import { relative } from 'path';
import * as Rx from 'rxjs';
import { startWith, switchMap, take } from 'rxjs/operators';
-import { withProcRunner, ToolingLog, REPO_ROOT, getTimeReporter } from '@kbn/dev-utils';
+import { withProcRunner, ToolingLog, getTimeReporter } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import dedent from 'dedent';
import {
diff --git a/packages/kbn-test/src/kbn/users.ts b/packages/kbn-test/src/kbn/users.ts
index 230354089dcac..88480fde74ddc 100644
--- a/packages/kbn-test/src/kbn/users.ts
+++ b/packages/kbn-test/src/kbn/users.ts
@@ -14,7 +14,7 @@ export const kibanaTestUser = {
};
export const kibanaServerTestUser = {
- username: env.TEST_KIBANA_SERVER_USER || 'kibana',
+ username: env.TEST_KIBANA_SERVER_USER || 'kibana_system',
password: env.TEST_KIBANA_SERVER_PASS || 'changeme',
};
diff --git a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts
index 4adae7d1cd031..6da34228bbe7f 100644
--- a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts
+++ b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts
@@ -12,7 +12,8 @@ import { existsSync } from 'fs';
import Path from 'path';
import FormData from 'form-data';
-import { ToolingLog, isAxiosResponseError, createFailError, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog, isAxiosResponseError, createFailError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { KbnClientRequester, uriencode, ReqOptions } from './kbn_client_requester';
import { KbnClientSavedObjects } from './kbn_client_saved_objects';
diff --git a/packages/kbn-typed-react-router-config/BUILD.bazel b/packages/kbn-typed-react-router-config/BUILD.bazel
index b347915ae3310..d759948a6c576 100644
--- a/packages/kbn-typed-react-router-config/BUILD.bazel
+++ b/packages/kbn-typed-react-router-config/BUILD.bazel
@@ -41,10 +41,10 @@ TYPES_DEPS = [
"@npm//query-string",
"@npm//utility-types",
"@npm//@types/jest",
- "@npm//@types/history",
"@npm//@types/node",
"@npm//@types/react-router-config",
"@npm//@types/react-router-dom",
+ "@npm//@types/history",
]
jsts_transpiler(
diff --git a/packages/kbn-typed-react-router-config/src/create_router.test.tsx b/packages/kbn-typed-react-router-config/src/create_router.test.tsx
index e82fcf791804e..ac337f8bb5b87 100644
--- a/packages/kbn-typed-react-router-config/src/create_router.test.tsx
+++ b/packages/kbn-typed-react-router-config/src/create_router.test.tsx
@@ -267,7 +267,6 @@ describe('createRouter', () => {
const matches = router.matchRoutes('/', history.location);
- // @ts-expect-error 4.3.5 upgrade - router doesn't seem able to merge properly when two routes match
expect(matches[1]?.match.params).toEqual({
query: {
rangeFrom: 'now-30m',
@@ -286,7 +285,6 @@ describe('createRouter', () => {
expect(matchedRoutes.length).toEqual(4);
- // @ts-expect-error 4.3.5 upgrade - router doesn't seem able to merge properly when two routes match
expect(matchedRoutes[matchedRoutes.length - 1].match).toEqual({
isExact: true,
params: {
diff --git a/packages/kbn-typed-react-router-config/src/create_router.ts b/packages/kbn-typed-react-router-config/src/create_router.ts
index 186f949d9c8e8..89ff4fc6b0c6c 100644
--- a/packages/kbn-typed-react-router-config/src/create_router.ts
+++ b/packages/kbn-typed-react-router-config/src/create_router.ts
@@ -23,7 +23,7 @@ function toReactRouterPath(path: string) {
return path.replace(/(?:{([^\/]+)})/g, ':$1');
}
-export function createRouter(routes: TRoute[]): Router {
+export function createRouter(routes: TRoutes): Router {
const routesByReactRouterConfig = new Map();
const reactRouterConfigsByRoute = new Map();
@@ -181,8 +181,10 @@ export function createRouter(routes: TRoute[]): Router {
+ return link(path, ...args);
+ },
getParams: (...args: any[]) => {
const matches = matchRoutes(...args);
return matches.length
@@ -195,13 +197,11 @@ export function createRouter(routes: TRoute[]): Router {
return matchRoutes(...args) as any;
},
- getRoutePath: (route: Route) => {
+ getRoutePath: (route) => {
return reactRouterConfigsByRoute.get(route)!.path as string;
},
getRoutesToMatch: (path: string) => {
- return getRoutesToMatch(path) as unknown as FlattenRoutesOf;
+ return getRoutesToMatch(path) as unknown as FlattenRoutesOf;
},
};
-
- return router;
}
diff --git a/packages/kbn-typed-react-router-config/src/types/index.ts b/packages/kbn-typed-react-router-config/src/types/index.ts
index 3c09b60054a0c..c1ae5afd816ee 100644
--- a/packages/kbn-typed-react-router-config/src/types/index.ts
+++ b/packages/kbn-typed-react-router-config/src/types/index.ts
@@ -115,7 +115,7 @@ export interface RouteMatch {
params: t.Type;
}
? t.TypeOf
- : AnyObj;
+ : {};
};
}
@@ -160,11 +160,10 @@ interface ReadonlyPlainRoute {
}
export type Route = PlainRoute | ReadonlyPlainRoute;
-type AnyObj = Record;
interface DefaultOutput {
- path: AnyObj;
- query: AnyObj;
+ path: {};
+ query: {};
}
type OutputOfRouteMatch = TRouteMatch extends {
@@ -191,21 +190,20 @@ type TypeOfRouteMatch = TRouteMatch extends {
route: { params: t.Type };
}
? t.TypeOf
- : AnyObj;
+ : {};
type TypeOfMatches = TRouteMatches extends [RouteMatch]
? TypeOfRouteMatch
: TRouteMatches extends [RouteMatch, ...infer TNextRouteMatches]
? TypeOfRouteMatch &
- (TNextRouteMatches extends RouteMatch[] ? TypeOfMatches : AnyObj)
- : AnyObj;
+ (TNextRouteMatches extends RouteMatch[] ? TypeOfMatches : {})
+ : {};
export type TypeOf<
TRoutes extends Route[],
TPath extends PathsOf,
TWithDefaultOutput extends boolean = true
-> = TypeOfMatches> &
- (TWithDefaultOutput extends true ? DefaultOutput : AnyObj);
+> = TypeOfMatches> & (TWithDefaultOutput extends true ? DefaultOutput : {});
export type TypeAsArgs = keyof TObject extends never
? []
@@ -278,7 +276,7 @@ type MapRoute = MaybeUnion<
>;
}
>
- : AnyObj
+ : {}
>;
type MapRoutes = TRoutes extends [Route]
@@ -343,7 +341,7 @@ type MapRoutes = TRoutes extends [Route]
MapRoute &
MapRoute &
MapRoute
- : AnyObj;
+ : {};
// const element = null as any;
diff --git a/src/cli/serve/integration_tests/invalid_config.test.ts b/src/cli/serve/integration_tests/invalid_config.test.ts
index 2de902582a548..ca051f37a816e 100644
--- a/src/cli/serve/integration_tests/invalid_config.test.ts
+++ b/src/cli/serve/integration_tests/invalid_config.test.ts
@@ -8,7 +8,7 @@
import { spawnSync } from 'child_process';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
const INVALID_CONFIG_PATH = require.resolve('./__fixtures__/invalid_config.yml');
diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts
index 692367cd0f580..fed3aa3093166 100644
--- a/src/core/public/doc_links/doc_links_service.ts
+++ b/src/core/public/doc_links/doc_links_service.ts
@@ -486,6 +486,7 @@ export class DocLinksService {
hdfsRepo: `${PLUGIN_DOCS}repository-hdfs.html`,
s3Repo: `${PLUGIN_DOCS}repository-s3.html`,
snapshotRestoreRepos: `${PLUGIN_DOCS}repository.html`,
+ mapperSize: `${PLUGIN_DOCS}mapper-size-usage.html`,
},
snapshotRestore: {
guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`,
@@ -874,7 +875,14 @@ export interface DocLinksStart {
}>;
readonly watcher: Record;
readonly ccs: Record;
- readonly plugins: Record;
+ readonly plugins: {
+ azureRepo: string;
+ gcsRepo: string;
+ hdfsRepo: string;
+ s3Repo: string;
+ snapshotRestoreRepos: string;
+ mapperSize: string;
+ };
readonly snapshotRestore: Record;
readonly ingest: Record;
readonly fleet: Readonly<{
diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md
index 08d41ab1301b0..63e0898b5fb90 100644
--- a/src/core/public/public.api.md
+++ b/src/core/public/public.api.md
@@ -773,7 +773,14 @@ export interface DocLinksStart {
}>;
readonly watcher: Record;
readonly ccs: Record;
- readonly plugins: Record;
+ readonly plugins: {
+ azureRepo: string;
+ gcsRepo: string;
+ hdfsRepo: string;
+ s3Repo: string;
+ snapshotRestoreRepos: string;
+ mapperSize: string;
+ };
readonly snapshotRestore: Record;
readonly ingest: Record;
readonly fleet: Readonly<{
diff --git a/src/core/server/capabilities/integration_tests/capabilities_service.test.ts b/src/core/server/capabilities/integration_tests/capabilities_service.test.ts
index 2e80fbb9d20c0..c1f6ffb5add77 100644
--- a/src/core/server/capabilities/integration_tests/capabilities_service.test.ts
+++ b/src/core/server/capabilities/integration_tests/capabilities_service.test.ts
@@ -7,7 +7,7 @@
*/
import supertest from 'supertest';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { HttpService, InternalHttpServicePreboot, InternalHttpServiceSetup } from '../../http';
import { contextServiceMock } from '../../context/context_service.mock';
import { executionContextServiceMock } from '../../execution_context/execution_context_service.mock';
diff --git a/src/core/server/core_context.mock.ts b/src/core/server/core_context.mock.ts
index ddb87d31383c8..4d7b4e1ba5548 100644
--- a/src/core/server/core_context.mock.ts
+++ b/src/core/server/core_context.mock.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import type { DeeplyMockedKeys } from '@kbn/utility-types/jest';
import { CoreContext } from './core_context';
import { Env, IConfigService } from './config';
diff --git a/src/core/server/elasticsearch/elasticsearch_service.test.ts b/src/core/server/elasticsearch/elasticsearch_service.test.ts
index 3b75d19b80a10..ce5672ad30519 100644
--- a/src/core/server/elasticsearch/elasticsearch_service.test.ts
+++ b/src/core/server/elasticsearch/elasticsearch_service.test.ts
@@ -21,7 +21,7 @@ import { MockClusterClient, isScriptingEnabledMock } from './elasticsearch_servi
import type { NodesVersionCompatibility } from './version_check/ensure_es_version';
import { BehaviorSubject } from 'rxjs';
import { first } from 'rxjs/operators';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Env } from '../config';
import { configServiceMock, getEnvOptions } from '../config/mocks';
import { CoreContext } from '../core_context';
diff --git a/src/core/server/http/cookie_session_storage.test.ts b/src/core/server/http/cookie_session_storage.test.ts
index ad05d37c81e99..8e2cd58733faf 100644
--- a/src/core/server/http/cookie_session_storage.test.ts
+++ b/src/core/server/http/cookie_session_storage.test.ts
@@ -8,7 +8,7 @@
import { parse as parseCookie } from 'tough-cookie';
import supertest from 'supertest';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { ByteSizeValue } from '@kbn/config-schema';
import { BehaviorSubject } from 'rxjs';
diff --git a/src/core/server/http/http_service.test.ts b/src/core/server/http/http_service.test.ts
index 4955d19668580..3a387cdfd5e35 100644
--- a/src/core/server/http/http_service.test.ts
+++ b/src/core/server/http/http_service.test.ts
@@ -10,7 +10,7 @@ import { mockHttpServer } from './http_service.test.mocks';
import { noop } from 'lodash';
import { BehaviorSubject } from 'rxjs';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { getEnvOptions } from '../config/mocks';
import { HttpService } from '.';
import { HttpConfigType, config } from './http_config';
diff --git a/src/core/server/http/test_utils.ts b/src/core/server/http/test_utils.ts
index 4e1a88e967f8f..8a8c545b365b3 100644
--- a/src/core/server/http/test_utils.ts
+++ b/src/core/server/http/test_utils.ts
@@ -8,7 +8,7 @@
import { BehaviorSubject } from 'rxjs';
import moment from 'moment';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { ByteSizeValue } from '@kbn/config-schema';
import { Env } from '../config';
import { HttpService } from './http_service';
diff --git a/src/core/server/metrics/logging/get_ops_metrics_log.test.ts b/src/core/server/metrics/logging/get_ops_metrics_log.test.ts
index cba188c94c74e..3fd3c4a7a24d6 100644
--- a/src/core/server/metrics/logging/get_ops_metrics_log.test.ts
+++ b/src/core/server/metrics/logging/get_ops_metrics_log.test.ts
@@ -42,6 +42,7 @@ const testMetrics = {
memory: { heap: { used_in_bytes: 100 } },
uptime_in_millis: 1500,
event_loop_delay: 50,
+ event_loop_delay_histogram: { percentiles: { '50': 50, '75': 75, '95': 95, '99': 99 } },
},
os: {
load: {
@@ -56,7 +57,7 @@ describe('getEcsOpsMetricsLog', () => {
it('provides correctly formatted message', () => {
const result = getEcsOpsMetricsLog(createMockOpsMetrics(testMetrics));
expect(result.message).toMatchInlineSnapshot(
- `"memory: 100.0B uptime: 0:00:01 load: [10.00,20.00,30.00] delay: 50.000"`
+ `"memory: 100.0B uptime: 0:00:01 load: [10.00,20.00,30.00] mean delay: 50.000 delay histogram: { 50: 50.000; 95: 95.000; 99: 99.000 }"`
);
});
@@ -70,6 +71,7 @@ describe('getEcsOpsMetricsLog', () => {
const missingMetrics = {
...baseMetrics,
process: {},
+ processes: [],
os: {},
} as unknown as OpsMetrics;
const logMeta = getEcsOpsMetricsLog(missingMetrics);
@@ -77,39 +79,41 @@ describe('getEcsOpsMetricsLog', () => {
});
it('provides an ECS-compatible response', () => {
- const logMeta = getEcsOpsMetricsLog(createBaseOpsMetrics());
- expect(logMeta).toMatchInlineSnapshot(`
+ const logMeta = getEcsOpsMetricsLog(createMockOpsMetrics(testMetrics));
+ expect(logMeta.meta).toMatchInlineSnapshot(`
Object {
- "message": "memory: 1.0B load: [1.00,1.00,1.00] delay: 1.000",
- "meta": Object {
- "event": Object {
- "category": Array [
- "process",
- "host",
- ],
- "kind": "metric",
- "type": Array [
- "info",
- ],
- },
- "host": Object {
- "os": Object {
- "load": Object {
- "15m": 1,
- "1m": 1,
- "5m": 1,
- },
+ "event": Object {
+ "category": Array [
+ "process",
+ "host",
+ ],
+ "kind": "metric",
+ "type": Array [
+ "info",
+ ],
+ },
+ "host": Object {
+ "os": Object {
+ "load": Object {
+ "15m": 30,
+ "1m": 10,
+ "5m": 20,
},
},
- "process": Object {
- "eventLoopDelay": 1,
- "memory": Object {
- "heap": Object {
- "usedInBytes": 1,
- },
+ },
+ "process": Object {
+ "eventLoopDelay": 50,
+ "eventLoopDelayHistogram": Object {
+ "50": 50,
+ "95": 95,
+ "99": 99,
+ },
+ "memory": Object {
+ "heap": Object {
+ "usedInBytes": 100,
},
- "uptime": 0,
},
+ "uptime": 1,
},
}
`);
diff --git a/src/core/server/metrics/logging/get_ops_metrics_log.ts b/src/core/server/metrics/logging/get_ops_metrics_log.ts
index 7e13f35889ec7..6211407ae86f0 100644
--- a/src/core/server/metrics/logging/get_ops_metrics_log.ts
+++ b/src/core/server/metrics/logging/get_ops_metrics_log.ts
@@ -30,10 +30,29 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
// HH:mm:ss message format for backward compatibility
const uptimeValMsg = uptimeVal ? `uptime: ${numeral(uptimeVal).format('00:00:00')} ` : '';
- // Event loop delay is in ms
+ // Event loop delay metrics are in ms
const eventLoopDelayVal = process?.event_loop_delay;
const eventLoopDelayValMsg = eventLoopDelayVal
- ? `delay: ${numeral(process?.event_loop_delay).format('0.000')}`
+ ? `mean delay: ${numeral(process?.event_loop_delay).format('0.000')}`
+ : '';
+
+ const eventLoopDelayPercentiles = process?.event_loop_delay_histogram?.percentiles;
+
+ // Extract 50th, 95th and 99th percentiles for log meta
+ const eventLoopDelayHistVals = eventLoopDelayPercentiles
+ ? {
+ 50: eventLoopDelayPercentiles[50],
+ 95: eventLoopDelayPercentiles[95],
+ 99: eventLoopDelayPercentiles[99],
+ }
+ : undefined;
+ // Format message from 50th, 95th and 99th percentiles
+ const eventLoopDelayHistMsg = eventLoopDelayPercentiles
+ ? ` delay histogram: { 50: ${numeral(eventLoopDelayPercentiles['50']).format(
+ '0.000'
+ )}; 95: ${numeral(eventLoopDelayPercentiles['95']).format('0.000')}; 99: ${numeral(
+ eventLoopDelayPercentiles['99']
+ ).format('0.000')} }`
: '';
const loadEntries = {
@@ -65,6 +84,7 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
},
},
eventLoopDelay: eventLoopDelayVal,
+ eventLoopDelayHistogram: eventLoopDelayHistVals,
},
host: {
os: {
@@ -75,7 +95,13 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
};
return {
- message: `${processMemoryUsedInBytesMsg}${uptimeValMsg}${loadValsMsg}${eventLoopDelayValMsg}`,
+ message: [
+ processMemoryUsedInBytesMsg,
+ uptimeValMsg,
+ loadValsMsg,
+ eventLoopDelayValMsg,
+ eventLoopDelayHistMsg,
+ ].join(''),
meta,
};
}
diff --git a/src/core/server/metrics/metrics_service.test.ts b/src/core/server/metrics/metrics_service.test.ts
index d7de41fd7ccf7..27043b8fa2c8a 100644
--- a/src/core/server/metrics/metrics_service.test.ts
+++ b/src/core/server/metrics/metrics_service.test.ts
@@ -203,6 +203,7 @@ describe('MetricsService', () => {
},
"process": Object {
"eventLoopDelay": undefined,
+ "eventLoopDelayHistogram": undefined,
"memory": Object {
"heap": Object {
"usedInBytes": undefined,
diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.ts b/src/core/server/plugins/discovery/plugins_discovery.test.ts
index 958e051d0476d..a6ffdff4422be 100644
--- a/src/core/server/plugins/discovery/plugins_discovery.test.ts
+++ b/src/core/server/plugins/discovery/plugins_discovery.test.ts
@@ -7,7 +7,7 @@
*/
// must be before mocks imports to avoid conflicting with `REPO_ROOT` accessor.
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { mockPackage, scanPluginSearchPathsMock } from './plugins_discovery.test.mocks';
import mockFs from 'mock-fs';
import { loggingSystemMock } from '../../logging/logging_system.mock';
diff --git a/src/core/server/plugins/integration_tests/plugins_service.test.ts b/src/core/server/plugins/integration_tests/plugins_service.test.ts
index 4170d9422f277..ebbb3fa473b6d 100644
--- a/src/core/server/plugins/integration_tests/plugins_service.test.ts
+++ b/src/core/server/plugins/integration_tests/plugins_service.test.ts
@@ -7,7 +7,7 @@
*/
// must be before mocks imports to avoid conflicting with `REPO_ROOT` accessor.
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { mockPackage, mockDiscover } from './plugins_service.test.mocks';
import { join } from 'path';
diff --git a/src/core/server/plugins/plugin.test.ts b/src/core/server/plugins/plugin.test.ts
index 513e893992005..92cbda2a69cfe 100644
--- a/src/core/server/plugins/plugin.test.ts
+++ b/src/core/server/plugins/plugin.test.ts
@@ -8,7 +8,7 @@
import { join } from 'path';
import { BehaviorSubject } from 'rxjs';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { schema } from '@kbn/config-schema';
import { Env } from '../config';
diff --git a/src/core/server/plugins/plugin_context.test.ts b/src/core/server/plugins/plugin_context.test.ts
index 867d4d978314b..7bcf392ed510b 100644
--- a/src/core/server/plugins/plugin_context.test.ts
+++ b/src/core/server/plugins/plugin_context.test.ts
@@ -8,7 +8,7 @@
import { duration } from 'moment';
import { first } from 'rxjs/operators';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { fromRoot } from '@kbn/utils';
import {
createPluginInitializerContext,
diff --git a/src/core/server/plugins/plugins_config.test.ts b/src/core/server/plugins/plugins_config.test.ts
index d65b057fb65c0..b9225054e63ef 100644
--- a/src/core/server/plugins/plugins_config.test.ts
+++ b/src/core/server/plugins/plugins_config.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { getEnvOptions } from '../config/mocks';
import { PluginsConfig, PluginsConfigType } from './plugins_config';
import { Env } from '../config';
diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts
index 0c077d732c67b..5a05817d2111f 100644
--- a/src/core/server/plugins/plugins_service.test.ts
+++ b/src/core/server/plugins/plugins_service.test.ts
@@ -11,7 +11,8 @@ import { mockDiscover, mockPackage } from './plugins_service.test.mocks';
import { resolve, join } from 'path';
import { BehaviorSubject, from } from 'rxjs';
import { schema } from '@kbn/config-schema';
-import { createAbsolutePathSerializer, REPO_ROOT } from '@kbn/dev-utils';
+import { createAbsolutePathSerializer } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { ConfigPath, ConfigService, Env } from '../config';
import { rawConfigServiceMock, getEnvOptions } from '../config/mocks';
diff --git a/src/core/server/plugins/plugins_system.test.ts b/src/core/server/plugins/plugins_system.test.ts
index 4cd8e4c551bea..3d8a47005b362 100644
--- a/src/core/server/plugins/plugins_system.test.ts
+++ b/src/core/server/plugins/plugins_system.test.ts
@@ -14,7 +14,7 @@ import {
import { BehaviorSubject } from 'rxjs';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Env } from '../config';
import { configServiceMock, getEnvOptions } from '../config/mocks';
import { CoreContext } from '../core_context';
diff --git a/src/core/server/preboot/preboot_service.test.ts b/src/core/server/preboot/preboot_service.test.ts
index dd4b1cb7d1df0..77242f0c5765f 100644
--- a/src/core/server/preboot/preboot_service.test.ts
+++ b/src/core/server/preboot/preboot_service.test.ts
@@ -7,7 +7,7 @@
*/
import { nextTick } from '@kbn/test/jest';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { LoggerFactory } from '@kbn/logging';
import { Env } from '@kbn/config';
import { getEnvOptions } from '../config/mocks';
diff --git a/src/core/server/root/index.test.ts b/src/core/server/root/index.test.ts
index 7eba051a128f0..6ea3e05b9c2c2 100644
--- a/src/core/server/root/index.test.ts
+++ b/src/core/server/root/index.test.ts
@@ -10,7 +10,7 @@ import { rawConfigService, configService, logger, mockServer } from './index.tes
import { BehaviorSubject } from 'rxjs';
import { filter, first } from 'rxjs/operators';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { getEnvOptions } from '../config/mocks';
import { Root } from '.';
import { Env } from '../config';
diff --git a/src/core/server/saved_objects/migrations/integration_tests/7.7.2_xpack_100k.test.ts b/src/core/server/saved_objects/migrations/integration_tests/7.7.2_xpack_100k.test.ts
index c22c6154c2605..139cd298d28ed 100644
--- a/src/core/server/saved_objects/migrations/integration_tests/7.7.2_xpack_100k.test.ts
+++ b/src/core/server/saved_objects/migrations/integration_tests/7.7.2_xpack_100k.test.ts
@@ -8,7 +8,7 @@
import path from 'path';
import { unlink } from 'fs/promises';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Env } from '@kbn/config';
import { getEnvOptions } from '../../../config/mocks';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
diff --git a/src/core/server/saved_objects/migrations/integration_tests/migration_from_older_v1.test.ts b/src/core/server/saved_objects/migrations/integration_tests/migration_from_older_v1.test.ts
index 0ed9262017263..c341463b78910 100644
--- a/src/core/server/saved_objects/migrations/integration_tests/migration_from_older_v1.test.ts
+++ b/src/core/server/saved_objects/migrations/integration_tests/migration_from_older_v1.test.ts
@@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';
import Util from 'util';
import Semver from 'semver';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Env } from '@kbn/config';
import { getEnvOptions } from '../../../config/mocks';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
diff --git a/src/core/server/saved_objects/migrations/integration_tests/migration_from_same_v1.test.ts b/src/core/server/saved_objects/migrations/integration_tests/migration_from_same_v1.test.ts
index 15d985daccba6..34d1317755c14 100644
--- a/src/core/server/saved_objects/migrations/integration_tests/migration_from_same_v1.test.ts
+++ b/src/core/server/saved_objects/migrations/integration_tests/migration_from_same_v1.test.ts
@@ -10,7 +10,7 @@ import Path from 'path';
import Fs from 'fs';
import Util from 'util';
import Semver from 'semver';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { Env } from '@kbn/config';
import { getEnvOptions } from '../../../config/mocks';
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
diff --git a/src/core/server/saved_objects/saved_objects_service.test.ts b/src/core/server/saved_objects/saved_objects_service.test.ts
index a4f6c019c9624..a8bda95af46f9 100644
--- a/src/core/server/saved_objects/saved_objects_service.test.ts
+++ b/src/core/server/saved_objects/saved_objects_service.test.ts
@@ -19,7 +19,7 @@ import {
import { BehaviorSubject } from 'rxjs';
import { RawPackageInfo } from '@kbn/config';
import { ByteSizeValue } from '@kbn/config-schema';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { SavedObjectsService } from './saved_objects_service';
import { mockCoreContext } from '../core_context.mock';
diff --git a/src/core/server/saved_objects/service/lib/repository.test.ts b/src/core/server/saved_objects/service/lib/repository.test.ts
index ab692b146e7f6..1668df7a82253 100644
--- a/src/core/server/saved_objects/service/lib/repository.test.ts
+++ b/src/core/server/saved_objects/service/lib/repository.test.ts
@@ -3558,6 +3558,20 @@ describe('SavedObjectsRepository', () => {
});
});
+ it('search for the right fields when typeToNamespacesMap is set', async () => {
+ const relevantOpts = {
+ ...commonOptions,
+ fields: ['title'],
+ type: '',
+ namespaces: [],
+ typeToNamespacesMap: new Map([[type, [namespace]]]),
+ };
+
+ await findSuccess(relevantOpts, namespace);
+ const esOptions = client.search.mock.calls[0][0];
+ expect(esOptions?._source ?? []).toContain('index-pattern.title');
+ });
+
it(`accepts hasReferenceOperator`, async () => {
const relevantOpts: SavedObjectsFindOptions = {
...commonOptions,
diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/src/core/server/saved_objects/service/lib/repository.ts
index 0d17525016043..53bc6f158bf93 100644
--- a/src/core/server/saved_objects/service/lib/repository.ts
+++ b/src/core/server/saved_objects/service/lib/repository.ts
@@ -930,7 +930,7 @@ export class SavedObjectsRepository {
index: pit ? undefined : this.getIndicesForTypes(allowedTypes),
// If `searchAfter` is provided, we drop `from` as it will not be used for pagination.
from: searchAfter ? undefined : perPage * (page - 1),
- _source: includedFields(type, fields),
+ _source: includedFields(allowedTypes, fields),
preference,
rest_total_hits_as_int: true,
size: perPage,
@@ -938,7 +938,7 @@ export class SavedObjectsRepository {
size: perPage,
seq_no_primary_term: true,
from: perPage * (page - 1),
- _source: includedFields(type, fields),
+ _source: includedFields(allowedTypes, fields),
...(aggsObject ? { aggs: aggsObject } : {}),
...getSearchDsl(this._mappings, this._registry, {
search,
diff --git a/src/core/server/server.test.ts b/src/core/server/server.test.ts
index 112693aae0279..48547883d5f67 100644
--- a/src/core/server/server.test.ts
+++ b/src/core/server/server.test.ts
@@ -26,7 +26,7 @@ import {
} from './server.test.mocks';
import { BehaviorSubject } from 'rxjs';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { rawConfigServiceMock, getEnvOptions } from './config/mocks';
import { Env } from './config';
import { Server } from './server';
diff --git a/src/core/server/ui_settings/integration_tests/index.test.ts b/src/core/server/ui_settings/integration_tests/index.test.ts
index ef635e90dac70..3f85beb2acec6 100644
--- a/src/core/server/ui_settings/integration_tests/index.test.ts
+++ b/src/core/server/ui_settings/integration_tests/index.test.ts
@@ -7,7 +7,7 @@
*/
import { Env } from '@kbn/config';
-import { REPO_ROOT } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { getEnvOptions } from '../../config/mocks';
import { startServers, stopServers } from './lib';
import { docExistsSuite } from './doc_exists';
diff --git a/src/core/test_helpers/kbn_server.ts b/src/core/test_helpers/kbn_server.ts
index 58720be637e2f..c326c7a35df63 100644
--- a/src/core/test_helpers/kbn_server.ts
+++ b/src/core/test_helpers/kbn_server.ts
@@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import {
createTestEsCluster,
CreateTestEsClusterOptions,
diff --git a/src/dev/build/lib/integration_tests/version_info.test.ts b/src/dev/build/lib/integration_tests/version_info.test.ts
index e7a3a04c04734..9385de6e00a4f 100644
--- a/src/dev/build/lib/integration_tests/version_info.test.ts
+++ b/src/dev/build/lib/integration_tests/version_info.test.ts
@@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
-import { kibanaPackageJson as pkg } from '@kbn/dev-utils';
+import { kibanaPackageJson as pkg } from '@kbn/utils';
import { getVersionInfo } from '../version_info';
diff --git a/src/dev/build/tasks/os_packages/docker_generator/bundle_dockerfiles.ts b/src/dev/build/tasks/os_packages/docker_generator/bundle_dockerfiles.ts
index 02b469820f900..cc1ffb5f3e301 100644
--- a/src/dev/build/tasks/os_packages/docker_generator/bundle_dockerfiles.ts
+++ b/src/dev/build/tasks/os_packages/docker_generator/bundle_dockerfiles.ts
@@ -10,7 +10,8 @@ import { resolve } from 'path';
import { readFileSync } from 'fs';
import { copyFile } from 'fs/promises';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import Mustache from 'mustache';
import { compressTar, copyAll, mkdirp, write, Config } from '../../../lib';
diff --git a/src/dev/build/tasks/os_packages/docker_generator/run.ts b/src/dev/build/tasks/os_packages/docker_generator/run.ts
index 6a192baed3fa3..085b4393caa66 100644
--- a/src/dev/build/tasks/os_packages/docker_generator/run.ts
+++ b/src/dev/build/tasks/os_packages/docker_generator/run.ts
@@ -10,7 +10,8 @@ import { access, link, unlink, chmod } from 'fs';
import { resolve, basename } from 'path';
import { promisify } from 'util';
-import { ToolingLog, kibanaPackageJson } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { kibanaPackageJson } from '@kbn/utils';
import { write, copyAll, mkdirp, exec, Config, Build } from '../../../lib';
import * as dockerTemplates from './templates';
diff --git a/src/dev/chromium_version.ts b/src/dev/chromium_version.ts
index 410fcc72fbc0f..1f55330a92bb6 100644
--- a/src/dev/chromium_version.ts
+++ b/src/dev/chromium_version.ts
@@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
-import { run, REPO_ROOT, ToolingLog } from '@kbn/dev-utils';
+import { run, ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import chalk from 'chalk';
import cheerio from 'cheerio';
import fs from 'fs';
diff --git a/src/dev/code_coverage/ingest_coverage/__tests__/enumerate_patterns.test.js b/src/dev/code_coverage/ingest_coverage/__tests__/enumerate_patterns.test.js
index 57467d84f1f61..40d36ed46ea34 100644
--- a/src/dev/code_coverage/ingest_coverage/__tests__/enumerate_patterns.test.js
+++ b/src/dev/code_coverage/ingest_coverage/__tests__/enumerate_patterns.test.js
@@ -7,7 +7,8 @@
*/
import { enumeratePatterns } from '../team_assignment/enumerate_patterns';
-import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
const log = new ToolingLog({
level: 'info',
diff --git a/src/dev/code_coverage/ingest_coverage/team_assignment/index.js b/src/dev/code_coverage/ingest_coverage/team_assignment/index.js
index 0e341a3aac1dc..a38c4ee50b40a 100644
--- a/src/dev/code_coverage/ingest_coverage/team_assignment/index.js
+++ b/src/dev/code_coverage/ingest_coverage/team_assignment/index.js
@@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
-import { run, createFlagError, REPO_ROOT } from '@kbn/dev-utils';
+import { run, createFlagError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { parse } from './parse_owners';
import { flush } from './flush';
import { enumeratePatterns } from './enumerate_patterns';
diff --git a/src/dev/ensure_all_tests_in_ci_group.ts b/src/dev/ensure_all_tests_in_ci_group.ts
index aeccefae05d2c..a2d9729d3352b 100644
--- a/src/dev/ensure_all_tests_in_ci_group.ts
+++ b/src/dev/ensure_all_tests_in_ci_group.ts
@@ -12,7 +12,8 @@ import Fs from 'fs/promises';
import execa from 'execa';
import { safeLoad } from 'js-yaml';
-import { run, REPO_ROOT } from '@kbn/dev-utils';
+import { run } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { schema } from '@kbn/config-schema';
const RELATIVE_JOBS_YAML_PATH = '.ci/ci_groups.yml';
diff --git a/src/dev/eslint/run_eslint_with_types.ts b/src/dev/eslint/run_eslint_with_types.ts
index 750011dea1031..0f2a10d07d681 100644
--- a/src/dev/eslint/run_eslint_with_types.ts
+++ b/src/dev/eslint/run_eslint_with_types.ts
@@ -14,7 +14,8 @@ import execa from 'execa';
import * as Rx from 'rxjs';
import { mergeMap, reduce } from 'rxjs/operators';
import { supportsColor } from 'chalk';
-import { REPO_ROOT, run, createFailError } from '@kbn/dev-utils';
+import { run, createFailError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { lastValueFrom } from '@kbn/std';
import { PROJECTS } from '../typescript/projects';
diff --git a/src/dev/plugin_discovery/find_plugins.ts b/src/dev/plugin_discovery/find_plugins.ts
index f1725f34d1f8e..53a53bc08e15b 100644
--- a/src/dev/plugin_discovery/find_plugins.ts
+++ b/src/dev/plugin_discovery/find_plugins.ts
@@ -8,11 +8,9 @@
import Path from 'path';
import { getPluginSearchPaths } from '@kbn/config';
-import {
- KibanaPlatformPlugin,
- REPO_ROOT,
- simpleKibanaPlatformPluginDiscovery,
-} from '@kbn/dev-utils';
+import { KibanaPlatformPlugin, simpleKibanaPlatformPluginDiscovery } from '@kbn/dev-utils';
+
+import { REPO_ROOT } from '@kbn/utils';
export interface SearchOptions {
oss: boolean;
diff --git a/src/dev/run_build_docs_cli.ts b/src/dev/run_build_docs_cli.ts
index aad524b4437d3..8ee75912c1a7e 100644
--- a/src/dev/run_build_docs_cli.ts
+++ b/src/dev/run_build_docs_cli.ts
@@ -9,7 +9,8 @@
import Path from 'path';
import dedent from 'dedent';
-import { run, REPO_ROOT, createFailError } from '@kbn/dev-utils';
+import { run, createFailError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
const DEFAULT_DOC_REPO_PATH = Path.resolve(REPO_ROOT, '..', 'docs');
diff --git a/src/dev/run_find_plugins_with_circular_deps.ts b/src/dev/run_find_plugins_with_circular_deps.ts
index f7974b464fcaf..f9ee7bd84c54f 100644
--- a/src/dev/run_find_plugins_with_circular_deps.ts
+++ b/src/dev/run_find_plugins_with_circular_deps.ts
@@ -10,7 +10,8 @@ import dedent from 'dedent';
import { parseDependencyTree, parseCircular, prettyCircular } from 'dpdm';
import { relative } from 'path';
import { getPluginSearchPaths } from '@kbn/config';
-import { REPO_ROOT, run } from '@kbn/dev-utils';
+import { run } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
interface Options {
debug?: boolean;
diff --git a/src/dev/run_precommit_hook.js b/src/dev/run_precommit_hook.js
index a7bd0a9f57f6e..dfa3a94426bb2 100644
--- a/src/dev/run_precommit_hook.js
+++ b/src/dev/run_precommit_hook.js
@@ -8,7 +8,8 @@
import SimpleGit from 'simple-git/promise';
-import { run, combineErrors, createFlagError, REPO_ROOT } from '@kbn/dev-utils';
+import { run, combineErrors, createFlagError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import * as Eslint from './eslint';
import * as Stylelint from './stylelint';
import { getFilesForCommit, checkFileCasing } from './precommit_hook';
diff --git a/src/dev/typescript/build_ts_refs.ts b/src/dev/typescript/build_ts_refs.ts
index aaa8c0d12fa4d..f3896cf676e27 100644
--- a/src/dev/typescript/build_ts_refs.ts
+++ b/src/dev/typescript/build_ts_refs.ts
@@ -8,7 +8,8 @@
import Path from 'path';
-import { ToolingLog, REPO_ROOT, ProcRunner } from '@kbn/dev-utils';
+import { ToolingLog, ProcRunner } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import { ROOT_REFS_CONFIG_PATH } from './root_refs_config';
import { Project } from './project';
diff --git a/src/dev/typescript/build_ts_refs_cli.ts b/src/dev/typescript/build_ts_refs_cli.ts
index c68424c2a98f7..09866315fc8dd 100644
--- a/src/dev/typescript/build_ts_refs_cli.ts
+++ b/src/dev/typescript/build_ts_refs_cli.ts
@@ -8,7 +8,8 @@
import Path from 'path';
-import { run, REPO_ROOT, createFlagError } from '@kbn/dev-utils';
+import { run, createFlagError } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import del from 'del';
import { RefOutputCache } from './ref_output_cache';
diff --git a/src/dev/typescript/ref_output_cache/ref_output_cache.ts b/src/dev/typescript/ref_output_cache/ref_output_cache.ts
index b7e641ceb33d5..32b08ec1ba0df 100644
--- a/src/dev/typescript/ref_output_cache/ref_output_cache.ts
+++ b/src/dev/typescript/ref_output_cache/ref_output_cache.ts
@@ -9,7 +9,8 @@
import Path from 'path';
import Fs from 'fs/promises';
-import { ToolingLog, kibanaPackageJson, extract } from '@kbn/dev-utils';
+import { ToolingLog, extract } from '@kbn/dev-utils';
+import { kibanaPackageJson } from '@kbn/utils';
import del from 'del';
import tempy from 'tempy';
diff --git a/src/dev/typescript/root_refs_config.ts b/src/dev/typescript/root_refs_config.ts
index f4aa88f1ea6b2..e20b1ab46cd82 100644
--- a/src/dev/typescript/root_refs_config.ts
+++ b/src/dev/typescript/root_refs_config.ts
@@ -10,7 +10,8 @@ import Path from 'path';
import Fs from 'fs/promises';
import dedent from 'dedent';
-import { REPO_ROOT, ToolingLog } from '@kbn/dev-utils';
+import { ToolingLog } from '@kbn/dev-utils';
+import { REPO_ROOT } from '@kbn/utils';
import normalize from 'normalize-path';
import { PROJECTS } from './projects';
diff --git a/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/index.scss b/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/index.scss
index 6e1afd91c476d..fb004dfce4ec0 100644
--- a/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/index.scss
+++ b/src/plugins/chart_expressions/expression_heatmap/public/expression_renderers/index.scss
@@ -9,14 +9,6 @@
padding: $euiSizeS;
}
-.heatmap-chart__empty {
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
-
.heatmap-chart-icon__subdued {
fill: $euiTextSubduedColor;
}
diff --git a/src/plugins/charts/public/static/components/empty_placeholder.scss b/src/plugins/charts/public/static/components/empty_placeholder.scss
new file mode 100644
index 0000000000000..3f98da9eecb6a
--- /dev/null
+++ b/src/plugins/charts/public/static/components/empty_placeholder.scss
@@ -0,0 +1,7 @@
+.chart__empty-placeholder {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
\ No newline at end of file
diff --git a/src/plugins/charts/public/static/components/empty_placeholder.tsx b/src/plugins/charts/public/static/components/empty_placeholder.tsx
index db3f3fb6739d5..e376120c9cd9e 100644
--- a/src/plugins/charts/public/static/components/empty_placeholder.tsx
+++ b/src/plugins/charts/public/static/components/empty_placeholder.tsx
@@ -9,15 +9,20 @@
import React from 'react';
import { EuiIcon, EuiText, IconType, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
+import './empty_placeholder.scss';
-export const EmptyPlaceholder = (props: { icon: IconType }) => (
+export const EmptyPlaceholder = ({
+ icon,
+ message = ,
+}: {
+ icon: IconType;
+ message?: JSX.Element;
+}) => (
<>
-
-
+
+
-
-
-
+ {message}
>
);
diff --git a/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js b/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js
index 866e19a1d0d3e..efd7dbd088581 100644
--- a/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js
+++ b/src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js
@@ -2022,22 +2022,37 @@ ace.define(
},
// parses and returns the method
method = function () {
- const [first, ...rest] = text.split(' ');
- text = first.toUpperCase() + rest.join(' ');
- ch = ch.toUpperCase();
-
switch (ch) {
+ case 'g':
+ next('g');
+ next('e');
+ next('t');
+ return 'get';
case 'G':
next('G');
next('E');
next('T');
return 'GET';
+ case 'h':
+ next('h');
+ next('e');
+ next('a');
+ next('d');
+ return 'head';
case 'H':
next('H');
next('E');
next('A');
next('D');
return 'HEAD';
+ case 'd':
+ next('d');
+ next('e');
+ next('l');
+ next('e');
+ next('t');
+ next('e');
+ return 'delete';
case 'D':
next('D');
next('E');
@@ -2046,6 +2061,22 @@ ace.define(
next('T');
next('E');
return 'DELETE';
+ case 'p':
+ next('p');
+ switch (ch) {
+ case 'u':
+ next('u');
+ next('t');
+ return 'put';
+ case 'o':
+ next('o');
+ next('s');
+ next('t');
+ return 'post';
+ default:
+ error('Unexpected \'' + ch + '\'');
+ }
+ break;
case 'P':
next('P');
switch (ch) {
diff --git a/src/plugins/console/public/lib/mappings/mappings.js b/src/plugins/console/public/lib/mappings/mappings.js
index d4996f9fd8862..2a4ee6b2e346b 100644
--- a/src/plugins/console/public/lib/mappings/mappings.js
+++ b/src/plugins/console/public/lib/mappings/mappings.js
@@ -250,7 +250,10 @@ function retrieveSettings(settingsKey, settingsToRetrieve) {
// Fetch autocomplete info if setting is set to true, and if user has made changes.
if (settingsToRetrieve[settingsKey] === true) {
- return es.send('GET', settingKeyToPathMap[settingsKey], null, true);
+ // Use pretty=false in these request in order to compress the response by removing whitespace
+ const path = `${settingKeyToPathMap[settingsKey]}?pretty=false`;
+
+ return es.send('GET', path, null, true);
} else {
const settingsPromise = new $.Deferred();
if (settingsToRetrieve[settingsKey] === false) {
diff --git a/src/plugins/dashboard/public/application/lib/filter_utils.ts b/src/plugins/dashboard/public/application/lib/filter_utils.ts
index a31b83ec2df8f..c6b9ae2d01cf3 100644
--- a/src/plugins/dashboard/public/application/lib/filter_utils.ts
+++ b/src/plugins/dashboard/public/application/lib/filter_utils.ts
@@ -72,7 +72,7 @@ export const cleanFiltersForComparison = (filters: Filter[]) => {
export const cleanFiltersForSerialize = (filters: Filter[]): Filter[] => {
return filters.map((filter) => {
- if (filter.meta.value) {
+ if (filter.meta?.value) {
delete filter.meta.value;
}
return filter;
diff --git a/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts b/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts
index 31579e92bd1ec..03a03842c0e66 100644
--- a/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts
+++ b/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts
@@ -8,10 +8,10 @@
import _ from 'lodash';
+import { getDashboard60Warning, dashboardLoadingErrorStrings } from '../../dashboard_strings';
import { savedObjectToDashboardState } from './convert_dashboard_state';
import { DashboardState, DashboardBuildContext } from '../../types';
import { DashboardConstants, DashboardSavedObject } from '../..';
-import { getDashboard60Warning } from '../../dashboard_strings';
import { migrateLegacyQuery } from './migrate_legacy_query';
import { cleanFiltersForSerialize } from './filter_utils';
import { ViewMode } from '../../services/embeddable';
@@ -52,34 +52,33 @@ export const loadSavedDashboardState = async ({
return;
}
await indexPatterns.ensureDefaultDataView();
- let savedDashboard: DashboardSavedObject | undefined;
try {
- savedDashboard = (await savedDashboards.get({
+ const savedDashboard = (await savedDashboards.get({
id: savedDashboardId,
useResolve: true,
})) as DashboardSavedObject;
+ const savedDashboardState = savedObjectToDashboardState({
+ savedDashboard,
+ usageCollection,
+ showWriteControls,
+ savedObjectsTagging,
+ version: initializerContext.env.packageInfo.version,
+ });
+
+ const isViewMode = !showWriteControls || Boolean(savedDashboard.id);
+ savedDashboardState.viewMode = isViewMode ? ViewMode.VIEW : ViewMode.EDIT;
+ savedDashboardState.filters = cleanFiltersForSerialize(savedDashboardState.filters);
+ savedDashboardState.query = migrateLegacyQuery(
+ savedDashboardState.query || queryString.getDefaultQuery()
+ );
+
+ return { savedDashboardState, savedDashboard };
} catch (error) {
// E.g. a corrupt or deleted dashboard
- notifications.toasts.addDanger(error.message);
+ notifications.toasts.addDanger(
+ dashboardLoadingErrorStrings.getDashboardLoadError(error.message)
+ );
history.push(DashboardConstants.LANDING_PAGE_PATH);
return;
}
- if (!savedDashboard) return;
-
- const savedDashboardState = savedObjectToDashboardState({
- savedDashboard,
- usageCollection,
- showWriteControls,
- savedObjectsTagging,
- version: initializerContext.env.packageInfo.version,
- });
-
- const isViewMode = !showWriteControls || Boolean(savedDashboard.id);
- savedDashboardState.viewMode = isViewMode ? ViewMode.VIEW : ViewMode.EDIT;
- savedDashboardState.filters = cleanFiltersForSerialize(savedDashboardState.filters);
- savedDashboardState.query = migrateLegacyQuery(
- savedDashboardState.query || queryString.getDefaultQuery()
- );
-
- return { savedDashboardState, savedDashboard };
};
diff --git a/src/plugins/dashboard/public/dashboard_strings.ts b/src/plugins/dashboard/public/dashboard_strings.ts
index ca0f51976f3fb..52961c43cc1a2 100644
--- a/src/plugins/dashboard/public/dashboard_strings.ts
+++ b/src/plugins/dashboard/public/dashboard_strings.ts
@@ -359,6 +359,14 @@ export const panelStorageErrorStrings = {
}),
};
+export const dashboardLoadingErrorStrings = {
+ getDashboardLoadError: (message: string) =>
+ i18n.translate('dashboard.loadingError.errorMessage', {
+ defaultMessage: 'Error encountered while loading saved dashboard: {message}',
+ values: { message },
+ }),
+};
+
/*
Empty Screen
*/
diff --git a/src/plugins/data/common/search/aggs/agg_types.ts b/src/plugins/data/common/search/aggs/agg_types.ts
index dd930887f9d19..a84fddb19c5fa 100644
--- a/src/plugins/data/common/search/aggs/agg_types.ts
+++ b/src/plugins/data/common/search/aggs/agg_types.ts
@@ -62,6 +62,8 @@ export const getAggTypes = () => ({
{ name: BUCKET_TYPES.SIGNIFICANT_TERMS, fn: buckets.getSignificantTermsBucketAgg },
{ name: BUCKET_TYPES.GEOHASH_GRID, fn: buckets.getGeoHashBucketAgg },
{ name: BUCKET_TYPES.GEOTILE_GRID, fn: buckets.getGeoTitleBucketAgg },
+ { name: BUCKET_TYPES.SAMPLER, fn: buckets.getSamplerBucketAgg },
+ { name: BUCKET_TYPES.DIVERSIFIED_SAMPLER, fn: buckets.getDiversifiedSamplerBucketAgg },
],
});
@@ -79,6 +81,8 @@ export const getAggTypesFunctions = () => [
buckets.aggDateHistogram,
buckets.aggTerms,
buckets.aggMultiTerms,
+ buckets.aggSampler,
+ buckets.aggDiversifiedSampler,
metrics.aggAvg,
metrics.aggBucketAvg,
metrics.aggBucketMax,
diff --git a/src/plugins/data/common/search/aggs/aggs_service.test.ts b/src/plugins/data/common/search/aggs/aggs_service.test.ts
index be3fbae26174a..571083c18156f 100644
--- a/src/plugins/data/common/search/aggs/aggs_service.test.ts
+++ b/src/plugins/data/common/search/aggs/aggs_service.test.ts
@@ -73,6 +73,8 @@ describe('Aggs service', () => {
"significant_terms",
"geohash_grid",
"geotile_grid",
+ "sampler",
+ "diversified_sampler",
"foo",
]
`);
@@ -122,6 +124,8 @@ describe('Aggs service', () => {
"significant_terms",
"geohash_grid",
"geotile_grid",
+ "sampler",
+ "diversified_sampler",
]
`);
expect(bStart.types.getAll().metrics.map((t) => t(aggTypesDependencies).name))
diff --git a/src/plugins/data/common/search/aggs/buckets/bucket_agg_types.ts b/src/plugins/data/common/search/aggs/buckets/bucket_agg_types.ts
index 0c01bff90bfee..671266ef15997 100644
--- a/src/plugins/data/common/search/aggs/buckets/bucket_agg_types.ts
+++ b/src/plugins/data/common/search/aggs/buckets/bucket_agg_types.ts
@@ -19,4 +19,6 @@ export enum BUCKET_TYPES {
GEOHASH_GRID = 'geohash_grid',
GEOTILE_GRID = 'geotile_grid',
DATE_HISTOGRAM = 'date_histogram',
+ SAMPLER = 'sampler',
+ DIVERSIFIED_SAMPLER = 'diversified_sampler',
}
diff --git a/src/plugins/data/common/search/aggs/buckets/diversified_sampler.ts b/src/plugins/data/common/search/aggs/buckets/diversified_sampler.ts
new file mode 100644
index 0000000000000..31ebaa094c368
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/diversified_sampler.ts
@@ -0,0 +1,62 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { i18n } from '@kbn/i18n';
+import { BucketAggType } from './bucket_agg_type';
+import { BaseAggParams } from '../types';
+import { aggDiversifiedSamplerFnName } from './diversified_sampler_fn';
+
+export const DIVERSIFIED_SAMPLER_AGG_NAME = 'diversified_sampler';
+
+const title = i18n.translate('data.search.aggs.buckets.diversifiedSamplerTitle', {
+ defaultMessage: 'Diversified sampler',
+ description: 'Diversified sampler aggregation title',
+});
+
+export interface AggParamsDiversifiedSampler extends BaseAggParams {
+ /**
+ * Is used to provide values used for de-duplication
+ */
+ field: string;
+
+ /**
+ * Limits how many top-scoring documents are collected in the sample processed on each shard.
+ */
+ shard_size?: number;
+
+ /**
+ * Limits how many documents are permitted per choice of de-duplicating value
+ */
+ max_docs_per_value?: number;
+}
+
+/**
+ * Like the sampler aggregation this is a filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents.
+ * The diversified_sampler aggregation adds the ability to limit the number of matches that share a common value.
+ */
+export const getDiversifiedSamplerBucketAgg = () =>
+ new BucketAggType({
+ name: DIVERSIFIED_SAMPLER_AGG_NAME,
+ title,
+ customLabels: false,
+ expressionName: aggDiversifiedSamplerFnName,
+ params: [
+ {
+ name: 'shard_size',
+ type: 'number',
+ },
+ {
+ name: 'max_docs_per_value',
+ type: 'number',
+ },
+ {
+ name: 'field',
+ type: 'field',
+ },
+ ],
+ });
diff --git a/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.test.ts
new file mode 100644
index 0000000000000..e874542289bb2
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.test.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { functionWrapper } from '../test_helpers';
+import { aggDiversifiedSampler } from './diversified_sampler_fn';
+
+describe('aggDiversifiedSampler', () => {
+ const fn = functionWrapper(aggDiversifiedSampler());
+
+ test('fills in defaults when only required args are provided', () => {
+ const actual = fn({ id: 'sampler', schema: 'bucket', field: 'author' });
+ expect(actual).toMatchInlineSnapshot(`
+ Object {
+ "type": "agg_type",
+ "value": Object {
+ "enabled": true,
+ "id": "sampler",
+ "params": Object {
+ "field": "author",
+ "max_docs_per_value": undefined,
+ "shard_size": undefined,
+ },
+ "schema": "bucket",
+ "type": "diversified_sampler",
+ },
+ }
+ `);
+ });
+
+ test('includes optional params when they are provided', () => {
+ const actual = fn({
+ id: 'sampler',
+ schema: 'bucket',
+ shard_size: 300,
+ field: 'author',
+ max_docs_per_value: 3,
+ });
+
+ expect(actual.value).toMatchInlineSnapshot(`
+ Object {
+ "enabled": true,
+ "id": "sampler",
+ "params": Object {
+ "field": "author",
+ "max_docs_per_value": 3,
+ "shard_size": 300,
+ },
+ "schema": "bucket",
+ "type": "diversified_sampler",
+ }
+ `);
+ });
+});
diff --git a/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.ts b/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.ts
new file mode 100644
index 0000000000000..0e1b235dd576d
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/diversified_sampler_fn.ts
@@ -0,0 +1,90 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { i18n } from '@kbn/i18n';
+import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
+import { AggExpressionFunctionArgs, AggExpressionType, BUCKET_TYPES } from '../';
+import { DIVERSIFIED_SAMPLER_AGG_NAME } from './diversified_sampler';
+
+export const aggDiversifiedSamplerFnName = 'aggDiversifiedSampler';
+
+type Input = any;
+type Arguments = AggExpressionFunctionArgs;
+
+type Output = AggExpressionType;
+type FunctionDefinition = ExpressionFunctionDefinition<
+ typeof aggDiversifiedSamplerFnName,
+ Input,
+ Arguments,
+ Output
+>;
+
+export const aggDiversifiedSampler = (): FunctionDefinition => ({
+ name: aggDiversifiedSamplerFnName,
+ help: i18n.translate('data.search.aggs.function.buckets.diversifiedSampler.help', {
+ defaultMessage: 'Generates a serialized agg config for a Diversified sampler agg',
+ }),
+ type: 'agg_type',
+ args: {
+ id: {
+ types: ['string'],
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.id.help', {
+ defaultMessage: 'ID for this aggregation',
+ }),
+ },
+ enabled: {
+ types: ['boolean'],
+ default: true,
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.enabled.help', {
+ defaultMessage: 'Specifies whether this aggregation should be enabled',
+ }),
+ },
+ schema: {
+ types: ['string'],
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.schema.help', {
+ defaultMessage: 'Schema to use for this aggregation',
+ }),
+ },
+ shard_size: {
+ types: ['number'],
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.shardSize.help', {
+ defaultMessage:
+ 'The shard_size parameter limits how many top-scoring documents are collected in the sample processed on each shard.',
+ }),
+ },
+ max_docs_per_value: {
+ types: ['number'],
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.maxDocsPerValue.help', {
+ defaultMessage:
+ 'Limits how many documents are permitted per choice of de-duplicating value.',
+ }),
+ },
+ field: {
+ types: ['string'],
+ help: i18n.translate('data.search.aggs.buckets.diversifiedSampler.field.help', {
+ defaultMessage: 'Used to provide values used for de-duplication.',
+ }),
+ },
+ },
+ fn: (input, args) => {
+ const { id, enabled, schema, ...rest } = args;
+
+ return {
+ type: 'agg_type',
+ value: {
+ id,
+ enabled,
+ schema,
+ type: DIVERSIFIED_SAMPLER_AGG_NAME,
+ params: {
+ ...rest,
+ },
+ },
+ };
+ },
+});
diff --git a/src/plugins/data/common/search/aggs/buckets/index.ts b/src/plugins/data/common/search/aggs/buckets/index.ts
index 421fa0fcfdaf4..bf96a9ef860c0 100644
--- a/src/plugins/data/common/search/aggs/buckets/index.ts
+++ b/src/plugins/data/common/search/aggs/buckets/index.ts
@@ -38,3 +38,7 @@ export * from './terms_fn';
export * from './terms';
export * from './multi_terms_fn';
export * from './multi_terms';
+export * from './sampler_fn';
+export * from './sampler';
+export * from './diversified_sampler_fn';
+export * from './diversified_sampler';
diff --git a/src/plugins/data/common/search/aggs/buckets/sampler.ts b/src/plugins/data/common/search/aggs/buckets/sampler.ts
new file mode 100644
index 0000000000000..7eb4f74115095
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/sampler.ts
@@ -0,0 +1,43 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { i18n } from '@kbn/i18n';
+import { BucketAggType } from './bucket_agg_type';
+import { BaseAggParams } from '../types';
+import { aggSamplerFnName } from './sampler_fn';
+
+export const SAMPLER_AGG_NAME = 'sampler';
+
+const title = i18n.translate('data.search.aggs.buckets.samplerTitle', {
+ defaultMessage: 'Sampler',
+ description: 'Sampler aggregation title',
+});
+
+export interface AggParamsSampler extends BaseAggParams {
+ /**
+ * Limits how many top-scoring documents are collected in the sample processed on each shard.
+ */
+ shard_size?: number;
+}
+
+/**
+ * A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents.
+ */
+export const getSamplerBucketAgg = () =>
+ new BucketAggType({
+ name: SAMPLER_AGG_NAME,
+ title,
+ customLabels: false,
+ expressionName: aggSamplerFnName,
+ params: [
+ {
+ name: 'shard_size',
+ type: 'number',
+ },
+ ],
+ });
diff --git a/src/plugins/data/common/search/aggs/buckets/sampler_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/sampler_fn.test.ts
new file mode 100644
index 0000000000000..76ef901671e72
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/sampler_fn.test.ts
@@ -0,0 +1,52 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { functionWrapper } from '../test_helpers';
+import { aggSampler } from './sampler_fn';
+
+describe('aggSampler', () => {
+ const fn = functionWrapper(aggSampler());
+
+ test('fills in defaults when only required args are provided', () => {
+ const actual = fn({ id: 'sampler', schema: 'bucket' });
+ expect(actual).toMatchInlineSnapshot(`
+ Object {
+ "type": "agg_type",
+ "value": Object {
+ "enabled": true,
+ "id": "sampler",
+ "params": Object {
+ "shard_size": undefined,
+ },
+ "schema": "bucket",
+ "type": "sampler",
+ },
+ }
+ `);
+ });
+
+ test('includes optional params when they are provided', () => {
+ const actual = fn({
+ id: 'sampler',
+ schema: 'bucket',
+ shard_size: 300,
+ });
+
+ expect(actual.value).toMatchInlineSnapshot(`
+ Object {
+ "enabled": true,
+ "id": "sampler",
+ "params": Object {
+ "shard_size": 300,
+ },
+ "schema": "bucket",
+ "type": "sampler",
+ }
+ `);
+ });
+});
diff --git a/src/plugins/data/common/search/aggs/buckets/sampler_fn.ts b/src/plugins/data/common/search/aggs/buckets/sampler_fn.ts
new file mode 100644
index 0000000000000..2cb30eb70a230
--- /dev/null
+++ b/src/plugins/data/common/search/aggs/buckets/sampler_fn.ts
@@ -0,0 +1,77 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { i18n } from '@kbn/i18n';
+import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common';
+import { AggExpressionFunctionArgs, AggExpressionType, BUCKET_TYPES } from '../';
+import { SAMPLER_AGG_NAME } from './sampler';
+
+export const aggSamplerFnName = 'aggSampler';
+
+type Input = any;
+type Arguments = AggExpressionFunctionArgs;
+
+type Output = AggExpressionType;
+type FunctionDefinition = ExpressionFunctionDefinition<
+ typeof aggSamplerFnName,
+ Input,
+ Arguments,
+ Output
+>;
+
+export const aggSampler = (): FunctionDefinition => ({
+ name: aggSamplerFnName,
+ help: i18n.translate('data.search.aggs.function.buckets.sampler.help', {
+ defaultMessage: 'Generates a serialized agg config for a Sampler agg',
+ }),
+ type: 'agg_type',
+ args: {
+ id: {
+ types: ['string'],
+ help: i18n.translate('data.search.aggs.buckets.sampler.id.help', {
+ defaultMessage: 'ID for this aggregation',
+ }),
+ },
+ enabled: {
+ types: ['boolean'],
+ default: true,
+ help: i18n.translate('data.search.aggs.buckets.sampler.enabled.help', {
+ defaultMessage: 'Specifies whether this aggregation should be enabled',
+ }),
+ },
+ schema: {
+ types: ['string'],
+ help: i18n.translate('data.search.aggs.buckets.sampler.schema.help', {
+ defaultMessage: 'Schema to use for this aggregation',
+ }),
+ },
+ shard_size: {
+ types: ['number'],
+ help: i18n.translate('data.search.aggs.buckets.sampler.shardSize.help', {
+ defaultMessage:
+ 'The shard_size parameter limits how many top-scoring documents are collected in the sample processed on each shard.',
+ }),
+ },
+ },
+ fn: (input, args) => {
+ const { id, enabled, schema, ...rest } = args;
+
+ return {
+ type: 'agg_type',
+ value: {
+ id,
+ enabled,
+ schema,
+ type: SAMPLER_AGG_NAME,
+ params: {
+ ...rest,
+ },
+ },
+ };
+ },
+});
diff --git a/src/plugins/data/common/search/aggs/types.ts b/src/plugins/data/common/search/aggs/types.ts
index b9a977e0a8a09..9c4866c19714d 100644
--- a/src/plugins/data/common/search/aggs/types.ts
+++ b/src/plugins/data/common/search/aggs/types.ts
@@ -90,6 +90,8 @@ import {
aggFilteredMetric,
aggSinglePercentile,
} from './';
+import { AggParamsSampler } from './buckets/sampler';
+import { AggParamsDiversifiedSampler } from './buckets/diversified_sampler';
export type { IAggConfig, AggConfigSerialized } from './agg_config';
export type { CreateAggConfigParams, IAggConfigs } from './agg_configs';
@@ -166,6 +168,8 @@ export interface AggParamsMapping {
[BUCKET_TYPES.DATE_HISTOGRAM]: AggParamsDateHistogram;
[BUCKET_TYPES.TERMS]: AggParamsTerms;
[BUCKET_TYPES.MULTI_TERMS]: AggParamsMultiTerms;
+ [BUCKET_TYPES.SAMPLER]: AggParamsSampler;
+ [BUCKET_TYPES.DIVERSIFIED_SAMPLER]: AggParamsDiversifiedSampler;
[METRIC_TYPES.AVG]: AggParamsAvg;
[METRIC_TYPES.CARDINALITY]: AggParamsCardinality;
[METRIC_TYPES.COUNT]: BaseAggParams;
diff --git a/src/plugins/data/public/search/aggs/aggs_service.test.ts b/src/plugins/data/public/search/aggs/aggs_service.test.ts
index 20e07360a68e5..c7df4354cc76b 100644
--- a/src/plugins/data/public/search/aggs/aggs_service.test.ts
+++ b/src/plugins/data/public/search/aggs/aggs_service.test.ts
@@ -53,7 +53,7 @@ describe('AggsService - public', () => {
test('registers default agg types', () => {
service.setup(setupDeps);
const start = service.start(startDeps);
- expect(start.types.getAll().buckets.length).toBe(12);
+ expect(start.types.getAll().buckets.length).toBe(14);
expect(start.types.getAll().metrics.length).toBe(23);
});
@@ -69,7 +69,7 @@ describe('AggsService - public', () => {
);
const start = service.start(startDeps);
- expect(start.types.getAll().buckets.length).toBe(13);
+ expect(start.types.getAll().buckets.length).toBe(15);
expect(start.types.getAll().buckets.some(({ name }) => name === 'foo')).toBe(true);
expect(start.types.getAll().metrics.length).toBe(24);
expect(start.types.getAll().metrics.some(({ name }) => name === 'bar')).toBe(true);
diff --git a/src/plugins/data_view_field_editor/public/components/field_editor/form_fields/script_field.tsx b/src/plugins/data_view_field_editor/public/components/field_editor/form_fields/script_field.tsx
index 602db0cd55274..c5eaeb02c05cf 100644
--- a/src/plugins/data_view_field_editor/public/components/field_editor/form_fields/script_field.tsx
+++ b/src/plugins/data_view_field_editor/public/components/field_editor/form_fields/script_field.tsx
@@ -218,6 +218,7 @@ const ScriptFieldComponent = ({ existingConcreteFields, links }: Props) => {
<>
{
- private readonly tutorialsRegistry = new TutorialsRegistry();
+ private readonly tutorialsRegistry;
private readonly sampleDataRegistry: SampleDataRegistry;
private customIntegrations?: CustomIntegrationsPluginSetup;
constructor(private readonly initContext: PluginInitializerContext) {
this.sampleDataRegistry = new SampleDataRegistry(this.initContext);
+ this.tutorialsRegistry = new TutorialsRegistry(this.initContext);
}
public setup(core: CoreSetup, plugins: HomeServerPluginSetupDependencies): HomeServerPluginSetup {
diff --git a/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts b/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts
index 4c80c8858a475..aeebecf6cab32 100644
--- a/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts
+++ b/src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts
@@ -29,6 +29,7 @@ export enum TutorialsCategory {
export type Platform = 'WINDOWS' | 'OSX' | 'DEB' | 'RPM';
export interface TutorialContext {
+ kibanaBranch: string;
[key: string]: unknown;
}
export type TutorialProvider = (context: TutorialContext) => TutorialSchema;
diff --git a/src/plugins/home/server/services/tutorials/tutorials_registry.test.ts b/src/plugins/home/server/services/tutorials/tutorials_registry.test.ts
index ee73c8e13f62b..dec1d23e05787 100644
--- a/src/plugins/home/server/services/tutorials/tutorials_registry.test.ts
+++ b/src/plugins/home/server/services/tutorials/tutorials_registry.test.ts
@@ -69,6 +69,7 @@ const validTutorialProvider = VALID_TUTORIAL;
describe('TutorialsRegistry', () => {
let mockCoreSetup: MockedKeys;
+ let mockInitContext: ReturnType;
let testProvider: TutorialProvider;
let testScopedTutorialContextFactory: ScopedTutorialContextFactory;
let mockCustomIntegrationsPluginSetup: jest.Mocked;
@@ -80,6 +81,7 @@ describe('TutorialsRegistry', () => {
describe('GET /api/kibana/home/tutorials', () => {
beforeEach(() => {
mockCoreSetup = coreMock.createSetup();
+ mockInitContext = coreMock.createPluginInitializerContext();
});
test('has a router that retrieves registered tutorials', () => {
@@ -90,13 +92,19 @@ describe('TutorialsRegistry', () => {
describe('setup', () => {
test('exposes proper contract', () => {
- const setup = new TutorialsRegistry().setup(mockCoreSetup, mockCustomIntegrationsPluginSetup);
+ const setup = new TutorialsRegistry(mockInitContext).setup(
+ mockCoreSetup,
+ mockCustomIntegrationsPluginSetup
+ );
expect(setup).toHaveProperty('registerTutorial');
expect(setup).toHaveProperty('addScopedTutorialContextFactory');
});
test('registerTutorial throws when registering a tutorial with an invalid schema', () => {
- const setup = new TutorialsRegistry().setup(mockCoreSetup, mockCustomIntegrationsPluginSetup);
+ const setup = new TutorialsRegistry(mockInitContext).setup(
+ mockCoreSetup,
+ mockCustomIntegrationsPluginSetup
+ );
testProvider = ({}) => invalidTutorialProvider;
expect(() => setup.registerTutorial(testProvider)).toThrowErrorMatchingInlineSnapshot(
`"Unable to register tutorial spec because its invalid. Error: [name]: is not allowed to be empty"`
@@ -104,7 +112,10 @@ describe('TutorialsRegistry', () => {
});
test('registerTutorial registers a tutorial with a valid schema', () => {
- const setup = new TutorialsRegistry().setup(mockCoreSetup, mockCustomIntegrationsPluginSetup);
+ const setup = new TutorialsRegistry(mockInitContext).setup(
+ mockCoreSetup,
+ mockCustomIntegrationsPluginSetup
+ );
testProvider = ({}) => validTutorialProvider;
expect(() => setup.registerTutorial(testProvider)).not.toThrowError();
expect(mockCustomIntegrationsPluginSetup.registerCustomIntegration.mock.calls).toEqual([
@@ -129,7 +140,10 @@ describe('TutorialsRegistry', () => {
});
test('addScopedTutorialContextFactory throws when given a scopedTutorialContextFactory that is not a function', () => {
- const setup = new TutorialsRegistry().setup(mockCoreSetup, mockCustomIntegrationsPluginSetup);
+ const setup = new TutorialsRegistry(mockInitContext).setup(
+ mockCoreSetup,
+ mockCustomIntegrationsPluginSetup
+ );
const testItem = {} as TutorialProvider;
expect(() =>
setup.addScopedTutorialContextFactory(testItem)
@@ -139,7 +153,10 @@ describe('TutorialsRegistry', () => {
});
test('addScopedTutorialContextFactory adds a scopedTutorialContextFactory when given a function', () => {
- const setup = new TutorialsRegistry().setup(mockCoreSetup, mockCustomIntegrationsPluginSetup);
+ const setup = new TutorialsRegistry(mockInitContext).setup(
+ mockCoreSetup,
+ mockCustomIntegrationsPluginSetup
+ );
testScopedTutorialContextFactory = ({}) => 'string';
expect(() =>
setup.addScopedTutorialContextFactory(testScopedTutorialContextFactory)
@@ -149,7 +166,7 @@ describe('TutorialsRegistry', () => {
describe('start', () => {
test('exposes proper contract', () => {
- const start = new TutorialsRegistry().start(
+ const start = new TutorialsRegistry(mockInitContext).start(
coreMock.createStart(),
mockCustomIntegrationsPluginSetup
);
diff --git a/src/plugins/home/server/services/tutorials/tutorials_registry.ts b/src/plugins/home/server/services/tutorials/tutorials_registry.ts
index 723c92e6dfaf4..7d93a57b2073d 100644
--- a/src/plugins/home/server/services/tutorials/tutorials_registry.ts
+++ b/src/plugins/home/server/services/tutorials/tutorials_registry.ts
@@ -6,11 +6,12 @@
* Side Public License, v 1.
*/
-import { CoreSetup, CoreStart } from 'src/core/server';
+import { CoreSetup, CoreStart, PluginInitializerContext } from 'src/core/server';
import {
TutorialProvider,
TutorialContextFactory,
ScopedTutorialContextFactory,
+ TutorialContext,
} from './lib/tutorials_registry_types';
import { TutorialSchema, tutorialSchema } from './lib/tutorial_schema';
import { builtInTutorials } from '../../tutorials/register';
@@ -71,12 +72,14 @@ export class TutorialsRegistry {
private tutorialProviders: TutorialProvider[] = []; // pre-register all the tutorials we know we want in here
private readonly scopedTutorialContextFactories: TutorialContextFactory[] = [];
+ constructor(private readonly initContext: PluginInitializerContext) {}
+
public setup(core: CoreSetup, customIntegrations?: CustomIntegrationsPluginSetup) {
const router = core.http.createRouter();
router.get(
{ path: '/api/kibana/home/tutorials', validate: false },
async (context, req, res) => {
- const initialContext = {};
+ const initialContext = this.baseTutorialContext;
const scopedContext = this.scopedTutorialContextFactories.reduce(
(accumulatedContext, contextFactory) => {
return { ...accumulatedContext, ...contextFactory(req) };
@@ -92,7 +95,7 @@ export class TutorialsRegistry {
);
return {
registerTutorial: (specProvider: TutorialProvider) => {
- const emptyContext = {};
+ const emptyContext = this.baseTutorialContext;
let tutorial: TutorialSchema;
try {
tutorial = tutorialSchema.validate(specProvider(emptyContext));
@@ -132,12 +135,16 @@ export class TutorialsRegistry {
if (customIntegrations) {
builtInTutorials.forEach((provider) => {
- const tutorial = provider({});
+ const tutorial = provider(this.baseTutorialContext);
registerBeatsTutorialsWithCustomIntegrations(core, customIntegrations, tutorial);
});
}
return {};
}
+
+ private get baseTutorialContext(): TutorialContext {
+ return { kibanaBranch: this.initContext.env.packageInfo.branch };
+ }
}
/** @public */
diff --git a/src/plugins/home/server/tutorials/activemq_logs/index.ts b/src/plugins/home/server/tutorials/activemq_logs/index.ts
index a277b37838562..cc84f9a536b22 100644
--- a/src/plugins/home/server/tutorials/activemq_logs/index.ts
+++ b/src/plugins/home/server/tutorials/activemq_logs/index.ts
@@ -56,8 +56,8 @@ export function activemqLogsSpecProvider(context: TutorialContext): TutorialSche
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/activemq_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/activemq_metrics/index.ts b/src/plugins/home/server/tutorials/activemq_metrics/index.ts
index 9a001c149cda0..9c98c9c2ffc7a 100644
--- a/src/plugins/home/server/tutorials/activemq_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/activemq_metrics/index.ts
@@ -54,8 +54,8 @@ export function activemqMetricsSpecProvider(context: TutorialContext): TutorialS
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['web'],
};
diff --git a/src/plugins/home/server/tutorials/aerospike_metrics/index.ts b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts
index 3e574f2c75496..1cc350af579cb 100644
--- a/src/plugins/home/server/tutorials/aerospike_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts
@@ -54,8 +54,8 @@ export function aerospikeMetricsSpecProvider(context: TutorialContext): Tutorial
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/apache_logs/index.ts b/src/plugins/home/server/tutorials/apache_logs/index.ts
index 6e588fd86588d..aea8e3c188d94 100644
--- a/src/plugins/home/server/tutorials/apache_logs/index.ts
+++ b/src/plugins/home/server/tutorials/apache_logs/index.ts
@@ -57,8 +57,8 @@ export function apacheLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/apache_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/apache_metrics/index.ts b/src/plugins/home/server/tutorials/apache_metrics/index.ts
index 17b495d1460c5..0af719610c24d 100644
--- a/src/plugins/home/server/tutorials/apache_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/apache_metrics/index.ts
@@ -56,8 +56,8 @@ export function apacheMetricsSpecProvider(context: TutorialContext): TutorialSch
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/apache_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/auditbeat/index.ts b/src/plugins/home/server/tutorials/auditbeat/index.ts
index 96e5d4bcda393..666fcf15635c3 100644
--- a/src/plugins/home/server/tutorials/auditbeat/index.ts
+++ b/src/plugins/home/server/tutorials/auditbeat/index.ts
@@ -56,8 +56,8 @@ processes, users, logins, sockets information, file accesses, and more. \
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/auditbeat/screenshot.png',
onPrem: onPremInstructions(platforms, context),
- elasticCloud: cloudInstructions(platforms),
- onPremElasticCloud: onPremCloudInstructions(platforms),
+ elasticCloud: cloudInstructions(platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(platforms, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/auditd_logs/index.ts b/src/plugins/home/server/tutorials/auditd_logs/index.ts
index 6993196d93417..24857045ccc28 100644
--- a/src/plugins/home/server/tutorials/auditd_logs/index.ts
+++ b/src/plugins/home/server/tutorials/auditd_logs/index.ts
@@ -57,8 +57,8 @@ export function auditdLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/auditd_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['os_system'],
};
}
diff --git a/src/plugins/home/server/tutorials/aws_logs/index.ts b/src/plugins/home/server/tutorials/aws_logs/index.ts
index 62fbcc4eebc18..60187490318ae 100644
--- a/src/plugins/home/server/tutorials/aws_logs/index.ts
+++ b/src/plugins/home/server/tutorials/aws_logs/index.ts
@@ -57,8 +57,8 @@ export function awsLogsSpecProvider(context: TutorialContext): TutorialSchema {
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/aws_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['aws', 'cloud', 'datastore', 'security', 'network'],
};
}
diff --git a/src/plugins/home/server/tutorials/aws_metrics/index.ts b/src/plugins/home/server/tutorials/aws_metrics/index.ts
index 6bf1bf64bff9f..6541b4f5f29c8 100644
--- a/src/plugins/home/server/tutorials/aws_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/aws_metrics/index.ts
@@ -58,8 +58,8 @@ export function awsMetricsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/aws_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['aws', 'cloud', 'datastore', 'security', 'network'],
};
}
diff --git a/src/plugins/home/server/tutorials/azure_logs/index.ts b/src/plugins/home/server/tutorials/azure_logs/index.ts
index 3c9438d9a6298..163496813567a 100644
--- a/src/plugins/home/server/tutorials/azure_logs/index.ts
+++ b/src/plugins/home/server/tutorials/azure_logs/index.ts
@@ -58,8 +58,8 @@ export function azureLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/azure_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['azure', 'cloud', 'network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/azure_metrics/index.ts b/src/plugins/home/server/tutorials/azure_metrics/index.ts
index 310f954104634..edf4062812b42 100644
--- a/src/plugins/home/server/tutorials/azure_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/azure_metrics/index.ts
@@ -57,8 +57,8 @@ export function azureMetricsSpecProvider(context: TutorialContext): TutorialSche
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/azure_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['azure', 'cloud', 'network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/barracuda_logs/index.ts b/src/plugins/home/server/tutorials/barracuda_logs/index.ts
index cdfd75b9728b9..7cf333ec6f7e5 100644
--- a/src/plugins/home/server/tutorials/barracuda_logs/index.ts
+++ b/src/plugins/home/server/tutorials/barracuda_logs/index.ts
@@ -55,8 +55,8 @@ export function barracudaLogsSpecProvider(context: TutorialContext): TutorialSch
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/bluecoat_logs/index.ts b/src/plugins/home/server/tutorials/bluecoat_logs/index.ts
index a7db5b04ee40d..f35cd0ac4e450 100644
--- a/src/plugins/home/server/tutorials/bluecoat_logs/index.ts
+++ b/src/plugins/home/server/tutorials/bluecoat_logs/index.ts
@@ -54,8 +54,8 @@ export function bluecoatLogsSpecProvider(context: TutorialContext): TutorialSche
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/cef_logs/index.ts b/src/plugins/home/server/tutorials/cef_logs/index.ts
index 1366198d610d7..bf1f402a09a65 100644
--- a/src/plugins/home/server/tutorials/cef_logs/index.ts
+++ b/src/plugins/home/server/tutorials/cef_logs/index.ts
@@ -61,8 +61,8 @@ export function cefLogsSpecProvider(context: TutorialContext): TutorialSchema {
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/ceph_metrics/index.ts b/src/plugins/home/server/tutorials/ceph_metrics/index.ts
index 6a53789d26f7c..e7d2c67ec2a99 100644
--- a/src/plugins/home/server/tutorials/ceph_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/ceph_metrics/index.ts
@@ -54,8 +54,8 @@ export function cephMetricsSpecProvider(context: TutorialContext): TutorialSchem
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/checkpoint_logs/index.ts b/src/plugins/home/server/tutorials/checkpoint_logs/index.ts
index b5ea6be42403b..83ce8d27ec861 100644
--- a/src/plugins/home/server/tutorials/checkpoint_logs/index.ts
+++ b/src/plugins/home/server/tutorials/checkpoint_logs/index.ts
@@ -54,8 +54,8 @@ export function checkpointLogsSpecProvider(context: TutorialContext): TutorialSc
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/cisco_logs/index.ts b/src/plugins/home/server/tutorials/cisco_logs/index.ts
index 922cfbf1e23ee..3c855996873af 100644
--- a/src/plugins/home/server/tutorials/cisco_logs/index.ts
+++ b/src/plugins/home/server/tutorials/cisco_logs/index.ts
@@ -57,8 +57,8 @@ export function ciscoLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/cisco_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts b/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts
index 5564d11be4d19..a4172fae4ff4d 100644
--- a/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts
+++ b/src/plugins/home/server/tutorials/cloudwatch_logs/index.ts
@@ -51,8 +51,8 @@ export function cloudwatchLogsSpecProvider(context: TutorialContext): TutorialSc
},
completionTimeMinutes: 10,
onPrem: onPremInstructions([], context),
- elasticCloud: cloudInstructions(),
- onPremElasticCloud: onPremCloudInstructions(),
+ elasticCloud: cloudInstructions(context),
+ onPremElasticCloud: onPremCloudInstructions(context),
integrationBrowserCategories: ['aws', 'cloud', 'datastore', 'security', 'network'],
};
}
diff --git a/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts b/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts
index 535c8aaa90768..d53fd7f1f73aa 100644
--- a/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/cockroachdb_metrics/index.ts
@@ -59,8 +59,8 @@ export function cockroachdbMetricsSpecProvider(context: TutorialContext): Tutori
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/cockroachdb_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/consul_metrics/index.ts b/src/plugins/home/server/tutorials/consul_metrics/index.ts
index ca7179d55fd89..26fff9e58f511 100644
--- a/src/plugins/home/server/tutorials/consul_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/consul_metrics/index.ts
@@ -56,8 +56,8 @@ export function consulMetricsSpecProvider(context: TutorialContext): TutorialSch
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/consul_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/coredns_logs/index.ts b/src/plugins/home/server/tutorials/coredns_logs/index.ts
index 1261c67135001..876e6e09d61d6 100644
--- a/src/plugins/home/server/tutorials/coredns_logs/index.ts
+++ b/src/plugins/home/server/tutorials/coredns_logs/index.ts
@@ -57,8 +57,8 @@ export function corednsLogsSpecProvider(context: TutorialContext): TutorialSchem
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/coredns_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/coredns_metrics/index.ts b/src/plugins/home/server/tutorials/coredns_metrics/index.ts
index 3abc14314a6ba..b854f4d448361 100644
--- a/src/plugins/home/server/tutorials/coredns_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/coredns_metrics/index.ts
@@ -54,8 +54,8 @@ export function corednsMetricsSpecProvider(context: TutorialContext): TutorialSc
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/coredns_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/couchbase_metrics/index.ts b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts
index 5c29aa2d9a524..2a71a6d0457f1 100644
--- a/src/plugins/home/server/tutorials/couchbase_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts
@@ -54,8 +54,8 @@ export function couchbaseMetricsSpecProvider(context: TutorialContext): Tutorial
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/couchdb_metrics/index.ts b/src/plugins/home/server/tutorials/couchdb_metrics/index.ts
index 00bea11d13d99..a379b3b04f4c7 100644
--- a/src/plugins/home/server/tutorials/couchdb_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/couchdb_metrics/index.ts
@@ -59,8 +59,8 @@ export function couchdbMetricsSpecProvider(context: TutorialContext): TutorialSc
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/couchdb_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security', 'network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/crowdstrike_logs/index.ts b/src/plugins/home/server/tutorials/crowdstrike_logs/index.ts
index a48ed4288210b..2c5a32b63f75f 100644
--- a/src/plugins/home/server/tutorials/crowdstrike_logs/index.ts
+++ b/src/plugins/home/server/tutorials/crowdstrike_logs/index.ts
@@ -58,8 +58,8 @@ export function crowdstrikeLogsSpecProvider(context: TutorialContext): TutorialS
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/cylance_logs/index.ts b/src/plugins/home/server/tutorials/cylance_logs/index.ts
index 64b79a41cd2e0..d8b72963678fa 100644
--- a/src/plugins/home/server/tutorials/cylance_logs/index.ts
+++ b/src/plugins/home/server/tutorials/cylance_logs/index.ts
@@ -54,8 +54,8 @@ export function cylanceLogsSpecProvider(context: TutorialContext): TutorialSchem
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/docker_metrics/index.ts b/src/plugins/home/server/tutorials/docker_metrics/index.ts
index ab80e6d644dbc..e36d590650454 100644
--- a/src/plugins/home/server/tutorials/docker_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/docker_metrics/index.ts
@@ -56,8 +56,8 @@ export function dockerMetricsSpecProvider(context: TutorialContext): TutorialSch
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/docker_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['containers', 'os_system'],
};
}
diff --git a/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts
index 9864d376966bb..f01119e6ba1d2 100644
--- a/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts
@@ -54,8 +54,8 @@ export function dropwizardMetricsSpecProvider(context: TutorialContext): Tutoria
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['elastic_stack', 'datastore'],
};
}
diff --git a/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts
index 6415781d02c06..a1df2d8a4085e 100644
--- a/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts
+++ b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts
@@ -56,8 +56,8 @@ export function elasticsearchLogsSpecProvider(context: TutorialContext): Tutoria
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/elasticsearch_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['containers', 'os_system'],
};
}
diff --git a/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts
index 3961d7f78c86c..009e441c725d9 100644
--- a/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts
@@ -54,8 +54,8 @@ export function elasticsearchMetricsSpecProvider(context: TutorialContext): Tuto
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['elastic_stack', 'datastore'],
};
}
diff --git a/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts b/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts
index 55c85a5bdd2a4..d39b182b81eaf 100644
--- a/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts
+++ b/src/plugins/home/server/tutorials/envoyproxy_logs/index.ts
@@ -60,8 +60,8 @@ export function envoyproxyLogsSpecProvider(context: TutorialContext): TutorialSc
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/envoyproxy_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['elastic_stack', 'datastore'],
};
}
diff --git a/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts b/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts
index e2f3b84739685..84ea8099e3d93 100644
--- a/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/envoyproxy_metrics/index.ts
@@ -47,8 +47,8 @@ export function envoyproxyMetricsSpecProvider(context: TutorialContext): Tutoria
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['elastic_stack', 'datastore'],
};
}
diff --git a/src/plugins/home/server/tutorials/etcd_metrics/index.ts b/src/plugins/home/server/tutorials/etcd_metrics/index.ts
index 9ed153c21c257..c4c68e80d40eb 100644
--- a/src/plugins/home/server/tutorials/etcd_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/etcd_metrics/index.ts
@@ -54,8 +54,8 @@ export function etcdMetricsSpecProvider(context: TutorialContext): TutorialSchem
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['elastic_stack', 'datastore'],
};
}
diff --git a/src/plugins/home/server/tutorials/f5_logs/index.ts b/src/plugins/home/server/tutorials/f5_logs/index.ts
index a407d1d3d5142..381fdd487eb24 100644
--- a/src/plugins/home/server/tutorials/f5_logs/index.ts
+++ b/src/plugins/home/server/tutorials/f5_logs/index.ts
@@ -55,8 +55,8 @@ export function f5LogsSpecProvider(context: TutorialContext): TutorialSchema {
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/f5_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/fortinet_logs/index.ts b/src/plugins/home/server/tutorials/fortinet_logs/index.ts
index 2f6af3ba47280..6a73c5f8e3f66 100644
--- a/src/plugins/home/server/tutorials/fortinet_logs/index.ts
+++ b/src/plugins/home/server/tutorials/fortinet_logs/index.ts
@@ -54,8 +54,8 @@ export function fortinetLogsSpecProvider(context: TutorialContext): TutorialSche
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/gcp_logs/index.ts b/src/plugins/home/server/tutorials/gcp_logs/index.ts
index 23d8e3364eb69..d02c08cd2be9a 100644
--- a/src/plugins/home/server/tutorials/gcp_logs/index.ts
+++ b/src/plugins/home/server/tutorials/gcp_logs/index.ts
@@ -59,8 +59,8 @@ export function gcpLogsSpecProvider(context: TutorialContext): TutorialSchema {
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/gcp_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['google_cloud', 'cloud', 'network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/gcp_metrics/index.ts b/src/plugins/home/server/tutorials/gcp_metrics/index.ts
index 7f397c1e1be7b..ea5351d010a42 100644
--- a/src/plugins/home/server/tutorials/gcp_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/gcp_metrics/index.ts
@@ -57,8 +57,8 @@ export function gcpMetricsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/gcp_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['google_cloud', 'cloud', 'network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/golang_metrics/index.ts b/src/plugins/home/server/tutorials/golang_metrics/index.ts
index 50d09e42e8791..e179e69734ad5 100644
--- a/src/plugins/home/server/tutorials/golang_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/golang_metrics/index.ts
@@ -57,8 +57,8 @@ export function golangMetricsSpecProvider(context: TutorialContext): TutorialSch
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['google_cloud', 'cloud', 'network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/gsuite_logs/index.ts b/src/plugins/home/server/tutorials/gsuite_logs/index.ts
index 718558321cf78..ba193bdb08c08 100644
--- a/src/plugins/home/server/tutorials/gsuite_logs/index.ts
+++ b/src/plugins/home/server/tutorials/gsuite_logs/index.ts
@@ -54,8 +54,8 @@ export function gsuiteLogsSpecProvider(context: TutorialContext): TutorialSchema
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/haproxy_logs/index.ts b/src/plugins/home/server/tutorials/haproxy_logs/index.ts
index c3765317ecbe0..05fc23fa16bcd 100644
--- a/src/plugins/home/server/tutorials/haproxy_logs/index.ts
+++ b/src/plugins/home/server/tutorials/haproxy_logs/index.ts
@@ -57,8 +57,8 @@ export function haproxyLogsSpecProvider(context: TutorialContext): TutorialSchem
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/haproxy_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/haproxy_metrics/index.ts b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts
index 49f1d32dc4c82..fa7c451889ba3 100644
--- a/src/plugins/home/server/tutorials/haproxy_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts
@@ -54,8 +54,8 @@ export function haproxyMetricsSpecProvider(context: TutorialContext): TutorialSc
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['network', 'web'],
};
}
diff --git a/src/plugins/home/server/tutorials/ibmmq_logs/index.ts b/src/plugins/home/server/tutorials/ibmmq_logs/index.ts
index 21b60a9ab5a5c..90b35d0e78842 100644
--- a/src/plugins/home/server/tutorials/ibmmq_logs/index.ts
+++ b/src/plugins/home/server/tutorials/ibmmq_logs/index.ts
@@ -56,8 +56,8 @@ export function ibmmqLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/ibmmq_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts
index 706003f0eab48..6329df6836b06 100644
--- a/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts
@@ -55,8 +55,8 @@ export function ibmmqMetricsSpecProvider(context: TutorialContext): TutorialSche
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/ibmmq_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/icinga_logs/index.ts b/src/plugins/home/server/tutorials/icinga_logs/index.ts
index dc730022262c2..c65e92d0fe856 100644
--- a/src/plugins/home/server/tutorials/icinga_logs/index.ts
+++ b/src/plugins/home/server/tutorials/icinga_logs/index.ts
@@ -57,8 +57,8 @@ export function icingaLogsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/icinga_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['security'],
};
}
diff --git a/src/plugins/home/server/tutorials/iis_logs/index.ts b/src/plugins/home/server/tutorials/iis_logs/index.ts
index 0dbc5bbdc75b8..423f2f917c84e 100644
--- a/src/plugins/home/server/tutorials/iis_logs/index.ts
+++ b/src/plugins/home/server/tutorials/iis_logs/index.ts
@@ -58,8 +58,8 @@ export function iisLogsSpecProvider(context: TutorialContext): TutorialSchema {
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/iis_logs/screenshot.png',
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/iis_metrics/index.ts b/src/plugins/home/server/tutorials/iis_metrics/index.ts
index d57e4688ba753..3c3159c2838d1 100644
--- a/src/plugins/home/server/tutorials/iis_metrics/index.ts
+++ b/src/plugins/home/server/tutorials/iis_metrics/index.ts
@@ -57,8 +57,8 @@ export function iisMetricsSpecProvider(context: TutorialContext): TutorialSchema
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/iis_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
- elasticCloud: cloudInstructions(moduleName),
- onPremElasticCloud: onPremCloudInstructions(moduleName),
+ elasticCloud: cloudInstructions(moduleName, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, context),
integrationBrowserCategories: ['web'],
};
}
diff --git a/src/plugins/home/server/tutorials/imperva_logs/index.ts b/src/plugins/home/server/tutorials/imperva_logs/index.ts
index 1cbe707f813ee..35e0a668ec7f0 100644
--- a/src/plugins/home/server/tutorials/imperva_logs/index.ts
+++ b/src/plugins/home/server/tutorials/imperva_logs/index.ts
@@ -54,8 +54,8 @@ export function impervaLogsSpecProvider(context: TutorialContext): TutorialSchem
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network', 'security'],
};
}
diff --git a/src/plugins/home/server/tutorials/infoblox_logs/index.ts b/src/plugins/home/server/tutorials/infoblox_logs/index.ts
index 8dce2bf00b2e2..21d1fcf9a156c 100644
--- a/src/plugins/home/server/tutorials/infoblox_logs/index.ts
+++ b/src/plugins/home/server/tutorials/infoblox_logs/index.ts
@@ -54,8 +54,8 @@ export function infobloxLogsSpecProvider(context: TutorialContext): TutorialSche
},
completionTimeMinutes: 10,
onPrem: onPremInstructions(moduleName, platforms, context),
- elasticCloud: cloudInstructions(moduleName, platforms),
- onPremElasticCloud: onPremCloudInstructions(moduleName, platforms),
+ elasticCloud: cloudInstructions(moduleName, platforms, context),
+ onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context),
integrationBrowserCategories: ['network'],
};
}
diff --git a/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts b/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts
index d0a0f97e26037..3968aff312380 100644
--- a/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts
+++ b/src/plugins/home/server/tutorials/instructions/auditbeat_instructions.ts
@@ -13,271 +13,317 @@ import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';
-export const createAuditbeatInstructions = (context?: TutorialContext) => ({
- INSTALL: {
- OSX: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTitle', {
- defaultMessage: 'Download and install Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTextPre', {
- defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'tar xzvf auditbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'cd auditbeat-{config.kibana.version}-darwin-x86_64/',
- ],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTitle', {
- defaultMessage: 'Download and install Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTextPre', {
- defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-amd64.deb',
- 'sudo dpkg -i auditbeat-{config.kibana.version}-amd64.deb',
- ],
- textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
- values: {
- linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
- },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTitle', {
- defaultMessage: 'Download and install Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTextPre', {
- defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-x86_64.rpm',
- 'sudo rpm -vi auditbeat-{config.kibana.version}-x86_64.rpm',
- ],
- textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
- values: {
- linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
- },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.windowsTitle', {
- defaultMessage: 'Download and install Auditbeat',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.auditbeatInstructions.install.windowsTextPre',
- {
- defaultMessage:
- 'First time using Auditbeat? See the [Quick Start]({guideLinkUrl}).\n\
+export const createAuditbeatInstructions = (context: TutorialContext) => {
+ const SSL_DOC_URL = `https://www.elastic.co/guide/en/beats/auditbeat/${context.kibanaBranch}/configuration-ssl.html#ca-sha256`;
+
+ return {
+ INSTALL: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTitle', {
+ defaultMessage: 'Download and install Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.osxTextPre', {
+ defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'tar xzvf auditbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'cd auditbeat-{config.kibana.version}-darwin-x86_64/',
+ ],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTitle', {
+ defaultMessage: 'Download and install Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.debTextPre', {
+ defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-amd64.deb',
+ 'sudo dpkg -i auditbeat-{config.kibana.version}-amd64.deb',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.install.debTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
+ values: {
+ linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
+ },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTitle', {
+ defaultMessage: 'Download and install Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.install.rpmTextPre', {
+ defaultMessage: 'First time using Auditbeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/auditbeat/auditbeat-{config.kibana.version}-x86_64.rpm',
+ 'sudo rpm -vi auditbeat-{config.kibana.version}-x86_64.rpm',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.install.rpmTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
+ values: {
+ linkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
+ },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.install.windowsTitle', {
+ defaultMessage: 'Download and install Auditbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.install.windowsTextPre',
+ {
+ defaultMessage:
+ 'First time using Auditbeat? See the [Quick Start]({guideLinkUrl}).\n\
1. Download the Auditbeat Windows zip file from the [Download]({auditbeatLinkUrl}) page.\n\
2. Extract the contents of the zip file into {folderPath}.\n\
3. Rename the `{directoryName}` directory to `Auditbeat`.\n\
4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \
**Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\
5. From the PowerShell prompt, run the following commands to install Auditbeat as a Windows service.',
+ values: {
+ folderPath: '`C:\\Program Files`',
+ guideLinkUrl:
+ '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
+ auditbeatLinkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
+ directoryName: 'auditbeat-{config.kibana.version}-windows',
+ },
+ }
+ ),
+ commands: ['cd "C:\\Program Files\\Auditbeat"', '.\\install-service-auditbeat.ps1'],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.install.windowsTextPost',
+ {
+ defaultMessage:
+ 'Modify the settings under {propertyName} in the {auditbeatPath} file to point to your Elasticsearch installation.',
+ values: {
+ propertyName: '`output.elasticsearch`',
+ auditbeatPath: '`C:\\Program Files\\Auditbeat\\auditbeat.yml`',
+ },
+ }
+ ),
+ },
+ },
+ START: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTitle', {
+ defaultMessage: 'Start Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['./auditbeat setup', './auditbeat -e'],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTitle', {
+ defaultMessage: 'Start Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['sudo auditbeat setup', 'sudo service auditbeat start'],
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTitle', {
+ defaultMessage: 'Start Auditbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['sudo auditbeat setup', 'sudo service auditbeat start'],
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.windowsTitle', {
+ defaultMessage: 'Start Auditbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.start.windowsTextPre',
+ {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }
+ ),
+ commands: ['.\\auditbeat.exe setup', 'Start-Service auditbeat'],
+ },
+ },
+ CONFIG: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- folderPath: '`C:\\Program Files`',
- guideLinkUrl: '{config.docs.beats.auditbeat}/auditbeat-installation-configuration.html',
- auditbeatLinkUrl: 'https://www.elastic.co/downloads/beats/auditbeat',
- directoryName: 'auditbeat-{config.kibana.version}-windows',
+ path: '`auditbeat.yml`',
},
- }
- ),
- commands: ['cd "C:\\Program Files\\Auditbeat"', '.\\install-service-auditbeat.ps1'],
- textPost: i18n.translate(
- 'home.tutorials.common.auditbeatInstructions.install.windowsTextPost',
- {
- defaultMessage:
- 'Modify the settings under {propertyName} in the {auditbeatPath} file to point to your Elasticsearch installation.',
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.config.osxTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- propertyName: '`output.elasticsearch`',
- auditbeatPath: '`C:\\Program Files\\Auditbeat\\auditbeat.yml`',
+ path: '`/etc/auditbeat/auditbeat.yml`',
},
- }
- ),
- },
- },
- START: {
- OSX: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTitle', {
- defaultMessage: 'Start Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.osxTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['./auditbeat setup', './auditbeat -e'],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTitle', {
- defaultMessage: 'Start Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.debTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo auditbeat setup', 'sudo service auditbeat start'],
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTitle', {
- defaultMessage: 'Start Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.rpmTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo auditbeat setup', 'sudo service auditbeat start'],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.start.windowsTitle', {
- defaultMessage: 'Start Auditbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.start.windowsTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['.\\auditbeat.exe setup', 'Start-Service auditbeat'],
- },
- },
- CONFIG: {
- OSX: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`auditbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.osxTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/auditbeat/auditbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.debTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/auditbeat/auditbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.windowsTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.windowsTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`C:\\Program Files\\Auditbeat\\auditbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate(
- 'home.tutorials.common.auditbeatInstructions.config.windowsTextPost',
- {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.config.debTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.auditbeatInstructions.config.rpmTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
+ path: '`/etc/auditbeat/auditbeat.yml`',
},
- }
- ),
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.config.rpmTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.auditbeatInstructions.config.windowsTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.config.windowsTextPre',
+ {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`C:\\Program Files\\Auditbeat\\auditbeat.yml`',
+ },
+ }
+ ),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.auditbeatInstructions.config.windowsTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
},
- },
-});
+ };
+};
export const createAuditbeatCloudInstructions = () => ({
CONFIG: {
@@ -383,7 +429,7 @@ export function auditbeatStatusCheck() {
};
}
-export function onPremInstructions(platforms: readonly Platform[], context?: TutorialContext) {
+export function onPremInstructions(platforms: readonly Platform[], context: TutorialContext) {
const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(context);
const variants = [];
@@ -414,8 +460,8 @@ export function onPremInstructions(platforms: readonly Platform[], context?: Tut
};
}
-export function onPremCloudInstructions(platforms: readonly Platform[]) {
- const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions();
+export function onPremCloudInstructions(platforms: readonly Platform[], context: TutorialContext) {
+ const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(context);
const TRYCLOUD_OPTION1 = createTrycloudOption1();
const TRYCLOUD_OPTION2 = createTrycloudOption2();
@@ -450,8 +496,8 @@ export function onPremCloudInstructions(platforms: readonly Platform[]) {
};
}
-export function cloudInstructions(platforms: readonly Platform[]) {
- const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions();
+export function cloudInstructions(platforms: readonly Platform[], context: TutorialContext) {
+ const AUDITBEAT_INSTRUCTIONS = createAuditbeatInstructions(context);
const AUDITBEAT_CLOUD_INSTRUCTIONS = createAuditbeatCloudInstructions();
const variants = [];
diff --git a/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts b/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts
index c6aa44932ee45..89445510f2b3d 100644
--- a/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts
+++ b/src/plugins/home/server/tutorials/instructions/filebeat_instructions.ts
@@ -13,268 +13,307 @@ import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';
-export const createFilebeatInstructions = (context?: TutorialContext) => ({
- INSTALL: {
- OSX: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTitle', {
- defaultMessage: 'Download and install Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTextPre', {
- defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'cd filebeat-{config.kibana.version}-darwin-x86_64/',
- ],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTitle', {
- defaultMessage: 'Download and install Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPre', {
- defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb',
- 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb',
- ],
- textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
- values: {
- linkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
- },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTitle', {
- defaultMessage: 'Download and install Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPre', {
- defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
- values: {
- linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm',
- 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm',
- ],
- textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
- values: {
- linkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
- },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.install.windowsTitle', {
- defaultMessage: 'Download and install Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.windowsTextPre', {
- defaultMessage:
- 'First time using Filebeat? See the [Quick Start]({guideLinkUrl}).\n\
+export const createFilebeatInstructions = (context: TutorialContext) => {
+ const SSL_DOC_URL = `https://www.elastic.co/guide/en/beats/filebeat/${context.kibanaBranch}/configuration-ssl.html#ca-sha256`;
+
+ return {
+ INSTALL: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTitle', {
+ defaultMessage: 'Download and install Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.osxTextPre', {
+ defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'tar xzvf filebeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'cd filebeat-{config.kibana.version}-darwin-x86_64/',
+ ],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTitle', {
+ defaultMessage: 'Download and install Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPre', {
+ defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-amd64.deb',
+ 'sudo dpkg -i filebeat-{config.kibana.version}-amd64.deb',
+ ],
+ textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.debTextPost', {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
+ values: {
+ linkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
+ },
+ }),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTitle', {
+ defaultMessage: 'Download and install Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPre', {
+ defaultMessage: 'First time using Filebeat? See the [Quick Start]({linkUrl}).',
+ values: {
+ linkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-{config.kibana.version}-x86_64.rpm',
+ 'sudo rpm -vi filebeat-{config.kibana.version}-x86_64.rpm',
+ ],
+ textPost: i18n.translate('home.tutorials.common.filebeatInstructions.install.rpmTextPost', {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({linkUrl}).',
+ values: {
+ linkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
+ },
+ }),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.install.windowsTitle', {
+ defaultMessage: 'Download and install Filebeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.install.windowsTextPre',
+ {
+ defaultMessage:
+ 'First time using Filebeat? See the [Quick Start]({guideLinkUrl}).\n\
1. Download the Filebeat Windows zip file from the [Download]({filebeatLinkUrl}) page.\n\
2. Extract the contents of the zip file into {folderPath}.\n\
3. Rename the `{directoryName}` directory to `Filebeat`.\n\
4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \
**Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\
5. From the PowerShell prompt, run the following commands to install Filebeat as a Windows service.',
- values: {
- folderPath: '`C:\\Program Files`',
- guideLinkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
- filebeatLinkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
- directoryName: 'filebeat-{config.kibana.version}-windows',
- },
- }),
- commands: ['cd "C:\\Program Files\\Filebeat"', '.\\install-service-filebeat.ps1'],
- textPost: i18n.translate(
- 'home.tutorials.common.filebeatInstructions.install.windowsTextPost',
- {
+ values: {
+ folderPath: '`C:\\Program Files`',
+ guideLinkUrl: '{config.docs.beats.filebeat}/filebeat-installation-configuration.html',
+ filebeatLinkUrl: 'https://www.elastic.co/downloads/beats/filebeat',
+ directoryName: 'filebeat-{config.kibana.version}-windows',
+ },
+ }
+ ),
+ commands: ['cd "C:\\Program Files\\Filebeat"', '.\\install-service-filebeat.ps1'],
+ textPost: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.install.windowsTextPost',
+ {
+ defaultMessage:
+ 'Modify the settings under {propertyName} in the {filebeatPath} file to point to your Elasticsearch installation.',
+ values: {
+ propertyName: '`output.elasticsearch`',
+ filebeatPath: '`C:\\Program Files\\Filebeat\\filebeat.yml`',
+ },
+ }
+ ),
+ },
+ },
+ START: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTitle', {
+ defaultMessage: 'Start Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['./filebeat setup', './filebeat -e'],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTitle', {
+ defaultMessage: 'Start Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['sudo filebeat setup', 'sudo service filebeat start'],
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTitle', {
+ defaultMessage: 'Start Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTextPre', {
defaultMessage:
- 'Modify the settings under {propertyName} in the {filebeatPath} file to point to your Elasticsearch installation.',
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['sudo filebeat setup', 'sudo service filebeat start'],
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTitle', {
+ defaultMessage: 'Start Filebeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTextPre', {
+ defaultMessage:
+ 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
+ }),
+ commands: ['.\\filebeat.exe setup', 'Start-Service filebeat'],
+ },
+ },
+ CONFIG: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- propertyName: '`output.elasticsearch`',
- filebeatPath: '`C:\\Program Files\\Filebeat\\filebeat.yml`',
+ path: '`filebeat.yml`',
},
- }
- ),
- },
- },
- START: {
- OSX: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTitle', {
- defaultMessage: 'Start Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.osxTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['./filebeat setup', './filebeat -e'],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTitle', {
- defaultMessage: 'Start Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.debTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo filebeat setup', 'sudo service filebeat start'],
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTitle', {
- defaultMessage: 'Start Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.rpmTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo filebeat setup', 'sudo service filebeat start'],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTitle', {
- defaultMessage: 'Start Filebeat',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.start.windowsTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['.\\filebeat.exe setup', 'Start-Service filebeat'],
- },
- },
- CONFIG: {
- OSX: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`filebeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.osxTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/filebeat/filebeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/filebeat/filebeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.filebeatInstructions.config.windowsTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.windowsTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`C:\\Program Files\\Filebeat\\filebeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate(
- 'home.tutorials.common.filebeatInstructions.config.windowsTextPost',
- {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.config.osxTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.debTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
+ path: '`/etc/filebeat/filebeat.yml`',
},
- }
- ),
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.config.debTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.filebeatInstructions.config.rpmTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`/etc/filebeat/filebeat.yml`',
+ },
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.config.rpmTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.filebeatInstructions.config.windowsTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.config.windowsTextPre',
+ {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`C:\\Program Files\\Filebeat\\filebeat.yml`',
+ },
+ }
+ ),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.filebeatInstructions.config.windowsTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
},
- },
-});
+ };
+};
export const createFilebeatCloudInstructions = () => ({
CONFIG: {
@@ -430,7 +469,7 @@ export function filebeatStatusCheck(moduleName: string) {
export function onPremInstructions(
moduleName: string,
platforms: readonly Platform[] = [],
- context?: TutorialContext
+ context: TutorialContext
) {
const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(context);
@@ -463,8 +502,12 @@ export function onPremInstructions(
};
}
-export function onPremCloudInstructions(moduleName: string, platforms: readonly Platform[] = []) {
- const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions();
+export function onPremCloudInstructions(
+ moduleName: string,
+ platforms: readonly Platform[] = [],
+ context: TutorialContext
+) {
+ const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(context);
const TRYCLOUD_OPTION1 = createTrycloudOption1();
const TRYCLOUD_OPTION2 = createTrycloudOption2();
@@ -500,8 +543,12 @@ export function onPremCloudInstructions(moduleName: string, platforms: readonly
};
}
-export function cloudInstructions(moduleName: string, platforms: readonly Platform[] = []) {
- const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions();
+export function cloudInstructions(
+ moduleName: string,
+ platforms: readonly Platform[] = [],
+ context: TutorialContext
+) {
+ const FILEBEAT_INSTRUCTIONS = createFilebeatInstructions(context);
const FILEBEAT_CLOUD_INSTRUCTIONS = createFilebeatCloudInstructions();
const variants = [];
diff --git a/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts b/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts
index 24a6fe3719f8f..60d6fa5cb813b 100644
--- a/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts
+++ b/src/plugins/home/server/tutorials/instructions/functionbeat_instructions.ts
@@ -13,171 +13,203 @@ import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';
-export const createFunctionbeatInstructions = (context?: TutorialContext) => ({
- INSTALL: {
- OSX: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.osxTitle', {
- defaultMessage: 'Download and install Functionbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.install.osxTextPre', {
- defaultMessage: 'First time using Functionbeat? See the [Quick Start]({link}).',
- values: {
- link: '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'tar xzvf functionbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'cd functionbeat-{config.kibana.version}-darwin-x86_64/',
- ],
- },
- LINUX: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.linuxTitle', {
- defaultMessage: 'Download and install Functionbeat',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.install.linuxTextPre',
- {
- defaultMessage: 'First time using Functionbeat? See the [Quick Start]({link}).',
- values: {
- link: '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
- },
- }
- ),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-{config.kibana.version}-linux-x86_64.tar.gz',
- 'tar xzvf functionbeat-{config.kibana.version}-linux-x86_64.tar.gz',
- 'cd functionbeat-{config.kibana.version}-linux-x86_64/',
- ],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.windowsTitle', {
- defaultMessage: 'Download and install Functionbeat',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.install.windowsTextPre',
- {
- defaultMessage:
- 'First time using Functionbeat? See the [Quick Start]({functionbeatLink}).\n\
+export const createFunctionbeatInstructions = (context: TutorialContext) => {
+ const SSL_DOC_URL = `https://www.elastic.co/guide/en/beats/functionbeat/${context.kibanaBranch}/configuration-ssl.html#ca-sha256`;
+
+ return {
+ INSTALL: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.osxTitle', {
+ defaultMessage: 'Download and install Functionbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.install.osxTextPre',
+ {
+ defaultMessage: 'First time using Functionbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
+ },
+ }
+ ),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'tar xzvf functionbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'cd functionbeat-{config.kibana.version}-darwin-x86_64/',
+ ],
+ },
+ LINUX: {
+ title: i18n.translate('home.tutorials.common.functionbeatInstructions.install.linuxTitle', {
+ defaultMessage: 'Download and install Functionbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.install.linuxTextPre',
+ {
+ defaultMessage: 'First time using Functionbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
+ },
+ }
+ ),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/functionbeat/functionbeat-{config.kibana.version}-linux-x86_64.tar.gz',
+ 'tar xzvf functionbeat-{config.kibana.version}-linux-x86_64.tar.gz',
+ 'cd functionbeat-{config.kibana.version}-linux-x86_64/',
+ ],
+ },
+ WINDOWS: {
+ title: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.install.windowsTitle',
+ {
+ defaultMessage: 'Download and install Functionbeat',
+ }
+ ),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.install.windowsTextPre',
+ {
+ defaultMessage:
+ 'First time using Functionbeat? See the [Quick Start]({functionbeatLink}).\n\
1. Download the Functionbeat Windows zip file from the [Download]({elasticLink}) page.\n\
2. Extract the contents of the zip file into {folderPath}.\n\
3. Rename the {directoryName} directory to `Functionbeat`.\n\
4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \
**Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\
5. From the PowerShell prompt, go to the Functionbeat directory:',
- values: {
- directoryName: '`functionbeat-{config.kibana.version}-windows`',
- folderPath: '`C:\\Program Files`',
- functionbeatLink:
- '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
- elasticLink: 'https://www.elastic.co/downloads/beats/functionbeat',
- },
- }
- ),
- commands: ['cd "C:\\Program Files\\Functionbeat"'],
+ values: {
+ directoryName: '`functionbeat-{config.kibana.version}-windows`',
+ folderPath: '`C:\\Program Files`',
+ functionbeatLink:
+ '{config.docs.beats.functionbeat}/functionbeat-installation-configuration.html',
+ elasticLink: 'https://www.elastic.co/downloads/beats/functionbeat',
+ },
+ }
+ ),
+ commands: ['cd "C:\\Program Files\\Functionbeat"'],
+ },
},
- },
- DEPLOY: {
- OSX_LINUX: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.osxTitle', {
- defaultMessage: 'Deploy Functionbeat to AWS Lambda',
- }),
- textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.osxTextPre', {
- defaultMessage:
- 'This installs Functionbeat as a Lambda function.\
+ DEPLOY: {
+ OSX_LINUX: {
+ title: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.osxTitle', {
+ defaultMessage: 'Deploy Functionbeat to AWS Lambda',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.deploy.osxTextPre',
+ {
+ defaultMessage:
+ 'This installs Functionbeat as a Lambda function.\
The `setup` command checks the Elasticsearch configuration and loads the \
Kibana index pattern. It is normally safe to omit this command.',
- }),
- commands: ['./functionbeat setup', './functionbeat deploy fn-cloudwatch-logs'],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.deploy.windowsTitle', {
- defaultMessage: 'Deploy Functionbeat to AWS Lambda',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.deploy.windowsTextPre',
- {
- defaultMessage:
- 'This installs Functionbeat as a Lambda function.\
+ }
+ ),
+ commands: ['./functionbeat setup', './functionbeat deploy fn-cloudwatch-logs'],
+ },
+ WINDOWS: {
+ title: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.deploy.windowsTitle',
+ {
+ defaultMessage: 'Deploy Functionbeat to AWS Lambda',
+ }
+ ),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.deploy.windowsTextPre',
+ {
+ defaultMessage:
+ 'This installs Functionbeat as a Lambda function.\
The `setup` command checks the Elasticsearch configuration and loads the \
Kibana index pattern. It is normally safe to omit this command.',
- }
- ),
- commands: ['.\\functionbeat.exe setup', '.\\functionbeat.exe deploy fn-cloudwatch-logs'],
- },
- },
- CONFIG: {
- OSX_LINUX: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.config.osxTitle', {
- defaultMessage: 'Configure the Elastic cluster',
- }),
- textPre: i18n.translate('home.tutorials.common.functionbeatInstructions.config.osxTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`functionbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.config.osxTextPost',
- {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }
- ),
+ }
+ ),
+ commands: ['.\\functionbeat.exe setup', '.\\functionbeat.exe deploy fn-cloudwatch-logs'],
+ },
},
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.functionbeatInstructions.config.windowsTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.config.windowsTextPre',
- {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`C:\\Program Files\\Functionbeat\\functionbeat.yml`',
- },
- }
- ),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate(
- 'home.tutorials.common.functionbeatInstructions.config.windowsTextPost',
- {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }
- ),
+ CONFIG: {
+ OSX_LINUX: {
+ title: i18n.translate('home.tutorials.common.functionbeatInstructions.config.osxTitle', {
+ defaultMessage: 'Configure the Elastic cluster',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.config.osxTextPre',
+ {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`functionbeat.yml`',
+ },
+ }
+ ),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.config.osxTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.config.windowsTitle',
+ {
+ defaultMessage: 'Edit the configuration',
+ }
+ ),
+ textPre: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.config.windowsTextPre',
+ {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`C:\\Program Files\\Functionbeat\\functionbeat.yml`',
+ },
+ }
+ ),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.functionbeatInstructions.config.windowsTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
},
- },
-});
+ };
+};
export const createFunctionbeatCloudInstructions = () => ({
CONFIG: {
@@ -336,7 +368,7 @@ export function functionbeatStatusCheck() {
};
}
-export function onPremInstructions(platforms: Platform[], context?: TutorialContext) {
+export function onPremInstructions(platforms: Platform[], context: TutorialContext) {
const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions(context);
return {
@@ -386,10 +418,10 @@ export function onPremInstructions(platforms: Platform[], context?: TutorialCont
};
}
-export function onPremCloudInstructions() {
+export function onPremCloudInstructions(context: TutorialContext) {
const TRYCLOUD_OPTION1 = createTrycloudOption1();
const TRYCLOUD_OPTION2 = createTrycloudOption2();
- const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions();
+ const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions(context);
return {
instructionSets: [
@@ -444,8 +476,8 @@ export function onPremCloudInstructions() {
};
}
-export function cloudInstructions() {
- const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions();
+export function cloudInstructions(context: TutorialContext) {
+ const FUNCTIONBEAT_INSTRUCTIONS = createFunctionbeatInstructions(context);
const FUNCTIONBEAT_CLOUD_INSTRUCTIONS = createFunctionbeatCloudInstructions();
return {
diff --git a/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts b/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts
index ce3e76a5f827e..5cbd1641bf09a 100644
--- a/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts
+++ b/src/plugins/home/server/tutorials/instructions/heartbeat_instructions.ts
@@ -13,247 +13,298 @@ import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { Platform, TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';
-export const createHeartbeatInstructions = (context?: TutorialContext) => ({
- INSTALL: {
- OSX: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTitle', {
- defaultMessage: 'Download and install Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTextPre', {
- defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
- values: { link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html' },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'tar xzvf heartbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'cd heartbeat-{config.kibana.version}-darwin-x86_64/',
- ],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTitle', {
- defaultMessage: 'Download and install Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPre', {
- defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
- values: { link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html' },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-amd64.deb',
- 'sudo dpkg -i heartbeat-{config.kibana.version}-amd64.deb',
- ],
- textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
- values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTitle', {
- defaultMessage: 'Download and install Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTextPre', {
- defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
- values: { link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html' },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-x86_64.rpm',
- 'sudo rpm -vi heartbeat-{config.kibana.version}-x86_64.rpm',
- ],
- textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
- values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.windowsTitle', {
- defaultMessage: 'Download and install Heartbeat',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.heartbeatInstructions.install.windowsTextPre',
- {
- defaultMessage:
- 'First time using Heartbeat? See the [Quick Start]({heartbeatLink}).\n\
+export const createHeartbeatInstructions = (context: TutorialContext) => {
+ const SSL_DOC_URL = `https://www.elastic.co/guide/en/beats/heartbeat/${context.kibanaBranch}/configuration-ssl.html#ca-sha256`;
+
+ return {
+ INSTALL: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTitle', {
+ defaultMessage: 'Download and install Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.osxTextPre', {
+ defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'tar xzvf heartbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'cd heartbeat-{config.kibana.version}-darwin-x86_64/',
+ ],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTitle', {
+ defaultMessage: 'Download and install Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.debTextPre', {
+ defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-amd64.deb',
+ 'sudo dpkg -i heartbeat-{config.kibana.version}-amd64.deb',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.install.debTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
+ values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTitle', {
+ defaultMessage: 'Download and install Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.install.rpmTextPre', {
+ defaultMessage: 'First time using Heartbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/heartbeat/heartbeat-{config.kibana.version}-x86_64.rpm',
+ 'sudo rpm -vi heartbeat-{config.kibana.version}-x86_64.rpm',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.install.debTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
+ values: { link: 'https://www.elastic.co/downloads/beats/heartbeat' },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.install.windowsTitle', {
+ defaultMessage: 'Download and install Heartbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.install.windowsTextPre',
+ {
+ defaultMessage:
+ 'First time using Heartbeat? See the [Quick Start]({heartbeatLink}).\n\
1. Download the Heartbeat Windows zip file from the [Download]({elasticLink}) page.\n\
2. Extract the contents of the zip file into {folderPath}.\n\
3. Rename the {directoryName} directory to `Heartbeat`.\n\
4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \
**Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\
5. From the PowerShell prompt, run the following commands to install Heartbeat as a Windows service.',
- values: {
- directoryName: '`heartbeat-{config.kibana.version}-windows`',
- folderPath: '`C:\\Program Files`',
- heartbeatLink:
- '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html',
- elasticLink: 'https://www.elastic.co/downloads/beats/heartbeat',
- },
- }
- ),
- commands: ['cd "C:\\Program Files\\Heartbeat"', '.\\install-service-heartbeat.ps1'],
- },
- },
- START: {
- OSX: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTitle', {
- defaultMessage: 'Start Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTextPre', {
- defaultMessage: 'The `setup` command loads the Kibana index pattern.',
- }),
- commands: ['./heartbeat setup', './heartbeat -e'],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTitle', {
- defaultMessage: 'Start Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTextPre', {
- defaultMessage: 'The `setup` command loads the Kibana index pattern.',
- }),
- commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'],
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTitle', {
- defaultMessage: 'Start Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTextPre', {
- defaultMessage: 'The `setup` command loads the Kibana index pattern.',
- }),
- commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.windowsTitle', {
- defaultMessage: 'Start Heartbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.windowsTextPre', {
- defaultMessage: 'The `setup` command loads the Kibana index pattern.',
- }),
- commands: ['.\\heartbeat.exe setup', 'Start-Service heartbeat'],
- },
- },
- CONFIG: {
- OSX: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`heartbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/heartbeat/heartbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
+ values: {
+ directoryName: '`heartbeat-{config.kibana.version}-windows`',
+ folderPath: '`C:\\Program Files`',
+ heartbeatLink:
+ '{config.docs.beats.heartbeat}/heartbeat-installation-configuration.html',
+ elasticLink: 'https://www.elastic.co/downloads/beats/heartbeat',
+ },
+ }
+ ),
+ commands: ['cd "C:\\Program Files\\Heartbeat"', '.\\install-service-heartbeat.ps1'],
+ },
},
- RPM: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`/etc/heartbeat/heartbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
- },
- }),
+ START: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTitle', {
+ defaultMessage: 'Start Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.osxTextPre', {
+ defaultMessage: 'The `setup` command loads the Kibana index pattern.',
+ }),
+ commands: ['./heartbeat setup', './heartbeat -e'],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTitle', {
+ defaultMessage: 'Start Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.debTextPre', {
+ defaultMessage: 'The `setup` command loads the Kibana index pattern.',
+ }),
+ commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'],
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTitle', {
+ defaultMessage: 'Start Heartbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.start.rpmTextPre', {
+ defaultMessage: 'The `setup` command loads the Kibana index pattern.',
+ }),
+ commands: ['sudo heartbeat setup', 'sudo service heartbeat-elastic start'],
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.start.windowsTitle', {
+ defaultMessage: 'Start Heartbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.start.windowsTextPre',
+ {
+ defaultMessage: 'The `setup` command loads the Kibana index pattern.',
+ }
+ ),
+ commands: ['.\\heartbeat.exe setup', 'Start-Service heartbeat'],
+ },
},
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.windowsTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.windowsTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`C:\\Program Files\\Heartbeat\\heartbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate(
- 'home.tutorials.common.heartbeatInstructions.config.windowsTextPost',
- {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
+ CONFIG: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.osxTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '``',
+ path: '`heartbeat.yml`',
},
- }
- ),
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.config.osxTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.debTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`/etc/heartbeat/heartbeat.yml`',
+ },
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.config.debTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate('home.tutorials.common.heartbeatInstructions.config.rpmTextPre', {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`/etc/heartbeat/heartbeat.yml`',
+ },
+ }),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.config.rpmTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.heartbeatInstructions.config.windowsTitle', {
+ defaultMessage: 'Edit the configuration',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.config.windowsTextPre',
+ {
+ defaultMessage: 'Modify {path} to set the connection information:',
+ values: {
+ path: '`C:\\Program Files\\Heartbeat\\heartbeat.yml`',
+ },
+ }
+ ),
+ commands: [
+ 'output.elasticsearch:',
+ ' hosts: [""]',
+ ' username: "elastic"',
+ ' password: ""',
+ " # If using Elasticsearch's default certificate",
+ ' ssl.ca_trusted_fingerprint: ""',
+ 'setup.kibana:',
+ ' host: ""',
+ getSpaceIdForBeatsTutorial(context),
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.heartbeatInstructions.config.windowsTextPostMarkdown',
+ {
+ defaultMessage:
+ 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of \
+ Elasticsearch, and {kibanaUrlTemplate} is the URL of Kibana. To [configure SSL]({configureSslUrl}) with the \
+ default certificate generated by Elasticsearch, add its fingerprint in {esCertFingerprintTemplate}.',
+ values: {
+ passwordTemplate: '``',
+ esUrlTemplate: '``',
+ kibanaUrlTemplate: '``',
+ configureSslUrl: SSL_DOC_URL,
+ esCertFingerprintTemplate: '``',
+ },
+ }
+ ),
+ },
},
- },
-});
+ };
+};
export const createHeartbeatCloudInstructions = () => ({
CONFIG: {
@@ -486,7 +537,7 @@ export function heartbeatStatusCheck() {
};
}
-export function onPremInstructions(platforms: Platform[], context?: TutorialContext) {
+export function onPremInstructions(platforms: Platform[], context: TutorialContext) {
const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions(context);
return {
@@ -542,10 +593,10 @@ export function onPremInstructions(platforms: Platform[], context?: TutorialCont
};
}
-export function onPremCloudInstructions() {
+export function onPremCloudInstructions(context: TutorialContext) {
const TRYCLOUD_OPTION1 = createTrycloudOption1();
const TRYCLOUD_OPTION2 = createTrycloudOption2();
- const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions();
+ const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions(context);
return {
instructionSets: [
@@ -608,8 +659,8 @@ export function onPremCloudInstructions() {
};
}
-export function cloudInstructions() {
- const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions();
+export function cloudInstructions(context: TutorialContext) {
+ const HEARTBEAT_INSTRUCTIONS = createHeartbeatInstructions(context);
const HEARTBEAT_CLOUD_INSTRUCTIONS = createHeartbeatCloudInstructions();
return {
diff --git a/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts b/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts
index d6f2fcb232f12..02cd53dddbc1f 100644
--- a/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts
+++ b/src/plugins/home/server/tutorials/instructions/metricbeat_instructions.ts
@@ -13,268 +13,310 @@ import { getSpaceIdForBeatsTutorial } from './get_space_id_for_beats_tutorial';
import { TutorialContext } from '../../services/tutorials/lib/tutorials_registry_types';
import { cloudPasswordAndResetLink } from './cloud_instructions';
-export const createMetricbeatInstructions = (context?: TutorialContext) => ({
- INSTALL: {
- OSX: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTitle', {
- defaultMessage: 'Download and install Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTextPre', {
- defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
- values: {
- link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
- 'cd metricbeat-{config.kibana.version}-darwin-x86_64/',
- ],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTitle', {
- defaultMessage: 'Download and install Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPre', {
- defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
- values: {
- link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb',
- 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb',
- ],
- textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
- values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' },
- }),
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTitle', {
- defaultMessage: 'Download and install Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTextPre', {
- defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
- values: {
- link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
- },
- }),
- commands: [
- 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm',
- 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm',
- ],
- textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPost', {
- defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
- values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' },
- }),
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.windowsTitle', {
- defaultMessage: 'Download and install Metricbeat',
- }),
- textPre: i18n.translate(
- 'home.tutorials.common.metricbeatInstructions.install.windowsTextPre',
- {
- defaultMessage:
- 'First time using Metricbeat? See the [Quick Start]({metricbeatLink}).\n\
+export const createMetricbeatInstructions = (context: TutorialContext) => {
+ const SSL_DOC_URL = `https://www.elastic.co/guide/en/beats/metricbeat/${context.kibanaBranch}/configuration-ssl.html#ca-sha256`;
+
+ return {
+ INSTALL: {
+ OSX: {
+ title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTitle', {
+ defaultMessage: 'Download and install Metricbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.osxTextPre', {
+ defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'tar xzvf metricbeat-{config.kibana.version}-darwin-x86_64.tar.gz',
+ 'cd metricbeat-{config.kibana.version}-darwin-x86_64/',
+ ],
+ },
+ DEB: {
+ title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTitle', {
+ defaultMessage: 'Download and install Metricbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.debTextPre', {
+ defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-amd64.deb',
+ 'sudo dpkg -i metricbeat-{config.kibana.version}-amd64.deb',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.metricbeatInstructions.install.debTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
+ values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' },
+ }
+ ),
+ },
+ RPM: {
+ title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTitle', {
+ defaultMessage: 'Download and install Metricbeat',
+ }),
+ textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.install.rpmTextPre', {
+ defaultMessage: 'First time using Metricbeat? See the [Quick Start]({link}).',
+ values: {
+ link: '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
+ },
+ }),
+ commands: [
+ 'curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{config.kibana.version}-x86_64.rpm',
+ 'sudo rpm -vi metricbeat-{config.kibana.version}-x86_64.rpm',
+ ],
+ textPost: i18n.translate(
+ 'home.tutorials.common.metricbeatInstructions.install.debTextPost',
+ {
+ defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({link}).',
+ values: { link: 'https://www.elastic.co/downloads/beats/metricbeat' },
+ }
+ ),
+ },
+ WINDOWS: {
+ title: i18n.translate('home.tutorials.common.metricbeatInstructions.install.windowsTitle', {
+ defaultMessage: 'Download and install Metricbeat',
+ }),
+ textPre: i18n.translate(
+ 'home.tutorials.common.metricbeatInstructions.install.windowsTextPre',
+ {
+ defaultMessage:
+ 'First time using Metricbeat? See the [Quick Start]({metricbeatLink}).\n\
1. Download the Metricbeat Windows zip file from the [Download]({elasticLink}) page.\n\
2. Extract the contents of the zip file into {folderPath}.\n\
3. Rename the {directoryName} directory to `Metricbeat`.\n\
4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select \
**Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n\
5. From the PowerShell prompt, run the following commands to install Metricbeat as a Windows service.',
- values: {
- directoryName: '`metricbeat-{config.kibana.version}-windows`',
- folderPath: '`C:\\Program Files`',
- metricbeatLink:
- '{config.docs.beats.metricbeat}/metricbeat-installation-configuration.html',
- elasticLink: 'https://www.elastic.co/downloads/beats/metricbeat',
- },
- }
- ),
- commands: ['cd "C:\\Program Files\\Metricbeat"', '.\\install-service-metricbeat.ps1'],
- textPost: i18n.translate(
- 'home.tutorials.common.metricbeatInstructions.install.windowsTextPost',
- {
- defaultMessage:
- 'Modify the settings under `output.elasticsearch` in the {path} file to point to your Elasticsearch installation.',
- values: { path: '`C:\\Program Files\\Metricbeat\\metricbeat.yml`' },
- }
- ),
- },
- },
- START: {
- OSX: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.osxTitle', {
- defaultMessage: 'Start Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.osxTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['./metricbeat setup', './metricbeat -e'],
- },
- DEB: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.debTitle', {
- defaultMessage: 'Start Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.debTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo metricbeat setup', 'sudo service metricbeat start'],
- },
- RPM: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.rpmTitle', {
- defaultMessage: 'Start Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.rpmTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['sudo metricbeat setup', 'sudo service metricbeat start'],
- },
- WINDOWS: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.start.windowsTitle', {
- defaultMessage: 'Start Metricbeat',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.start.windowsTextPre', {
- defaultMessage:
- 'The `setup` command loads the Kibana dashboards. If the dashboards are already set up, omit this command.',
- }),
- commands: ['.\\metricbeat.exe setup', 'Start-Service metricbeat'],
- },
- },
- CONFIG: {
- OSX: {
- title: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTitle', {
- defaultMessage: 'Edit the configuration',
- }),
- textPre: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTextPre', {
- defaultMessage: 'Modify {path} to set the connection information:',
- values: {
- path: '`metricbeat.yml`',
- },
- }),
- commands: [
- 'output.elasticsearch:',
- ' hosts: [""]',
- ' username: "elastic"',
- ' password: ""',
- 'setup.kibana:',
- ' host: ""',
- getSpaceIdForBeatsTutorial(context),
- ],
- textPost: i18n.translate('home.tutorials.common.metricbeatInstructions.config.osxTextPost', {
- defaultMessage:
- 'Where {passwordTemplate} is the password of the `elastic` user, {esUrlTemplate} is the URL of Elasticsearch, \
-and {kibanaUrlTemplate} is the URL of Kibana.',
- values: {
- passwordTemplate: '``',
- esUrlTemplate: '``',
- kibanaUrlTemplate: '`