Skip to content

Commit 27f3d5f

Browse files
Merge branch 'master' into apm-jump-to-trace-action-filter
2 parents e1ba61b + f304176 commit 27f3d5f

File tree

573 files changed

+20291
-7191
lines changed

Some content is hidden

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

573 files changed

+20291
-7191
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Delete any items that are not applicable to this PR.
1111
- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
1212
- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)
1313
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)
14-
- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
14+
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
1515

1616
### For maintainers
1717

docs/apm/api.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ allowing you to easily see how these events are impacting the performance of you
355355

356356
By default, annotations are stored in a newly created `observability-annotations` index.
357357
The name of this index can be changed in your `config.yml` by editing `xpack.observability.annotations.index`.
358+
If you change the default index name, you'll also need to <<apm-app-annotation-user-create,update your user privileges>> accordingly.
358359

359360
The following APIs are available:
360361

docs/apm/apm-app-users.asciidoc

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
:beat_default_index_prefix: apm
66
:beat_kib_app: APM app
7-
:annotation_index: `observability-annotations`
7+
:annotation_index: observability-annotations
88

99
++++
1010
<titleabbrev>Users and privileges</titleabbrev>
@@ -102,6 +102,54 @@ Here are two examples:
102102
*********************************** ***********************************
103103
////
104104

105+
[role="xpack"]
106+
[[apm-app-annotation-user-create]]
107+
=== APM app annotation user
108+
109+
++++
110+
<titleabbrev>Create an annotation user</titleabbrev>
111+
++++
112+
113+
NOTE: By default, the `apm_user` built-in role provides access to Observability annotations.
114+
You only need to create an annotation user if the default annotation index
115+
defined in <<apm-settings-kb,`xpack.observability.annotations.index`>> has been customized.
116+
117+
[[apm-app-annotation-user]]
118+
==== Annotation user
119+
120+
View deployment annotations in the APM app.
121+
122+
. Create a new role, named something like `annotation_user`,
123+
and assign the following privileges:
124+
+
125+
[options="header"]
126+
|====
127+
|Type | Privilege | Purpose
128+
129+
|Index
130+
|`read` on +\{ANNOTATION_INDEX\}+^1^
131+
|Read-only access to the observability annotation index
132+
133+
|Index
134+
|`view_index_metadata` on +\{ANNOTATION_INDEX\}+^1^
135+
|Read-only access to observability annotation index metadata
136+
|====
137+
+
138+
^1^ +\{ANNOTATION_INDEX\}+ should be the index name you've defined in
139+
<<apm-settings-kb,`xpack.observability.annotations.index`>>.
140+
141+
. Assign the `annotation_user` created previously, and the built-in roles necessary to create
142+
a <<apm-app-reader-full,full>> or <<apm-app-reader-partial,partial>> APM reader to any users that need to view annotations in the APM app
143+
144+
[[apm-app-annotation-api]]
145+
==== Annotation API
146+
147+
See <<apm-app-api-user>>.
148+
149+
////
150+
*********************************** ***********************************
151+
////
152+
105153
[role="xpack"]
106154
[[apm-app-central-config-user]]
107155
=== APM app central config user

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md

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

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export declare class IndexPattern implements IIndexPattern
3939
| [\_fetchFields()](./kibana-plugin-plugins-data-public.indexpattern._fetchfields.md) | | |
4040
| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | |
4141
| [create(allowOverride)](./kibana-plugin-plugins-data-public.indexpattern.create.md) | | |
42-
| [destroy()](./kibana-plugin-plugins-data-public.indexpattern.destroy.md) | | |
4342
| [getAggregationRestrictions()](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) | | |
4443
| [getComputedFields()](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) | | |
4544
| [getFieldByName(name)](./kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md) | | |

