import { useFetcher } from '../../hooks/use_fetcher' ; const INITIAL_STATE = { agentName : undefined , runtimeName : undefined , } ; export function useServiceAgentFetcher ( { serviceName , start , end , } ) { const { data = INITIAL_STATE , error , status , } = useFetcher ( ( callApmApi ) => { if ( serviceName ) { return callApmApi ( { endpoint : 'GET /internal/apm/services/{serviceName}/agent' , params : { path : { serviceName } , query : { start , end } , } , } ) ; } } , [ serviceName , start , end ] ) ; return { ... data , status , error } ; }