Skip to content

Commit c0219b5

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into migrate-xpack-test-project-ref
2 parents e7f0783 + c13ae7e commit c0219b5

File tree

41 files changed

+592
-260
lines changed

Some content is hidden

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

41 files changed

+592
-260
lines changed

x-pack/plugins/actions/server/lib/action_executor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export class ActionExecutor {
147147
rel: SAVED_OBJECT_REL_PRIMARY,
148148
type: 'action',
149149
id: actionId,
150+
type_id: actionTypeId,
150151
...namespace,
151152
},
152153
],

x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ test('enqueues execution per selected action', async () => {
166166
"id": "1",
167167
"rel": "primary",
168168
"type": "alert",
169+
"type_id": "test",
169170
},
170171
Object {
171172
"id": "1",
172173
"type": "action",
174+
"type_id": "test",
173175
},
174176
],
175177
},

x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,14 @@ export function createExecutionHandler<
182182
action_subgroup: actionSubgroup,
183183
},
184184
saved_objects: [
185-
{ rel: SAVED_OBJECT_REL_PRIMARY, type: 'alert', id: alertId, ...namespace },
186-
{ type: 'action', id: action.id, ...namespace },
185+
{
186+
rel: SAVED_OBJECT_REL_PRIMARY,
187+
type: 'alert',
188+
id: alertId,
189+
type_id: alertType.id,
190+
...namespace,
191+
},
192+
{ type: 'action', id: action.id, type_id: action.actionTypeId, ...namespace },
187193
],
188194
},
189195
};

x-pack/plugins/alerting/server/task_runner/task_runner.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ describe('Task Runner', () => {
278278
"namespace": undefined,
279279
"rel": "primary",
280280
"type": "alert",
281+
"type_id": "test",
281282
},
282283
],
283284
},
@@ -385,6 +386,7 @@ describe('Task Runner', () => {
385386
namespace: undefined,
386387
rel: 'primary',
387388
type: 'alert',
389+
type_id: 'test',
388390
},
389391
],
390392
},
@@ -406,6 +408,7 @@ describe('Task Runner', () => {
406408
namespace: undefined,
407409
rel: 'primary',
408410
type: 'alert',
411+
type_id: 'test',
409412
},
410413
],
411414
},
@@ -428,11 +431,13 @@ describe('Task Runner', () => {
428431
namespace: undefined,
429432
rel: 'primary',
430433
type: 'alert',
434+
type_id: 'test',
431435
},
432436
{
433437
id: '1',
434438
namespace: undefined,
435439
type: 'action',
440+
type_id: 'action',
436441
},
437442
],
438443
},
@@ -455,6 +460,7 @@ describe('Task Runner', () => {
455460
namespace: undefined,
456461
rel: 'primary',
457462
type: 'alert',
463+
type_id: 'test',
458464
},
459465
],
460466
},
@@ -531,6 +537,7 @@ describe('Task Runner', () => {
531537
namespace: undefined,
532538
rel: 'primary',
533539
type: 'alert',
540+
type_id: 'test',
534541
},
535542
],
536543
},
@@ -551,6 +558,7 @@ describe('Task Runner', () => {
551558
namespace: undefined,
552559
rel: 'primary',
553560
type: 'alert',
561+
type_id: 'test',
554562
},
555563
],
556564
},
@@ -572,6 +580,7 @@ describe('Task Runner', () => {
572580
namespace: undefined,
573581
rel: 'primary',
574582
type: 'alert',
583+
type_id: 'test',
575584
},
576585
],
577586
},
@@ -702,6 +711,7 @@ describe('Task Runner', () => {
702711
"namespace": undefined,
703712
"rel": "primary",
704713
"type": "alert",
714+
"type_id": "test",
705715
},
706716
],
707717
},
@@ -725,6 +735,7 @@ describe('Task Runner', () => {
725735
"namespace": undefined,
726736
"rel": "primary",
727737
"type": "alert",
738+
"type_id": "test",
728739
},
729740
],
730741
},
@@ -931,6 +942,7 @@ describe('Task Runner', () => {
931942
"namespace": undefined,
932943
"rel": "primary",
933944
"type": "alert",
945+
"type_id": "test",
934946
},
935947
],
936948
},
@@ -953,6 +965,7 @@ describe('Task Runner', () => {
953965
"namespace": undefined,
954966
"rel": "primary",
955967
"type": "alert",
968+
"type_id": "test",
956969
},
957970
],
958971
},
@@ -976,11 +989,13 @@ describe('Task Runner', () => {
976989
"namespace": undefined,
977990
"rel": "primary",
978991
"type": "alert",
992+
"type_id": "test",
979993
},
980994
Object {
981995
"id": "1",
982996
"namespace": undefined,
983997
"type": "action",
998+
"type_id": "action",
984999
},
9851000
],
9861001
},
@@ -1004,6 +1019,7 @@ describe('Task Runner', () => {
10041019
"namespace": undefined,
10051020
"rel": "primary",
10061021
"type": "alert",
1022+
"type_id": "test",
10071023
},
10081024
],
10091025
},
@@ -1386,6 +1402,7 @@ describe('Task Runner', () => {
13861402
"namespace": undefined,
13871403
"rel": "primary",
13881404
"type": "alert",
1405+
"type_id": "test",
13891406
},
13901407
],
13911408
},
@@ -1408,6 +1425,7 @@ describe('Task Runner', () => {
14081425
"namespace": undefined,
14091426
"rel": "primary",
14101427
"type": "alert",
1428+
"type_id": "test",
14111429
},
14121430
],
14131431
},
@@ -1431,6 +1449,7 @@ describe('Task Runner', () => {
14311449
"namespace": undefined,
14321450
"rel": "primary",
14331451
"type": "alert",
1452+
"type_id": "test",
14341453
},
14351454
],
14361455
},
@@ -1641,6 +1660,7 @@ describe('Task Runner', () => {
16411660
"namespace": undefined,
16421661
"rel": "primary",
16431662
"type": "alert",
1663+
"type_id": "test",
16441664
},
16451665
],
16461666
},
@@ -1700,6 +1720,7 @@ describe('Task Runner', () => {
17001720
"namespace": undefined,
17011721
"rel": "primary",
17021722
"type": "alert",
1723+
"type_id": "test",
17031724
},
17041725
],
17051726
},
@@ -1767,6 +1788,7 @@ describe('Task Runner', () => {
17671788
"namespace": undefined,
17681789
"rel": "primary",
17691790
"type": "alert",
1791+
"type_id": "test",
17701792
},
17711793
],
17721794
},
@@ -1834,6 +1856,7 @@ describe('Task Runner', () => {
18341856
"namespace": undefined,
18351857
"rel": "primary",
18361858
"type": "alert",
1859+
"type_id": "test",
18371860
},
18381861
],
18391862
},
@@ -1900,6 +1923,7 @@ describe('Task Runner', () => {
19001923
"namespace": undefined,
19011924
"rel": "primary",
19021925
"type": "alert",
1926+
"type_id": "test",
19031927
},
19041928
],
19051929
},

x-pack/plugins/alerting/server/task_runner/task_runner.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ export class TaskRunner<
331331
alertId,
332332
alertLabel,
333333
namespace,
334+
ruleTypeId: alert.alertTypeId,
334335
});
335336

336337
if (!muteAll) {
@@ -493,6 +494,7 @@ export class TaskRunner<
493494
rel: SAVED_OBJECT_REL_PRIMARY,
494495
type: 'alert',
495496
id: alertId,
497+
type_id: this.alertType.id,
496498
namespace,
497499
},
498500
],
@@ -598,6 +600,7 @@ interface GenerateNewAndRecoveredInstanceEventsParams<
598600
alertId: string;
599601
alertLabel: string;
600602
namespace: string | undefined;
603+
ruleTypeId: string;
601604
}
602605

603606
function generateNewAndRecoveredInstanceEvents<
@@ -611,6 +614,7 @@ function generateNewAndRecoveredInstanceEvents<
611614
currentAlertInstances,
612615
originalAlertInstances,
613616
recoveredAlertInstances,
617+
ruleTypeId,
614618
} = params;
615619
const originalAlertInstanceIds = Object.keys(originalAlertInstances);
616620
const currentAlertInstanceIds = Object.keys(currentAlertInstances);
@@ -664,6 +668,7 @@ function generateNewAndRecoveredInstanceEvents<
664668
rel: SAVED_OBJECT_REL_PRIMARY,
665669
type: 'alert',
666670
id: alertId,
671+
type_id: ruleTypeId,
667672
namespace,
668673
},
669674
],

x-pack/plugins/event_log/generated/mappings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@
275275
"type": {
276276
"type": "keyword",
277277
"ignore_above": 1024
278+
},
279+
"type_id": {
280+
"type": "keyword",
281+
"ignore_above": 1024
278282
}
279283
}
280284
}

x-pack/plugins/event_log/generated/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export const EventSchema = schema.maybe(
116116
namespace: ecsString(),
117117
id: ecsString(),
118118
type: ecsString(),
119+
type_id: ecsString(),
119120
})
120121
)
121122
),

x-pack/plugins/event_log/scripts/mappings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ exports.EcsCustomPropertyMappings = {
6060
type: 'keyword',
6161
ignore_above: 1024,
6262
},
63+
type_id: {
64+
type: 'keyword',
65+
ignore_above: 1024,
66+
},
6367
},
6468
},
6569
},

x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,14 @@ export class HeadlessChromiumDriverFactory {
195195
getBrowserLogger(page: puppeteer.Page, logger: LevelLogger): Rx.Observable<void> {
196196
const consoleMessages$ = Rx.fromEvent<puppeteer.ConsoleMessage>(page, 'console').pipe(
197197
map((line) => {
198+
const formatLine = () => `{ text: "${line.text()?.trim()}", url: ${line.location()?.url} }`;
199+
198200
if (line.type() === 'error') {
199-
logger.error(line.text(), ['headless-browser-console']);
201+
logger.error(`Error in browser console: ${formatLine()}`, ['headless-browser-console']);
200202
} else {
201-
logger.debug(line.text(), [`headless-browser-console:${line.type()}`]);
203+
logger.debug(`Message in browser console: ${formatLine()}`, [
204+
`headless-browser-console:${line.type()}`,
205+
]);
202206
}
203207
})
204208
);

x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export const sampleDocWithSortId = (
146146
export const sampleDocNoSortId = (
147147
someUuid: string = sampleIdGuid,
148148
ip?: string
149-
): SignalSourceHit => ({
149+
): SignalSourceHit & { _source: Required<SignalSourceHit>['_source'] } => ({
150150
_index: 'myFakeSignalIndex',
151151
_type: 'doc',
152152
_score: 100,
@@ -225,12 +225,12 @@ export const sampleWrappedSignalHit = (): WrappedSignalHit => {
225225
};
226226
};
227227

228-
export const sampleDocWithAncestors = (): SignalSearchResponse => {
228+
export const sampleDocWithAncestors = (): SignalSearchResponse & {
229+
hits: { hits: Array<ReturnType<typeof sampleDocNoSortId>> };
230+
} => {
229231
const sampleDoc = sampleDocNoSortId();
230232
delete sampleDoc.sort;
231-
// @ts-expect-error @elastic/elasticsearch _source is optional
232233
delete sampleDoc._source.source;
233-
// @ts-expect-error @elastic/elasticsearch _source is optional
234234
sampleDoc._source.signal = {
235235
parent: {
236236
id: 'd5e8eb51-a6a0-456d-8a15-4b79bfec3d71',
@@ -562,7 +562,9 @@ export const sampleBulkCreateErrorResult = {
562562

563563
export const sampleDocSearchResultsNoSortId = (
564564
someUuid: string = sampleIdGuid
565-
): SignalSearchResponse => ({
565+
): SignalSearchResponse & {
566+
hits: { hits: Array<ReturnType<typeof sampleDocNoSortId>> };
567+
} => ({
566568
took: 10,
567569
timed_out: false,
568570
_shards: {

0 commit comments

Comments
 (0)