docs/user/alerting/action-types/pre-configured-connectors.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ two out-of-the box connectors: <<slack-action-type, Slack>> and <<webhook-action
2828
my-slack1: <1>
2929
actionTypeId: .slack <2>
3030
name: 'Slack #xyz' <3>
31-
secrets: <4>
31+
secrets:
3232
webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz'
3333
webhook-service:
3434
actionTypeId: .webhook
3535
name: 'Email service'
36-
config:
36+
config: <4>
3737
url: 'https://email-alert-service.elastic.co'
3838
method: post
3939
headers:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,10 @@
455455
"is-path-inside": "^2.1.0",
456456
"istanbul-instrumenter-loader": "3.0.1",
457457
"jest": "^25.5.4",
458-
"jest-environment-jsdom-thirteen": "^1.0.1",
458+
"jest-canvas-mock": "^2.2.0",
459459
"jest-circus": "^25.5.4",
460460
"jest-cli": "^25.5.4",
461+
"jest-environment-jsdom-thirteen": "^1.0.1",
461462
"jest-raw-loader": "^1.0.1",
462463
"jimp": "^0.9.6",
463464
"json5": "^1.0.1",

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { inspect } from 'util';
2424

2525
import cpy from 'cpy';
2626
import del from 'del';
27-
import { toArray, tap } from 'rxjs/operators';
27+
import { toArray, tap, filter } from 'rxjs/operators';
2828
import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';
2929
import { runOptimizer, OptimizerConfig, OptimizerUpdate, logOptimizerState } from '@kbn/optimizer';
3030

@@ -63,8 +63,7 @@ afterAll(async () => {
6363
await del(TMP_DIR);
6464
});
6565

