OpenCensus is being archived! Read the blog post to learn more

Stackdriver (Stats)

Introduction

This guide makes use of Stackdriver for visualizing your data. For assistance setting up Stackdriver, Click here for a guided codelab.

Stackdriver Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications. Stackdriver collects metrics, events, and metadata from Google Cloud Platform, Amazon Web Services, hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch, and many others. Stackdriver ingests that data and generates insights via dashboards, charts, and alerts. Stackdriver alerting helps you collaborate by integrating with Slack, PagerDuty, HipChat, Campfire, and more.

OpenCensus Node has support for this exporter available through package:

Installing the exporter

You can install OpenCensus Stackdriver Exporter by running these steps:

npm install @opencensus/core
npm install @opencensus/exporter-stackdriver

Creating the exporter

To create the exporter, you’ll need to:

export GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credential.json

Stackdriver’s minimum stats reporting period must be >= 60 seconds. Find out why at this official Stackdriver advisory

const { globalStats } = require('@opencensus/core');
const { StackdriverStatsExporter } = require('@opencensus/exporter-stackdriver');

// Add your project id to the Stackdriver options
const exporter = new StackdriverStatsExporter({projectId: "your-project-id"});

globalStats.registerExporter(exporter);

Viewing your metrics

Please visit https://console.cloud.google.com/monitoring

References

Resource URL
NPM: @opencensus/exporter-stackdriver https://www.npmjs.com/package/@opencensus/exporter-stackdriver
NPM: @opencensus/nodejs https://www.npmjs.com/package/@opencensus/nodejs
Github: OpenCensus for Node.js https://github.com/census-instrumentation/opencensus-node/tree/master/packages/opencensus-nodejs