Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into issue-move-autocomp…
Browse files Browse the repository at this point in the history
…lete-to-unified-search
  • Loading branch information
nlatipov committed Apr 19, 2022
2 parents d409271 + 37414f2 commit e7a6e55
Show file tree
Hide file tree
Showing 587 changed files with 81,274 additions and 77,878 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/es_snapshots/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:

- command: .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Default CI Group'
parallelism: 29
parallelism: 30
agents:
queue: n2-4
depends_on: build
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/flaky_tests/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{
"key": "xpack/cigroup",
"name": "Default CI Group",
"ciGroups": 29
"ciGroups": 30
},
{
"key": "xpack/firefox",
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ steps:

- command: .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Default CI Group'
parallelism: 29
parallelism: 30
agents:
queue: n2-4-spot
depends_on: build
Expand Down
6 changes: 4 additions & 2 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ steps:

- command: .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Default CI Group'
parallelism: 29
parallelism: 30
agents:
queue: n2-4
queue: n2-4-spot-2
depends_on: build
timeout_in_minutes: 150
key: default-cigroup
retry:
automatic:
- exit_status: '-1'
limit: 3
- exit_status: '*'
limit: 1

Expand Down
1 change: 1 addition & 0 deletions .ci/ci_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ xpack:
- ciGroup27
- ciGroup28
- ciGroup29
- ciGroup30
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,20 @@ module.exports = {
plugins: ['react', '@typescript-eslint'],
files: ['x-pack/plugins/osquery/**/*.{js,mjs,ts,tsx}'],
rules: {
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['block-like'],
next: ['*'],
},
{
blankLine: 'always',
prev: ['*'],
next: ['return'],
},
],
'padded-blocks': ['error', 'always'],
'arrow-body-style': ['error', 'as-needed'],
'prefer-arrow-callback': 'error',
'no-unused-vars': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ kibanaResponseFactory: {
message: string | Error;
attributes?: ResponseErrorAttributes | undefined;
}>;
customError: (options: CustomHttpResponseOptions<ResponseError>) => KibanaResponse<string | Error | {
customError: (options: CustomHttpResponseOptions<ResponseError | Buffer | Stream>) => KibanaResponse<string | Error | Buffer | Stream | {
message: string | Error;
attributes?: ResponseErrorAttributes | undefined;
}>;
Expand Down
2 changes: 2 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ Used for calculating automatic intervals in visualizations, this is the number
of buckets to try to represent.

[[timelion-legacyChartsLibrary]]`timelion:legacyChartsLibrary`::
**The legacy timelion charts are deprecated and will not be supported as of 8.4.**
Enables the legacy charts library for timelion charts in Visualize.


Expand All @@ -509,6 +510,7 @@ Enables the legacy time axis for charts in Lens, Discover, Visualize and TSVB
The maximum number of buckets a datasource can return. High numbers can have a negative impact on your browser rendering performance.

[[visualization-visualize-pieChartslibrary]]`visualization:visualize:legacyPieChartsLibrary`::
**The legacy pie charts are deprecated and will not be supported in a future version.**
The visualize editor uses new pie charts with improved performance, color palettes, label positioning, and more. Enable this option if you prefer to use the legacy charts library.

[[visualization-visualize-heatmapChartslibrary]]`visualization:visualize:legacyHeatmapChartsLibrary`::
Expand Down
4 changes: 2 additions & 2 deletions docs/management/connectors/action-types/webhook.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Webhook connectors have the following configuration properties.

Name:: The name of the connector. The name is used to identify a connector in the management UI connector listing, or in the connector list when configuring an action.
URL:: The request URL. If you are using the <<action-settings, `xpack.actions.allowedHosts`>> setting, make sure the hostname is added to the allowed hosts.
Method:: HTTP request method, either `POST`(default) or `PUT`.
Method:: HTTP request method, either `post`(default) or `put`.
Headers:: A set of key-value pairs sent as headers with the request
Require authentication:: If true, a username and password for login type authentication must be provided.
Username:: Username for HTTP basic authentication.
Expand All @@ -38,7 +38,7 @@ Use the <<action-settings, Action configuration settings>> to customize connecto
actionTypeId: .webhook
config:
url: https://test.host
method: POST
method: post
headers:
testheader: testvalue
secrets:
Expand Down
14 changes: 8 additions & 6 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,26 @@ For example, `20m`, `24h`, `7d`. Default: `1m`.
`xpack.alerting.rules.minimumScheduleInterval.enforce`::
Specifies the behavior when a new or changed rule has a schedule interval less than the value defined in `xpack.alerting.rules.minimumScheduleInterval.value`. If `false`, rules with schedules less than the interval will be created but warnings will be logged. If `true`, rules with schedules less than the interval cannot be created. Default: `false`.

`xpack.alerting.rules.execution.actions.max`::
`xpack.alerting.rules.run.actions.max`::
Specifies the maximum number of actions that a rule can trigger each time detection checks run.

`xpack.alerting.rules.execution.timeout`::
`xpack.alerting.rules.run.timeout`::
Specifies the default timeout for tasks associated with all types of rules. The time is formatted as:
+
`<count>[ms,s,m,h,d,w,M,Y]`
+
For example, `20m`, `24h`, `7d`, `1w`. Default: `5m`.

`xpack.alerting.rules.execution.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.execution` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
`xpack.alerting.rules.run.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.run` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
+
--
For example:
```
xpack.alerting.rules.execution:
xpack.alerting.rules.run:
timeout: '5m'
ruleTypeOverrides:
- id: '.index-threshold'
timeout: '15m'
```
```
--
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ and in the <<rule-details,details page>>:
[role="screenshot"]
image::images/rule-details-timeout-error.png[Rule details page with timeout error]

If you want your rules to run longer, update the `xpack.alerting.rules.execution.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.execution.ruleTypeOverrides`.
If you want your rules to run longer, update the `xpack.alerting.rules.run.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.run.ruleTypeOverrides`.

Rules that consistently run longer than their <<create-edit-rules, check interval>> may produce unexpected results. If the average run duration, visible on the <<rule-details,details page>>, is greater than the check interval, consider increasing the check interval.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ curl -X GET api/task_manager/_health
--------------------------------------------------
// KIBANA

Monitoring the `_health` endpoint of each {kib} instance in the cluster is the recommended method of ensuring confidence in mission critical services such as Alerting and Actions.
Monitoring the `_health` endpoint of each {kib} instance in the cluster is the recommended method of ensuring confidence in mission critical services such as Alerting, Actions, and Reporting.

[float]
[[task-manager-configuring-health-monitoring]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ A recommended strategy is to follow these steps:
3. If the throughput is insufficient, and {kib} instances exhibit low resource usage, incrementally scale vertically while <<kibana-page,monitoring>> the impact of these changes.
4. If the throughput is insufficient, and {kib} instances are exhibiting high resource usage, incrementally scale horizontally by provisioning new {kib} instances and reassess.

Task Manager, like the rest of the Elastic Stack, is designed to scale horizontally. Take advantage of this ability to ensure mission critical services, such as Alerting and Reporting, always have the capacity they need.
Task Manager, like the rest of the Elastic Stack, is designed to scale horizontally. Take advantage of this ability to ensure mission critical services, such as Alerting, Actions, and Reporting, always have the capacity they need.

Scaling horizontally requires a higher degree of coordination between {kib} instances. One way Task Manager coordinates with other instances is by delaying its polling schedule to avoid conflicts with other instances.
By using <<task-manager-health-monitoring, health monitoring>> to evaluate the <<task-manager-health-evaluate-the-runtime,date of the `last_polling_delay`>> across a deployment, you can estimate the frequency at which Task Manager resets its delay mechanism.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<titleabbrev>Troubleshooting</titleabbrev>
++++

Task Manager is used by a wide range of services in {kib}, such as <<alerting-production-considerations, Alerting>>, Reporting, and Telemetry.
Task Manager is used by a wide range of services in {kib}, such as <<alerting-production-considerations, Alerting>>, Actions, Reporting, and Telemetry.
Unexpected behavior in these services might be a downstream issue originating in Task Manager.

This page describes how to resolve common problems you might encounter with Task Manager.
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"@elastic/apm-rum": "^5.10.2",
"@elastic/apm-rum-react": "^1.3.4",
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "45.1.1",
"@elastic/charts": "46.0.0",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/[email protected]",
"@elastic/ems-client": "8.2.0",
Expand Down Expand Up @@ -211,6 +211,7 @@
"@types/jsonwebtoken": "^8.5.6",
"@types/mapbox__vector-tile": "1.3.0",
"@types/moment-duration-format": "^2.2.3",
"@types/react-is": "^16.7.1",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"antlr4ts": "^0.5.0-alpha.3",
Expand All @@ -226,7 +227,7 @@
"chokidar": "^3.4.3",
"chroma-js": "^1.4.1",
"classnames": "2.2.6",
"color": "1.0.3",
"color": "^4.2.3",
"commander": "^4.1.1",
"compare-versions": "3.5.1",
"constate": "^1.3.2",
Expand Down Expand Up @@ -539,7 +540,7 @@
"@types/chromedriver": "^81.0.1",
"@types/classnames": "^2.2.9",
"@types/cmd-shim": "^2.0.0",
"@types/color": "^3.0.0",
"@types/color": "^3.0.3",
"@types/compression-webpack-plugin": "^2.0.2",
"@types/cypress-cucumber-preprocessor": "^1.14.1",
"@types/cytoscape": "^3.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/elastic-apm-synthtrace/src/scripts/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ require('@babel/register')({
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
});

require('./run');
require('./run_synthtrace');
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { pick } from 'lodash';
import { LogLevel } from '../../lib/utils/create_logger';
import { RunCliFlags } from '../run';
import { RunCliFlags } from '../run_synthtrace';

export function parseRunCliFlags(flags: RunCliFlags) {
const { file, _, logLevel } = flags;
Expand Down
1 change: 1 addition & 0 deletions packages/elastic-eslint-config-kibana/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ NPM_MODULE_EXTRA_FILES = [
RUNTIME_DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"//packages/kbn-eslint-plugin-imports",
"@npm//eslint-config-prettier",
"@npm//semver",
]
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-coloring/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ RUNTIME_DEPS = [
"@npm//@elastic/eui",
"@npm//react-use",
"@npm//react",
"@npm//@emotion/react",
"@npm//@emotion/css",
]

# In this array place dependencies necessary to build the types, which will include the
Expand All @@ -71,6 +73,8 @@ TYPES_DEPS = [
"@npm//@types/react",
"@npm//@elastic/eui",
"@npm//react-use",
"@npm//@emotion/react",
"@npm//@emotion/css",
]

jsts_transpiler(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import { i18n } from '@kbn/i18n';
import React, { useReducer, useMemo } from 'react';
import useDebounce from 'react-use/lib/useDebounce';
import { EuiFormRow, htmlIdGenerator, EuiButtonGroup, EuiIconTip } from '@elastic/eui';
import { css } from '@emotion/react';
import { EuiFormRow, htmlIdGenerator, EuiButtonGroup, EuiIconTip, useEuiTheme } from '@elastic/eui';
import { PalettePicker } from './palette_picker';
import {
PaletteOutput,
Expand All @@ -19,8 +20,6 @@ import {
RequiredPaletteParamTypes,
} from '../../palettes';

import './palette_configuration.scss';

import { toColorRanges } from './utils';
import { ColorRanges, ColorRangesContext } from './color_ranges';
import { isAllColorRangesValid } from './color_ranges/color_ranges_validation';
Expand Down Expand Up @@ -72,8 +71,19 @@ export const CustomizablePalette = ({
[localState]
);

const { euiTheme } = useEuiTheme();

const styles = useMemo(
() => css`
padding: ${euiTheme.size.base};
background-color: ${euiTheme.colors.lightestShade};
border-bottom: ${euiTheme.border.thin};
`,
[euiTheme.size.base, euiTheme.colors.lightestShade, euiTheme.border.thin]
);

return (
<div className="lnsPalettePanel__section lnsPalettePanel__section--shaded">
<div css={styles} className="lnsPalettePanel__section">
<EuiFormRow
display="rowCompressed"
label={i18n.translate('coloring.dynamicColoring.palettePicker.label', {
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-eslint-plugin-imports/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TYPES_DEPS = [
"//packages/kbn-utils:npm_module_types",
"//packages/kbn-dev-utils:npm_module_types", # only required for the tests, which are excluded except on windows
"//packages/kbn-import-resolver:npm_module_types",
"@npm//dedent", # only required for the tests, which are excluded except on windows
"@npm//@types/eslint",
"@npm//@types/jest",
"@npm//@types/node",
Expand Down
55 changes: 51 additions & 4 deletions packages/kbn-eslint-plugin-imports/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
# @kbn/eslint-plugin-imports

ESLint plugin providing custom rules for validating imports in the Kibana repo with custom logic beyond what's possible with custom config to eslint-plugin-imports and even a custom resolver
ESLint plugin providing custom rules for validating imports in the Kibana repo with custom logic beyond what's possible with custom config to eslint-plugin-imports and even a custom resolver.

## `resolveKibanaImport(request: string, dirname: string)`
For the purposes of this ESLint plugin "imports" include:

Resolve an import request (the "from" string from an import statement, or any other relative/absolute import path) from a given directory. The `dirname` should be the same for all files in a given directory.
- `import` statements
- `import()` expressions
- `export ... from` statements
- `require()` calls
- `require.resolve()` calls
- `jest.mock()` and related calls

Result will be `null` when the import path does not resolve, but all valid/committed import paths *should* resolve. Other result values are documented in src/resolve_result.ts.
An "import request" is the string defining the target package/module by any of the previous mentioned "import" types

## `@kbn/imports/no_unresolvable_imports`

This rule validates that every import request in the repository can be resolved by `@kbn/import-resolver`.

This rule is not configurable, should never be skipped, and is auto-fixable.

If a valid import request can't be resolved for some reason please reach out to Kibana Operations to work on either a different strategy for the import or help updating the resolve to support the new import strategy.

## `@kbn/imports/uniform_imports`

This rule validates that every import request in the repsitory follows a standard set of formatting rules. See the rule implemeation for a full breakdown but here is a breif summary:

- imports within a single package must use relative paths
- imports across packages must reference the other package using it's module id
- imports to code not in a package must use relative paths
- imports to an `index` file end with the directory name, ie `/index` or `/index.{ext}` are stripped
- unless this is a `require.resolve()`, the imports should not mention file extensions. `require.resolve()` calls will retain the extension if added manually

This rule is not configurable, should never be skipped, and is auto-fixable.

## `@kbn/imports/exports_moved_packages`

This rule assists package authors who are doing the good work of breaking up large packages. The goal is to define exports which used to be part of one package as having moved to another package. The configuration maintains this mapping and is designed to be extended in the future is additional needs arrise like targetting specific package types.

Config example:
```ts
'@kbn/imports/exports_moved_packages': ['error', [
{
fromPackage: '@kbn/kitchen-sink',
toPackage: '@kbn/spatula',
exportNames: [
'Spatula',
'isSpatula'
]
}
]]
```

This config will find any import of `@kbn/kitchen-sink` which specifically references the `Spatula` or `isSpatula` exports, remove the old exports from the import (potentially removing the entire import), and add a new import after the previous following it's style pointing to the new package.

The auto-fixer here covers the vast majority of import styles in the repository but might not cover everything, including `import * as Namespace from '@kbn/kitchen-sink'`. Imports like this will need to be found and updated manually, though TypeScript should be able to find the vast majority of those.
13 changes: 13 additions & 0 deletions packages/kbn-eslint-plugin-imports/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-eslint-plugin-imports'],
};
Loading

0 comments on commit e7a6e55

Please sign in to comment.