Skip to content

Commit

Permalink
chore(NA): merge and solve conflicts with main
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Dec 7, 2021
2 parents 8d89d98 + 4d2f618 commit cd11680
Show file tree
Hide file tree
Showing 383 changed files with 7,719 additions and 2,864 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ readonly links: {
readonly usersAccess: string;
};
readonly workplaceSearch: {
readonly apiKeys: string;
readonly box: string;
readonly confluenceCloud: string;
readonly confluenceServer: string;
Expand Down

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions docs/osquery/osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,21 @@ This is useful for teams who need in-depth and detailed control.

[float]
=== Customize Osquery configuration
By default, all Osquery Manager integrations share the same osquery configuration. However, you can customize how Osquery is configured by editing the Osquery Manager integration for each agent policy
experimental[] By default, all Osquery Manager integrations share the same osquery configuration. However, you can customize how Osquery is configured by editing the Osquery Manager integration for each agent policy
you want to adjust. The custom configuration is then applied to all agents in the policy.
This powerful feature allows you to configure
https://osquery.readthedocs.io/en/stable/deployment/file-integrity-monitoring[File Integrity Monitoring], https://osquery.readthedocs.io/en/stable/deployment/process-auditing[Process auditing],
and https://osquery.readthedocs.io/en/stable/deployment/configuration/#configuration-specification[others].

IMPORTANT: Take caution when editing this configuration. The changes you make are distributed to all agents in the policy.
[IMPORTANT]
=========================
* Take caution when editing this configuration. The changes you make are distributed to all agents in the policy.
* Take caution when editing `packs` using the Advanced *Osquery config* field.
Any changes you make to `packs` from this field are not reflected in the UI on the Osquery *Packs* page in {kib}, however, these changes are deployed to agents in the policy.
While this allows you to use advanced Osquery functionality like pack discovery queries, you do lose the ability to manage packs defined this way from the Osquery *Packs* page.
=========================

. From the {kib} main menu, click *Fleet*, then the *Agent policies* tab.

Expand All @@ -315,6 +323,16 @@ IMPORTANT: Take caution when editing this configuration. The changes you make ar
* (Optional) To load a full configuration file, drag and drop an Osquery `.conf` file into the area at the bottom of the page.

. Click *Save integration* to apply the custom configuration to all agents in the policy.
+
As an example, the following configuration disables two tables.
+
```ts
{
"options":{
"disable_tables":"curl,process_envs"
}
}
```

[float]
=== Upgrade Osquery versions
Expand Down
3 changes: 3 additions & 0 deletions docs/settings/monitoring-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ For more information, see
| `monitoring.ui.elasticsearch.ssl`
| Shares the same configuration as <<elasticsearch-ssl-cert-key, `elasticsearch.ssl`>>. 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]
Expand Down
8 changes: 0 additions & 8 deletions docs/settings/spaces-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ services:

==== Persist the {kib} keystore

By default, {kib] auto-generates a keystore file for secure settings at startup. To persist your {kibana-ref}/secure-settings.html[secure settings], use the `kibana-keystore` utility to bind-mount the parent directory of the keystore to the container. For example:
By default, {kib} auto-generates a keystore file for secure settings at startup. To persist your {kibana-ref}/secure-settings.html[secure settings], use the `kibana-keystore` utility to bind-mount the parent directory of the keystore to the container. For example:

["source","sh",subs="attributes"]
----
Expand Down
6 changes: 3 additions & 3 deletions docs/setup/install/deb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ locations for a Debian-based system:
| path.data

| logs
| Logs files location
| /var/log/kibana
| path.logs
| Logs files location
| /var/log/kibana
| path.logs

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
Expand Down
7 changes: 3 additions & 4 deletions docs/setup/install/rpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,16 @@ locations for an RPM-based system:
| Configuration files including `kibana.yml`
| /etc/kibana
| <<settings,KBN_PATH_CONF>>
d|

| data
| The location of the data files written to disk by Kibana and its plugins
| /var/lib/kibana
| path.data

| logs
| Logs files location
| /var/log/kibana
| path.logs
| Logs files location
| /var/log/kibana
| path.logs

| plugins
| Plugin files location. Each plugin will be contained in a subdirectory.
Expand Down
3 changes: 1 addition & 2 deletions docs/setup/install/targz.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ important data later on.
| home
| Kibana home directory or `$KIBANA_HOME`
d| Directory created by unpacking the archive
d|
|

| bin
| Binary scripts including `kibana` to start the Kibana server
Expand All @@ -137,7 +137,6 @@ important data later on.
| Configuration files including `kibana.yml`
| $KIBANA_HOME\config
| <<settings,KBN_PATH_CONF>>
d|

| data
| The location of the data files written to disk by Kibana and its plugins
Expand Down
19 changes: 10 additions & 9 deletions packages/kbn-apm-config-loader/src/init_apm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { initApm } from './init_apm';
import apm from 'elastic-apm-node';

