From 5c4d3b65fe43a48b094eed52f5df29e296497661 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 24 Mar 2020 09:46:22 -0700 Subject: [PATCH] chore: add debugging info (#394) --- monitoring/snippets/metrics.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/monitoring/snippets/metrics.js b/monitoring/snippets/metrics.js index 8f9760fe09..0aeb0d43c5 100644 --- a/monitoring/snippets/metrics.js +++ b/monitoring/snippets/metrics.js @@ -289,6 +289,7 @@ async function readTimeSeriesAggregate(projectId) { // [START monitoring_read_timeseries_align] // Imports the Google Cloud client library const monitoring = require('@google-cloud/monitoring'); + const util = require('util'); // Creates a client const client = new monitoring.MetricServiceClient(); @@ -323,13 +324,13 @@ async function readTimeSeriesAggregate(projectId) { const [timeSeries] = await client.listTimeSeries(request); console.log('CPU utilization:'); timeSeries.forEach(data => { - console.log(data); - for (const point of data.points) { - console.log(point); - } console.log(data.metric.labels.instance_name); + for (const p of data.points) { + console.log(util.inspect(p)); + } console.log(` Now: ${data.points[0].value.doubleValue}`); console.log(` 10 min ago: ${data.points[1].value.doubleValue}`); + console.log(`=====`); }); // [END monitoring_read_timeseries_align] }