| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
❗ This instrumentation is no longer recommended. Please review documentation on setting up and configuring the OpenTelemetry Node.js Launcher or OpenTelemetry JS (Browser) for more information on migrating to OpenTelemetry.
In August 2023, Lightstep became ServiceNow Cloud Observability To ease the transition, all code artifacts will continue to use the Lightstep name. You don't need to do anything to keep using this repository.
LightStep distributed tracing library for Node.js and the browser.
npm install --save lightstep-tracer opentracing
All modern browsers and Node versions >= 12 are supported. Users who need support for Node 8 and 10 can use v0.32.0 and prior.
To use LightStep as the OpenTracing binding, initialize the global Tracer with the LightStep implementation:
var opentracing = require('opentracing');
var lightstep = require('lightstep-tracer');
opentracing.initGlobalTracer(new lightstep.Tracer({
access_token : '{your_access_token}',
component_name : '{your_service_or_app_name}',
}));The LightStep JavaScript Tracing Cookbook is a good next stop for information on how to quickly instrument your system. If you want to try something out quickly in your browser code, see the browser quick start example.
The browser version of the code can be explicitly included using the following, which can be helpful in some browserify (or similar) setups:
var lightstep = require('lightstep-tracer/browser');The OpenTracing standard JavaScript API is documented here. The following describes LightStep-specific options and methods.
Required options
Standard options
Browser-specific initialization options
instrument_page_load bool - creates a long-lived single span for the entire page view and is recommended for short-page visits in a multi-page website. For a single-page web app, this behavior may be undesirable. Defaults to false. This must be set at initialization, changes after initialization will have no effect.
xhr_instrumentation bool - if false, disables automatic instrumentation of XMLHttpRequests (XHRs). This must be set at initialization; changes after initialization will have no effect. Defaults to false.
xhr_url_inclusion_patterns RegExp[] - an array of regular expressions used to whitelist URLs for XMLHttpRequest auto-instrumentation. The default value is wildcard matching all strings. For a given URL to be instrumented, it must match at least one regular expression in xhr_url_inclusion_patterns and not match any regular expressions in xhr_url_exclusion_patterns.
xhr_url_exclusion_patterns RegExp[] - an array of regular expressions used to exclude URLs from XMLHttpRequest auto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression in xhr_url_inclusion_patterns and not match any regular expressions in xhr_url_exclusion_patterns.
xhr_url_header_inclusion_patterns RegExp[] - an array of regular expressions used to include URLs which auto-instrumented XMLHttpRequests add tracing headers to. The default value is wildcard matching all strings. For a given URL to have tracing headers added, it must match at least one regular expression in xhr_url_header_inclusion_patterns and not match any regular expressions in xhr_url_header_exclusion_patterns.
xhr_url_header_exclusion_patterns RegExp[] - an array of regular expressions used to exclude URLs that auto-instrumented XMLHttpRequests add tracing headers to. The default value is an empty array. For a given URL to have tracing headers added, it must match at least one regular expression in xhr_url_header_inclusion_patterns and not match any regular expressions in xhr_url_header_exclusion_patterns.
fetch_instrumentation bool - if false, disables automatic instrumentation of window.fetch. This must be set at initialization; changes after initialization will have no effect. Defaults to false.
fetch_url_inclusion_patterns RegExp[] - an array of regular expressions used to whitelist URLs for window.fetch auto-instrumentation. The default value is wildcard matching all strings. For a given URL to be instrumented, it must match at least one regular expression in fetch_url_inclusion_patterns and not match any regular expressions in fetch_url_exclusion_patterns.
fetch_url_exclusion_patterns RegExp[] - an array of regular expressions used to exclude URLs from window.fetch auto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression in fetch_url_inclusion_patterns and not match any regular expressions in fetch_url_exclusion_patterns.
fetch_url_header_inclusion_patterns RegExp[] - an array of regular expressions used to include URLs for window.fetch tracer header inclusion. The default value is wildcard matching all strings. For a given URL to be have tracing headers added, it must match at least one regular expression in fetch_url_header_inclusion_patterns and not match any regular expressions in fetch_url_header_exclusion_patterns.
fetch_url_header_exclusion_patterns RegExp[] - an array of regular expressions used to exclude header insertion onto URLs from window.fetch auto-instrumentation. The default value is an empty array. For a given URL to have tracing headers added, it must match at least one regular expression in fetch_url_header_inclusion_patterns and not match any regular expressions in fetch_url_header_exclusion_patterns.
include_cookies bool - if true, includes cookies in the span logs for both window.fetch and XMLHttpRequest. Defaults to true.
node-specific initialization options
nodejs_instrumentation bool - if false, disables automatic instrumentation of node requests. This must be set at initialization; changes after initialization will have no effect. Defaults to false.
nodejs_url_inclusion_patterns RegExp[] - an array of regular expressions used to whitelist URLs for the http and https modules auto-instrumentation. The default value is wildcard matching all strings. For a given URL to be instrumented, it must match at least one regular expression in nodejs_url_inclusion_patterns and not match any regular expressions in nodejs_url_exclusion_patterns.
nodejs_url_exclusion_patterns RegExp[] - an array of regular expressions used to exclude URLs from the http and https modules auto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression in nodejs_url_inclusion_patterns and not match any regular expressions in nodejs_url_exclusion_patterns.
Non-standard options
NOTE: Future API compatibility on non-standard options is not guaranteed.
An example configuration using custom propagators might look like:
const tracer = new lightstep.Tracer({
propagators: {
[opentracing.FORMAT_HTTP_HEADERS]: new lightstep.DDPropagator(),
[opentracing.FORMAT_TEXT_MAP]: new lightstep.B3Propagator()
}
})Returns an absolute URL to the LightStep application for the trace containing this span. It is safe to call this method after finish().
...
span.finish();
var url = span.generateTraceURL())
console.log('View the trace for this span at:', url);make release RELEASE_TYPE=patch
Copyright (c) 2016, LightStep
| Back | FazBrowse Home | New Git URL |