Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-xml-http-request

Package Overview
Dependencies
Maintainers
4
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-xml-http-request

OpenTelemetry XMLHttpRequest automatic instrumentation package.

  • 0.18.1-alpha.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
153K
decreased by-34.62%
Maintainers
4
Weekly downloads
 
Created
Source

OpenTelemetry XMLHttpRequest Instrumentation for web

NPM Published Version dependencies devDependencies Apache License

This module provides auto instrumentation for web using XMLHttpRequest .

Installation

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

Usage

import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';

// this is still possible
const providerWithZone = new WebTracerProvider({
  plugins: [
    new XMLHttpRequestInstrumentation({
      propagateTraceHeaderCorsUrls: ['http://localhost:8090']
    })
  ]
});
providerWithZone.register({
  contextManager: new ZoneContextManager(),
});
const webTracerWithZone = providerWithZone.getTracer('default');
/////////////////////////////////////////

// or plugin can be also initialised separately and then set the tracer provider or meter provider
const xmlHttpRequestInstrumentation = new XMLHttpRequestInstrumentation({
  propagateTraceHeaderCorsUrls: ['http://localhost:8090']
});
const providerWithZone = new WebTracerProvider();
providerWithZone.register({
  contextManager: new ZoneContextManager(),
});
xmlHttpRequestInstrumentation.setTracerProvider(providerWithZone);
/////////////////////////////////////////

providerWithZone.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.

Keywords

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc