OpenTelemetry Fetch Instrumentation for web
This module provides auto instrumentation for web using fetch.
Installation
npm install --save @opentelemetry/plugin-fetch
Usage
'use strict';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { FetchPlugin } from '@opentelemetry/plugin-fetch';
import { ZoneContextManager } from '@opentelemetry/context-zone';
const provider = new WebTracerProvider({
plugins: [
new FetchPlugin(),
],
});
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register({
contextManager: new ZoneContextManager(),
});
// and some test
fetch('http://localhost:8090/fetch.js');
Example Screenshots
See examples/tracer-web/fetch for a short example.
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.