Package Exports
- @opentelemetry/web
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opentelemetry/web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenTelemetry Web
This module provides automated instrumentation and tracing for Web applications.
For manual instrumentation see the @opentelemetry/web package.
How does automatic tracing work?
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracer } from '@opentelemetry/web';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
const webTracer = new WebTracer({
plugins: [
new DocumentLoad()
]
});
webTracer.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
Installation
npm install --save @opentelemetry/web
Usage
// Manual
const { WebTracer } = require('@opentelemetry/web');
const webTracer = new WebTracer();
const span = webTracer.startSpan('span1');
webTracer.withSpan(span, function () {
this.addEvent('start');
});
span.addEvent('middle');
span.end();
Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us on gitter
License
Apache 2.0 - See LICENSE for more information.