@deal/opencensus-exporter-stackdriver
v0.0.7
Published
OpenCensus Exporter Stackdriver allows user to send collected traces to Stackdriver
Downloads
2
Readme
OpenCensus Stackdriver Exporter for Node.js
OpenCensus Stackdriver Exporter allows the user to send collected traces with OpenCensus Node.js to Stackdriver.
This project is still at an early stage of development. It's subject to change.
Installation
Install OpenCensus Stackdriver Exporter with:
npm install @deal/opencensus-nodejs
npm install @deal/opencensus-exporter-stackdriver
Usage
To use Stackdriver as your exporter, make sure you have enabled Stackdriver Tracing on Google Cloud Platform. Enable your Application Default Credentials for authentication with:
export GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credential.json
Instance the exporter on your application and pass your Project ID. For javascript:
var tracing = require('@deal/opencensus-nodejs');
var stackdriver = require('@deal/opencensus-exporter-stackdriver');
// Add your project id to the Stackdriver options
var exporter = new stackdriver.StackdriverTraceExporter({projectId: "your-project-id"});
tracing.registerExporter(exporter).start();
Similarly for Typescript:
import * as tracing from '@deal/opencensus-nodejs';
import { StackdriverTraceExporter } from '@deal/opencensus-exporter-stackdriver';
// Add your project id to the Stackdriver options
const exporter = new StackdriverTraceExporter({projectId: "your-project-id"});
Now, register the exporter and start tracing.
tracing.start({'exporter': exporter});
or
tracing.registerExporter(exporter).start();
Useful links
- To know more about Stackdriver, visit: https://cloud.google.com/docs/authentication/getting-started
- For more information on OpenCensus, visit: https://opencensus.io/
- To checkout the OpenCensus for Node.js, visit: https://github.com/census-instrumentation/opencensus-node
- For help or feedback on this project, join us on gitter