import { ApmFetchDataResponse , FetchDataParams , } from '../../../../observability/public' ; import { callApmApi } from './createCallApmApi' ; export const fetchObservabilityOverviewPageData = async ( { absoluteTime , relativeTime , bucketSize , intervalString , } ) : Promise < ApmFetchDataResponse > => { const data = await callApmApi ( { endpoint : 'GET /internal/apm/observability_overview' , signal : null , params : { query : { start : new Date ( absoluteTime . start ) . toISOString ( ) , end : new Date ( absoluteTime . end ) . toISOString ( ) , bucketSize , intervalString , } , } , } ) ; const { serviceCount , transactionPerMinute } = data ; return { appLink : `/app/apm/services?rangeFrom=${ relativeTime . start }&rangeTo=${ relativeTime . end }` , stats : { services : { type : 'number' , value : serviceCount , } , transactions : { type : 'number' , value : transactionPerMinute . value || 0 , } , } , series : { transactions : { coordinates : transactionPerMinute . timeseries , } , } , } ; } ; export async function getHasData ( ) { return await callApmApi ( { endpoint : 'GET /internal/apm/observability_overview/has_data' , signal : null , } ) ; }