import { MetricServiceClient } from '@google-cloud/monitoring' ; interface Metric { name : string ; } const client = new MetricServiceClient ( ) ; export async function getMetrics ( prefix ) { return new Promise ( ( resolve , reject ) => { client . listMetricDescriptors ( { name : 'projects/celo-testnet' , filter : `metric.type = starts_with("custom.googleapis.com/${ prefix }")` , } , ( error , metrics ) => { if ( error ) { reject ( error ) ; } else { resolve ( metrics ) ; } } ) ; } ) ; } export async function deleteMetric ( name ) { console . log ( `Delete metric ${ name }` ) ; return client . deleteMetricDescriptor ( { name } ) ; }