opentelemetry-js/packages/opentelemetry-plugin-xml-ht...
Naseem e93a86633b
ci: lint markdown files (#1147)
* ci: add markdown linting

Signed-off-by: Naseem <naseem@transit.app>

* fix: lint markdown files

Signed-off-by: Naseem <naseem@transit.app>

* docs: add markdown lint configuration

Signed-off-by: Naseem <naseem@transit.app>

* docs: lint change log

Signed-off-by: Naseem <naseem@transit.app>
2020-06-08 15:29:21 -04:00
..
images XMLHttpRequest (#595) 2019-12-19 15:34:09 -08:00
src fix(plugin-xml-http-request): support sync requests (#1133) 2020-06-03 18:39:16 -07:00
test fix(plugin-xml-http-request): support sync requests (#1133) 2020-06-03 18:39:16 -07:00
.eslintignore fix(lint): move tslint to eslint (#892) 2020-05-20 20:42:17 -07:00
.eslintrc.js fix(lint): move tslint to eslint (#892) 2020-05-20 20:42:17 -07:00
.npmignore XMLHttpRequest (#595) 2019-12-19 15:34:09 -08:00
LICENSE XMLHttpRequest (#595) 2019-12-19 15:34:09 -08:00
README.md ci: lint markdown files (#1147) 2020-06-08 15:29:21 -04:00
karma.conf.js XMLHttpRequest (#595) 2019-12-19 15:34:09 -08:00
package.json update nyc to 15.1.0 in all package.json file (#1140) 2020-06-03 13:35:23 -07:00
tsconfig.json chore: update @types/node (#1110) 2020-05-27 12:22:26 -07:00

README.md

OpenTelemetry XMLHttpRequest Instrumentation for web

Gitter chat NPM Published Version dependencies devDependencies Apache License

This module provides auto instrumentation for web using XMLHttpRequest .

Installation

npm install --save @opentelemetry/plugin-xml-http-request

Usage

import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracer } from '@opentelemetry/web';
import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';

const webTracerWithZone = new WebTracer({
  contextManager: new ZoneContextManager(),
  plugins: [
    new XMLHttpRequestPlugin({
      propagateTraceHeaderCorsUrls: ['http://localhost:8090']
    })
  ]
});
webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

// and some test
const req = new XMLHttpRequest();
req.open('GET', 'http://localhost:8090/xml-http-request.js', true);
req.send();

Example Screenshots

Screenshot of the running example Screenshot of the running example Screenshot of the running example

See examples/tracer-web for a short example.

License

Apache 2.0 - See LICENSE for more information.