Please take the OpenCensus user survey

Stackdriver (Tracing)


Stackdriver Trace is a distributed tracing system that collects latency data from your applications and displays it in the Google Cloud Platform Console.

You can track how requests propagate through your application and receive detailed near real-time performance insights. Stackdriver Trace automatically analyzes all of your application’s traces to generate in-depth latency reports to surface performance degradations, and can capture traces from all of your VMs, containers, or Google App Engine projects.

OpenCensus Node.js has support for this exporter available, distributed through NPM package @opencensus/exporter-stackdriver

For assistance setting up Stackdriver, Click here for a guided codelab.

Installing the exporter

Install OpenCensus Stackdriver Exporter with:

npm install @opencensus/nodejs
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

To create the exporter, in code:

var tracing = require('@opencensus/nodejs');
var stackdriver = require('@opencensus/exporter-stackdriver');

// Add your project id to the Stackdriver options
var exporter = new stackdriver.StackdriverTraceExporter({projectId: "your-project-id"});


Viewing your traces

Please visit


Resource URL
NPM: @opencensus/exporter-stackdriver
NPM: @opencensus/nodejs
Github: OpenCensus for Node.js