OpenTelemetry Tracing
tracer-basic
contains the foundation for all tracing SDKs of opentelemetry-js.
Used standalone, this module provides methods for manual instrumentation of code, offering full control over span creation for client-side JavaScript (browser) and Node.js.
It does not provide automated instrumentation of known libraries, context propagation for asynchronous invocations or distributed-context out-of-the-box.
For automated instrumentation for Node.js, please see
@opentelemetry/node.
Installation
npm install --save @opentelemetry/core
npm install --save @opentelemetry/tracing
Usage
const opentelemetry = require('@opentelemetry/core');
const { BasicTracer } = require('@opentelemetry/tracing');
const tracer = new BasicTracer();
opentelemetry.initGlobalTracer(tracer);
const span = opentelemetry.getTracer().startSpan('foo');
span.setAttribute('key', 'value');
span.end();
Example
See examples/tracer-basic-node for an end-to-end example, including exporting created spans.
Useful links
License
Apache 2.0 - See LICENSE for more information.