lightstep-tracer v0.35.0-no-protobuf
lightstep-tracer
❗ 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.
LightStep distributed tracing library for Node.js and the browser.
Installation
npm install --save lightstep-tracer opentracingAll modern browsers and Node versions >= 12 are supported. Users who need support for Node 8 and 10 can use v0.32.0 and prior.
Getting started
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.
- For more information about using the OpenTracing API, see http://opentracing.io/
- See examples/browser for a complete JavaScript browser example
- See examples/node for a complete Node.js server-side 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');LightStep-specific API
The OpenTracing standard JavaScript API is documented here. The following describes LightStep-specific options and methods.
LightStep
new Tracer(options)
Required options
access_tokenstringrequired - the project access tokencomponent_namestringrequired - the string identifier for the application, service, or process
Standard options
verbositynumberoptional, default=1 - controls the level of logging to the console0- the client library will never log to the console1- error reporting will be throttled to the first error per minute2- all errors are logged to the console3- all errors, warnings, and info statements are logged to the console4- all log statements, including debugging details
collector_hoststringoptional - custom collector hostnamecollector_portnumberoptional - custom collector portcollector_pathstringoptional - custom collector base path (if served behind a reverse proxy)collector_encryptionstringoptional, default='tls'tls- use HTTPS encrypted connectionsnone- use HTTP plain-text connections
Browser-specific initialization options
instrument_page_loadbool- 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_instrumentationbool- 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_patternsRegExp[]- an array of regular expressions used to whitelist URLs forXMLHttpRequestauto-instrumentation. The default value is wildcard matching all strings. For a given URL to be instrumented, it must match at least one regular expression inxhr_url_inclusion_patternsand not match any regular expressions inxhr_url_exclusion_patterns.xhr_url_exclusion_patternsRegExp[]- an array of regular expressions used to exclude URLs fromXMLHttpRequestauto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression inxhr_url_inclusion_patternsand not match any regular expressions inxhr_url_exclusion_patterns.xhr_url_header_inclusion_patternsRegExp[]- an array of regular expressions used to include URLs which auto-instrumentedXMLHttpRequests 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 inxhr_url_header_inclusion_patternsand not match any regular expressions inxhr_url_header_exclusion_patterns.xhr_url_header_exclusion_patternsRegExp[]- an array of regular expressions used to exclude URLs that auto-instrumentedXMLHttpRequests 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 inxhr_url_header_inclusion_patternsand not match any regular expressions inxhr_url_header_exclusion_patterns.fetch_instrumentationbool- if false, disables automatic instrumentation ofwindow.fetch. This must be set at initialization; changes after initialization will have no effect. Defaults to false.fetch_url_inclusion_patternsRegExp[]- an array of regular expressions used to whitelist URLs forwindow.fetchauto-instrumentation. The default value is wildcard matching all strings. For a given URL to be instrumented, it must match at least one regular expression infetch_url_inclusion_patternsand not match any regular expressions infetch_url_exclusion_patterns.fetch_url_exclusion_patternsRegExp[]- an array of regular expressions used to exclude URLs fromwindow.fetchauto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression infetch_url_inclusion_patternsand not match any regular expressions infetch_url_exclusion_patterns.fetch_url_header_inclusion_patternsRegExp[]- an array of regular expressions used to include URLs forwindow.fetchtracer 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 infetch_url_header_inclusion_patternsand not match any regular expressions infetch_url_header_exclusion_patterns.fetch_url_header_exclusion_patternsRegExp[]- an array of regular expressions used to exclude header insertion onto URLs fromwindow.fetchauto-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 infetch_url_header_inclusion_patternsand not match any regular expressions infetch_url_header_exclusion_patterns.include_cookiesbool- if true, includes cookies in the span logs for bothwindow.fetchandXMLHttpRequest. Defaults to true.
node-specific initialization options
nodejs_instrumentationbool- 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_patternsRegExp[]- an array of regular expressions used to whitelist URLs for thehttpandhttpsmodules 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 innodejs_url_inclusion_patternsand not match any regular expressions innodejs_url_exclusion_patterns.nodejs_url_exclusion_patternsRegExp[]- an array of regular expressions used to exclude URLs from thehttpandhttpsmodules auto-instrumentation. The default value is an empty array. For a given URL to be instrumented, it must match at least one regular expression innodejs_url_inclusion_patternsand not match any regular expressions innodejs_url_exclusion_patterns.
Non-standard options
NOTE: Future API compatibility on non-standard options is not guaranteed.
disable_reporting_loopbooloptional, default=false - if true, the timer that automatically sends reports to the collector will be disabled. This option is independent ofdisable_report_on_exit.disable_report_on_exitbooloptional, default=false - if true, the final report that is automatically sent at process exit in Node or page unload in the browser will not be sent.report_timeout_millisnumberoptional, default=30000 - the default timeout value, in milliseconds, for reports to the LightStep collectorgzip_json_requestsbooloptional, default=true - if true, the reports will be gzipped before sent to the collector.default_span_tagsstringoptional - an associative array of tags to add to every span started by the tracer (e.g., the active user id in a browser client)delay_initial_report_millisintoptional, default=1000 - maximum additional delay of the initial report in addition to the normal reporting interval. A value between zero and this maximum will be selected as the actual delay. This can be useful when concurrently launching a large number of new processes and there is a desire to distribute the initial reports over a window of time.error_throttle_millisintoptional, default=60000 - whenverbosityis set to1, this the minimum time between logged errors.transportstringoptional, default=proto - whentransportis set tothrift, the Tracer will use Thrift as its transport instead of Proto over HTTP. (Not supported in React-Native)loggerfunction(level: string, message: string, payload: any): voidoptional - specify a custom logger function. Possiblelevelvalues aredebug,info,warnanderror. By default messages will be logged to the console.disable_meta_event_reportingbooloptional, default=false - whendisable_meta_event_reportingis set totrue, the tracer will disable meta event reporting even if requested by the Satellite.propagatorsdictionaryoptional, defaults={ [opentracing.FORMAT_HTTP_HEADERS]: new lightstep.LightStepPropagator(), [opentracing.FORMAT_TEXT_MAP]: new lightstep.LightStepPropagator(), [opentracing.FORMAT_BINARY]: new lightstep.UnsupportedPropagator() }: Allows inject/extract to use custom propagators for different formats. This package includesB3Propagatorthat supports B3 headers on text maps and http headers.DDPropagatorsupports DataDog trace headers.clear_span_buffer_consecutive_errorsnumberoptional, default=null - each consecutive buffer flush error will check to see ifclear_span_buffer_consecutive_errorshas been reached. If reached, the span buffer will be emptied. This is useful for auto-recovering from errors based on request size constraints, particularly max payload size on intermediate load balancers.
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()
}
})SpanImp
generateTraceURL()
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);Release process using circleCI
- Run command (patch, minor, major)
make release RELEASE_TYPE=patchRelease process using circleCI with custom version
- Run command
make release RELEASE_TYPE=v3.2.1-no-protobuf- It will create a tag "v3.2.1-no-protobuf" for version "3.2.1"
License
Copyright (c) 2016, LightStep
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago