@@ -11,6 +11,7 @@ import { Logger, KibanaRequest } from 'src/core/server';
1111import isEmpty from 'lodash/isEmpty' ;
1212import { chain , tryCatch } from 'fp-ts/lib/TaskEither' ;
1313import { flow } from 'fp-ts/lib/function' ;
14+ import { performance } from 'perf_hooks' ;
1415
1516import { toError , toPromise } from '../../../../common/fp_utils' ;
1617
@@ -52,6 +53,7 @@ import {
5253 checkPrivileges ,
5354 hasTimestampFields ,
5455 hasReadIndexPrivileges ,
56+ makeFloatString ,
5557} from './utils' ;
5658import { signalParamsSchema } from './signal_params_schema' ;
5759import { siemRuleActionGroups } from './siem_rule_action_groups' ;
@@ -409,7 +411,11 @@ export const signalRulesAlertType = ({
409411 lists : exceptionItems ?? [ ] ,
410412 } ) ;
411413
412- const { searchResult : thresholdResults , searchErrors } = await findThresholdSignals ( {
414+ const {
415+ searchResult : thresholdResults ,
416+ searchErrors,
417+ searchDuration : thresholdSearchDuration ,
418+ } = await findThresholdSignals ( {
413419 inputIndexPattern : inputIndex ,
414420 from,
415421 to,
@@ -464,6 +470,7 @@ export const signalRulesAlertType = ({
464470 createdSignalsCount : createdItemsCount ,
465471 createdSignals : createdItems ,
466472 bulkCreateTimes : bulkCreateDuration ? [ bulkCreateDuration ] : [ ] ,
473+ searchAfterTimes : [ thresholdSearchDuration ] ,
467474 } ) ,
468475 ] ) ;
469476 } else if ( isThreatMatchRule ( type ) ) {
@@ -599,10 +606,14 @@ export const signalRulesAlertType = ({
599606 exceptionItems ?? [ ] ,
600607 eventCategoryOverride
601608 ) ;
609+ const eqlSignalSearchStart = performance . now ( ) ;
602610 const response : EqlSignalSearchResponse = await services . callCluster (
603611 'transport.request' ,
604612 request
605613 ) ;
614+ const eqlSignalSearchEnd = performance . now ( ) ;
615+ const eqlSearchDuration = makeFloatString ( eqlSignalSearchEnd - eqlSignalSearchStart ) ;
616+ result . searchAfterTimes = [ eqlSearchDuration ] ;
606617 let newSignals : WrappedSignalHit [ ] | undefined ;
607618 if ( response . hits . sequences !== undefined ) {
608619 newSignals = response . hits . sequences . reduce (
@@ -643,7 +654,6 @@ export const signalRulesAlertType = ({
643654
644655 const fromInMs = parseScheduleDates ( `now-${ interval } ` ) ?. format ( 'x' ) ;
645656 const toInMs = parseScheduleDates ( 'now' ) ?. format ( 'x' ) ;
646-
647657 const resultsLink = getNotificationResultsLink ( {
648658 from : fromInMs ,
649659 to : toInMs ,
0 commit comments