Skip to content

Commit

Permalink
chore: add debugging info (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and Ace Nassri committed Nov 10, 2022
1 parent da4c3b5 commit 0e00dc1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions monitoring/snippets/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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]
}
Expand Down

0 comments on commit 0e00dc1

Please sign in to comment.