@@ -282,50 +282,47 @@ export function metricsToRequest(exportArgs: ExportInput) {
282282 seconds : dataPoint . startTime [ 0 ] ,
283283 } ,
284284 } ;
285- if ( isCounterValue ( value ) ) {
286- const timeSeries = {
287- metric,
288- resource,
289- valueType : 'INT64' ,
290- points : [
291- {
292- interval,
293- value : {
294- int64Value : dataPoint . value ,
285+ const timeSeries = isCounterValue ( value )
286+ ? {
287+ metric,
288+ resource,
289+ valueType : 'INT64' ,
290+ points : [
291+ {
292+ interval,
293+ value : {
294+ int64Value : dataPoint . value ,
295+ } ,
295296 } ,
296- } ,
297- ] ,
298- } ;
299- timeSeriesArray . push ( timeSeries ) ;
300- } else {
301- // Extract attributes to labels based on their intended target (resource or metric)
302- const timeSeries = {
303- metric,
304- resource,
305- metricKind : 'CUMULATIVE' ,
306- valueType : 'DISTRIBUTION' ,
307- points : [
308- {
309- interval,
310- value : {
311- distributionValue : {
312- count : String ( value . count ) ,
313- mean : value . count ? value . sum / value . count : 0 ,
314- bucketOptions : {
315- explicitBuckets : {
316- bounds : value . buckets . boundaries ,
297+ ] ,
298+ }
299+ : {
300+ metric,
301+ resource,
302+ metricKind : 'CUMULATIVE' ,
303+ valueType : 'DISTRIBUTION' ,
304+ points : [
305+ {
306+ interval,
307+ value : {
308+ distributionValue : {
309+ count : String ( value . count ) ,
310+ mean : value . count ? value . sum / value . count : 0 ,
311+ bucketOptions : {
312+ explicitBuckets : {
313+ bounds : value . buckets . boundaries ,
314+ } ,
317315 } ,
316+ bucketCounts : value . buckets . counts . map ( String ) ,
318317 } ,
319- bucketCounts : value . buckets . counts . map ( String ) ,
320318 } ,
321319 } ,
322- } ,
323- ] ,
324- unit :
325- ( metric as unknown as DistributionMetric ) . descriptor . unit || 'ms' , // Default to 'ms' if no unit is specified
326- } ;
327- timeSeriesArray . push ( timeSeries ) ;
328- }
320+ ] ,
321+ unit :
322+ ( metric as unknown as DistributionMetric ) . descriptor . unit ||
323+ 'ms' , // Default to 'ms' if no unit is specified
324+ } ;
325+ timeSeriesArray . push ( timeSeries ) ;
329326 }
330327 }
331328 }
0 commit comments