@opencensus/nodejs0.0.11 • Public • Published
OpenCensus for Node.js
OpenCensus Node.js is an implementation of OpenCensus, a toolkit for collecting application performance and behavior monitoring data.
The library is in alpha stage and the API is subject to change.
Please join gitter for help or feedback on this project.
Install OpenCensus with:
npm install @opencensus/nodejs
Instrumenting an Application
OpenCensus for Node.js has automatic instrumentation out of the box for those modules:
This means that spans are automatically created for operations of those packages. To use it, simply start the tracing instance.
const tracing = ;tracingstart;
Similarly for Typescript:
Manually Instrument an Application
In addition to automatic tracing, it is possible to manually create your own root and child spans.
Tracing has many options available to choose from. At
tracing.start(), you can set the following:
||The number of traces to be collected before exporting to a backend|
||Maximum time to wait before exporting to a backend|
||A logger object|
||Level of logger - 0: disable, 1: error, 2: warn, 3: info, 4: debug|
||Determines the span's sampling rate. Ranges from 0.0 to 1.0|
||A propagation instance to use|
||The maximum number of characters reported on a label value|
||A list of trace instrumentations plugins to load|
||An exporter object|
OpenCensus can collect tracing data automatically using plugins. Users can also create and use their own plugins. Currently, OpenCensus supports automatic tracing for:
OpenCensus collects distributed tracing. It is able to do so by propagating span data through services. Currently, OpenCensus supports:
OpenCensus can export trace data to various backends. Currently, OpenCensus supports:
If no exporter is registered in the tracing instance, as default, a console log exporter is used.
- 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