import { CoreStart } from 'kibana/public' ; import { Alert } from '../../../alerting/common' ; const allowedConsumers = [ 'apm' , 'uptime' , 'logs' , 'infrastructure' , 'alerts' ] ; export async function getObservabilityAlerts ( { core } ) { try { const { data = [ ] } = ( await core . http . get ( '/api/alerts/_find' , { query : { page : 1 , per_page : 20 , } , } ) ) || { } ; return data . filter ( ( { consumer } ) => allowedConsumers . includes ( consumer ) ) ; } catch ( e ) { console . error ( 'Error while fetching alerts' , e ) ; throw e ; } }