describe('initApm', () => {
let apmAddFilterSpy: jest.SpyInstance;
let apmStartSpy: jest.SpyInstance;
let apmAddFilterMock: jest.Mock;
let apmStartMock: jest.Mock;
let getConfig: jest.Mock;

beforeEach(() => {
apmAddFilterSpy = jest.spyOn(apm, 'addFilter').mockImplementation(() => undefined);
apmStartSpy = jest.spyOn(apm, 'start').mockImplementation(() => undefined as any);
apmAddFilterMock = apm.addFilter as jest.Mock;
apmStartMock = apm.start as jest.Mock;
getConfig = jest.fn();

mockLoadConfiguration.mockImplementation(() => ({
Expand All @@ -27,7 +27,8 @@ describe('initApm', () => {
});

afterEach(() => {
jest.restoreAllMocks();
apmAddFilterMock.mockReset();
apmStartMock.mockReset();
mockLoadConfiguration.mockReset();
});

Expand All @@ -48,8 +49,8 @@ describe('initApm', () => {
it('registers a filter using `addFilter`', () => {
initApm(['foo', 'bar'], 'rootDir', true, 'service-name');

expect(apmAddFilterSpy).toHaveBeenCalledTimes(1);
expect(apmAddFilterSpy).toHaveBeenCalledWith(expect.any(Function));
expect(apmAddFilterMock).toHaveBeenCalledTimes(1);
expect(apmAddFilterMock).toHaveBeenCalledWith(expect.any(Function));
});

it('starts apm with the config returned from `getConfig`', () => {
Expand All @@ -60,7 +61,7 @@ describe('initApm', () => {

initApm(['foo', 'bar'], 'rootDir', true, 'service-name');

expect(apmStartSpy).toHaveBeenCalledTimes(1);
expect(apmStartSpy).toHaveBeenCalledWith(config);
expect(apmStartMock).toHaveBeenCalledTimes(1);
expect(apmStartMock).toHaveBeenCalledWith(config);
});
});
1 change: 1 addition & 0 deletions packages/kbn-test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ TYPES_DEPS = [
"//packages/kbn-utils",
"@npm//@elastic/elasticsearch",
"@npm//axios",
"@npm//elastic-apm-node",
"@npm//del",
"@npm//exit-hook",
"@npm//form-data",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = {
moduleNameMapper: {
'@elastic/eui/lib/(.*)?': '<rootDir>/node_modules/@elastic/eui/test-env/$1',
'@elastic/eui$': '<rootDir>/node_modules/@elastic/eui/test-env',
'elastic-apm-node': '<rootDir>/node_modules/@kbn/test/target_node/jest/mocks/apm_agent_mock.js',
'\\.module.(css|scss)$':
'<rootDir>/node_modules/@kbn/test/target_node/jest/mocks/css_module_mock.js',
'\\.(css|less|scss)$': '<rootDir>/node_modules/@kbn/test/target_node/jest/mocks/style_mock.js',
Expand Down
63 changes: 63 additions & 0 deletions packages/kbn-test/src/jest/mocks/apm_agent_mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 type { Agent } from 'elastic-apm-node';

/**
* `elastic-apm-node` patches the runtime at import time
* causing memory leak with jest module sandbox, so it
* needs to be mocked for tests
*/
const agent: jest.Mocked<Agent> = {
start: jest.fn().mockImplementation(() => agent),
isStarted: jest.fn().mockReturnValue(false),
getServiceName: jest.fn().mockReturnValue('mock-service'),
setFramework: jest.fn(),
addPatch: jest.fn(),
removePatch: jest.fn(),
clearPatches: jest.fn(),
lambda: jest.fn(),
handleUncaughtExceptions: jest.fn(),
captureError: jest.fn(),
currentTraceparent: null,
currentTraceIds: {},
startTransaction: jest.fn().mockReturnValue(null),
setTransactionName: jest.fn(),
endTransaction: jest.fn(),
currentTransaction: null,
startSpan: jest.fn(),
currentSpan: null,
setLabel: jest.fn().mockReturnValue(false),
addLabels: jest.fn().mockReturnValue(false),
setUserContext: jest.fn(),
setCustomContext: jest.fn(),
addFilter: jest.fn(),
addErrorFilter: jest.fn(),
addSpanFilter: jest.fn(),
addTransactionFilter: jest.fn(),
addMetadataFilter: jest.fn(),
flush: jest.fn(),
destroy: jest.fn(),
registerMetric: jest.fn(),
setTransactionOutcome: jest.fn(),
setSpanOutcome: jest.fn(),
middleware: {
connect: jest.fn().mockReturnValue(jest.fn()),
},
logger: {
fatal: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
trace: jest.fn(),
},
};

// eslint-disable-next-line import/no-default-export
export default agent;
2 changes: 1 addition & 1 deletion packages/kbn-test/src/kbn/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-typed-react-router-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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: {
Expand Down
14 changes: 7 additions & 7 deletions packages/kbn-typed-react-router-config/src/create_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function toReactRouterPath(path: string) {
return path.replace(/(?:{([^\/]+)})/g, ':$1');
}

export function createRouter<TRoute extends Route>(routes: TRoute[]): Router<TRoute[]> {
export function createRouter<TRoutes extends Route[]>(routes: TRoutes): Router<TRoutes> {
const routesByReactRouterConfig = new Map<ReactRouterConfig, Route>();
const reactRouterConfigsByRoute = new Map<Route, ReactRouterConfig>();

Expand Down Expand Up @@ -181,8 +181,10 @@ export function createRouter<TRoute extends Route>(routes: TRoute[]): Router<TRo
);
};

const router = {
link,
return {
link: (path, ...args) => {
return link(path, ...args);
},
getParams: (...args: any[]) => {
const matches = matchRoutes(...args);
return matches.length
Expand All @@ -195,13 +197,11 @@ export function createRouter<TRoute extends Route>(routes: TRoute[]): Router<TRo
matchRoutes: (...args: any[]) => {
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<typeof routes>;
return getRoutesToMatch(path) as unknown as FlattenRoutesOf<TRoutes>;
},
};

return router;
}
Loading

0 comments on commit cd11680

Please sign in to comment.