66-
// FLAKY: https://github.com/elastic/kibana/issues/70762
67-
it.skip('builds expected bundles, saves bundle counts to metadata', async () => {
66+
it('builds expected bundles, saves bundle counts to metadata', async () => {
6867
const config = OptimizerConfig.create({
6968
repoRoot: MOCK_REPO_DIR,
7069
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
@@ -75,7 +74,11 @@ it.skip('builds expected bundles, saves bundle counts to metadata', async () =>
7574
expect(config).toMatchSnapshot('OptimizerConfig');
7675

7776
const msgs = await runOptimizer(config)
78-
.pipe(logOptimizerState(log, config), toArray())
77+
.pipe(
78+
logOptimizerState(log, config),
79+
filter((x) => x.event?.type !== 'worker stdio'),
80+
toArray()
81+
)
7982
.toPromise();
8083

8184
const assert = (statement: string, truth: boolean, altStates?: OptimizerUpdate[]) => {
@@ -168,8 +171,7 @@ it.skip('builds expected bundles, saves bundle counts to metadata', async () =>
168171
`);
169172
});
170173

171-
// FLAKY: https://github.com/elastic/kibana/issues/70764
172-
it.skip('uses cache on second run and exist cleanly', async () => {
174+
it('uses cache on second run and exist cleanly', async () => {
173175
const config = OptimizerConfig.create({
174176
repoRoot: MOCK_REPO_DIR,
175177
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],

src/core/server/elasticsearch/elasticsearch_service.mock.ts

Lines changed: 20 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,14 @@
1818
*/
1919

2020
import { BehaviorSubject } from 'rxjs';
21-
import { Client } from 'elasticsearch';
22-
import {
23-
ILegacyClusterClient,
24-
ILegacyCustomClusterClient,
25-
ILegacyScopedClusterClient,
26-
} from './legacy';
21+
import { ILegacyClusterClient, ILegacyCustomClusterClient } from './legacy';
22+
import { legacyClientMock } from './legacy/mocks';
2723
import { ElasticsearchConfig } from './elasticsearch_config';
2824
import { ElasticsearchService } from './elasticsearch_service';
2925
import { InternalElasticsearchServiceSetup, ElasticsearchStatusMeta } from './types';
3026
import { NodesVersionCompatibility } from './version_check/ensure_es_version';
3127
import { ServiceStatus, ServiceStatusLevels } from '../status';
3228

33-
const createScopedClusterClientMock = (): jest.Mocked<ILegacyScopedClusterClient> => ({
34-
callAsInternalUser: jest.fn(),
35-
callAsCurrentUser: jest.fn(),
36-
});
37-
38-
const createCustomClusterClientMock = (): jest.Mocked<ILegacyCustomClusterClient> => ({
39-
...createClusterClientMock(),
40-
close: jest.fn(),
41-
});
42-
43-
function createClusterClientMock() {
44-
const client: jest.Mocked<ILegacyClusterClient> = {
45-
callAsInternalUser: jest.fn(),
46-
asScoped: jest.fn(),
47-
};
48-
client.asScoped.mockReturnValue(createScopedClusterClientMock());
49-
return client;
50-
}
51-
5229
interface MockedElasticSearchServiceSetup {
5330
legacy: {
5431
createClient: jest.Mock<ILegacyCustomClusterClient, any>;
@@ -60,11 +37,13 @@ const createSetupContractMock = () => {
6037
const setupContract: MockedElasticSearchServiceSetup = {
6138
legacy: {
6239
createClient: jest.fn(),
63-
client: createClusterClientMock(),
40+
client: legacyClientMock.createClusterClient(),
6441
},
6542
};
66-
setupContract.legacy.createClient.mockReturnValue(createCustomClusterClientMock());
67-
setupContract.legacy.client.asScoped.mockReturnValue(createScopedClusterClientMock());
43+
setupContract.legacy.createClient.mockReturnValue(legacyClientMock.createCustomClusterClient());
44+
setupContract.legacy.client.asScoped.mockReturnValue(
45+
legacyClientMock.createScopedClusterClient()
46+
);
6847
return setupContract;
6948
};
7049

@@ -74,11 +53,14 @@ const createStartContractMock = () => {
7453
const startContract: MockedElasticSearchServiceStart = {
7554
legacy: {
7655
createClient: jest.fn(),
77-
client: createClusterClientMock(),
56+
client: legacyClientMock.createClusterClient(),
7857
},
7958
};
80-
startContract.legacy.createClient.mockReturnValue(createCustomClusterClientMock());
81-
startContract.legacy.client.asScoped.mockReturnValue(createScopedClusterClientMock());
59+
startContract.legacy.createClient.mockReturnValue(legacyClientMock.createCustomClusterClient());
60+
startContract.legacy.client.asScoped.mockReturnValue(
61+
legacyClientMock.createScopedClusterClient()
62+
);
63+
8264
return startContract;
8365
};
8466

@@ -104,7 +86,9 @@ const createInternalSetupContractMock = () => {
10486
...createSetupContractMock().legacy,
10587
},
10688
};
107-
setupContract.legacy.client.asScoped.mockReturnValue(createScopedClusterClientMock());
89+
setupContract.legacy.client.asScoped.mockReturnValue(
90+
legacyClientMock.createScopedClusterClient()
91+
);
10892
return setupContract;
10993
};
11094

@@ -121,62 +105,13 @@ const createMock = () => {
121105
return mocked;
122106
};
123107

124-
const createElasticsearchClientMock = () => {
125-
const mocked: jest.Mocked<Client> = {
126-
cat: {} as any,
127-
cluster: {} as any,
128-
indices: {} as any,
129-
ingest: {} as any,
130-
nodes: {} as any,
131-
snapshot: {} as any,
132-
tasks: {} as any,
133-
bulk: jest.fn(),
134-
clearScroll: jest.fn(),
135-
count: jest.fn(),
136-
create: jest.fn(),
137-
delete: jest.fn(),
138-
deleteByQuery: jest.fn(),
139-
deleteScript: jest.fn(),
140-
deleteTemplate: jest.fn(),
141-
exists: jest.fn(),
142-
explain: jest.fn(),
143-
fieldStats: jest.fn(),
144-
get: jest.fn(),
145-
getScript: jest.fn(),
146-
getSource: jest.fn(),
147-
getTemplate: jest.fn(),
148-
index: jest.fn(),
149-
info: jest.fn(),
150-
mget: jest.fn(),
151-
msearch: jest.fn(),
152-
msearchTemplate: jest.fn(),
153-
mtermvectors: jest.fn(),
154-
ping: jest.fn(),
155-
putScript: jest.fn(),
156-
putTemplate: jest.fn(),
157-
reindex: jest.fn(),
158-
reindexRethrottle: jest.fn(),
159-
renderSearchTemplate: jest.fn(),
160-
scroll: jest.fn(),
161-
search: jest.fn(),
162-
searchShards: jest.fn(),
163-
searchTemplate: jest.fn(),
164-
suggest: jest.fn(),
165-
termvectors: jest.fn(),
166-
update: jest.fn(),
167-
updateByQuery: jest.fn(),
168-
close: jest.fn(),
169-
};
170-
return mocked;
171-
};
172-
173108
export const elasticsearchServiceMock = {
174109
create: createMock,
175110
createInternalSetup: createInternalSetupContractMock,
176111
createSetup: createSetupContractMock,
177112
createStart: createStartContractMock,
178-
createClusterClient: createClusterClientMock,
179-
createCustomClusterClient: createCustomClusterClientMock,
180-
createScopedClusterClient: createScopedClusterClientMock,
181-
createElasticsearchClient: createElasticsearchClientMock,
113+
createLegacyClusterClient: legacyClientMock.createClusterClient,
114+
createLegacyCustomClusterClient: legacyClientMock.createCustomClusterClient,
115+
createLegacyScopedClusterClient: legacyClientMock.createScopedClusterClient,
116+
createLegacyElasticsearchClient: legacyClientMock.createElasticsearchClient,
182117
};

src/core/server/elasticsearch/elasticsearch_service.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('#setup', () => {
7575
});
7676

7777
it('returns elasticsearch client as a part of the contract', async () => {
78-
const mockClusterClientInstance = elasticsearchServiceMock.createClusterClient();
78+
const mockClusterClientInstance = elasticsearchServiceMock.createLegacyClusterClient();
7979
MockClusterClient.mockImplementationOnce(() => mockClusterClientInstance);
8080

8181
const setupContract = await elasticsearchService.setup(deps);
@@ -209,7 +209,7 @@ describe('#setup', () => {
209209
});
210210

211211
it('esNodeVersionCompatibility$ only starts polling when subscribed to', async (done) => {
212-
const clusterClientInstance = elasticsearchServiceMock.createClusterClient();
212+
const clusterClientInstance = elasticsearchServiceMock.createLegacyClusterClient();
213213
MockClusterClient.mockImplementationOnce(() => clusterClientInstance);
214214

215215
clusterClientInstance.callAsInternalUser.mockRejectedValue(new Error());
@@ -225,7 +225,7 @@ describe('#setup', () => {
225225
});
226226

227227
it('esNodeVersionCompatibility$ stops polling when unsubscribed from', async (done) => {
228-
const mockClusterClientInstance = elasticsearchServiceMock.createClusterClient();
228+
const mockClusterClientInstance = elasticsearchServiceMock.createLegacyClusterClient();
229229
MockClusterClient.mockImplementationOnce(() => mockClusterClientInstance);
230230

231231
mockClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error());
@@ -255,7 +255,7 @@ describe('#stop', () => {
255255

256256
it('stops pollEsNodeVersions even if there are active subscriptions', async (done) => {
257257
expect.assertions(2);
258-
const mockClusterClientInstance = elasticsearchServiceMock.createCustomClusterClient();
258+
const mockClusterClientInstance = elasticsearchServiceMock.createLegacyCustomClusterClient();
259259

260260
MockClusterClient.mockImplementationOnce(() => mockClusterClientInstance);
261261

0 commit comments

Comments
 (0)