import { take } from 'lodash' ; import { LatencyAggregationType } from '../../../../plugins/apm/common/latency_aggregation_types' ; import { ApmApiSupertest } from '../../common/apm_api_supertest' ; export async function getServiceNodeIds ( { apmApiSupertest , start , end , serviceName = 'opbeans-java' , count = 1 , } ) { const { body } = await apmApiSupertest ( { endpoint : `GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics` , params : { path : { serviceName } , query : { latencyAggregationType : LatencyAggregationType . avg , start , end , transactionType : 'request' , environment : 'ENVIRONMENT_ALL' , kuery : '' , } , } , } ) ; return take ( body . currentPeriod . map ( ( item ) => item . serviceNodeName ) . sort ( ) , count ) ; }