{"id":18767756,"url":"https://github.com/lightstep/lightstep-tracer-javascript","last_synced_at":"2025-04-04T10:06:12.351Z","repository":{"id":37617524,"uuid":"49531341","full_name":"lightstep/lightstep-tracer-javascript","owner":"lightstep","description":"Lightstep distributed tracing library for Node.js and the browser","archived":false,"fork":false,"pushed_at":"2023-10-06T01:24:57.000Z","size":8143,"stargazers_count":77,"open_issues_count":24,"forks_count":66,"subscribers_count":68,"default_branch":"master","last_synced_at":"2025-03-28T09:04:59.243Z","etag":null,"topics":["opentracing"],"latest_commit_sha":null,"homepage":"https://lightstep.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightstep.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-01-12T21:54:18.000Z","updated_at":"2023-05-30T19:16:44.000Z","dependencies_parsed_at":"2023-02-18T04:31:03.962Z","dependency_job_id":null,"html_url":"https://github.com/lightstep/lightstep-tracer-javascript","commit_stats":{"total_commits":445,"total_committers":53,"mean_commits":8.39622641509434,"dds":0.6539325842696629,"last_synced_commit":"9d2f3ee3d5d714ca31003af3858b54ff24f58104"},"previous_names":[],"tags_count":126,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightstep%2Flightstep-tracer-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightstep","download_url":"https://codeload.github.com/lightstep/lightstep-tracer-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247156881,"owners_count":20893201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opentracing"],"created_at":"2024-11-07T19:08:27.997Z","updated_at":"2025-04-04T10:06:12.330Z","avatar_url":"https://github.com/lightstep.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lightstep-tracer [Deprecated]\n\n\u003e ❗ **This instrumentation is no longer recommended**. Please review [documentation on setting up and configuring the OpenTelemetry Node.js Launcher](https://github.com/lightstep/otel-launcher-node) or [OpenTelemetry JS (Browser)](https://github.com/open-telemetry/opentelemetry-js) for more information on migrating to OpenTelemetry.\n\n[![npm version](https://badge.fury.io/js/lightstep-tracer.svg)](https://badge.fury.io/js/lightstep-tracer)\n[![Circle CI](https://circleci.com/gh/lightstep/lightstep-tracer-javascript.svg?style=shield)](https://circleci.com/gh/lightstep/lightstep-tracer-javascript)\n[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n\nIn August 2023, [Lightstep became ServiceNow\nCloud Observability](https://docs.lightstep.com/docs/banner-faq) To ease the\ntransition, all code artifacts will continue to use the Lightstep name. You\ndon't need to do anything to keep using this repository.\n\nLightStep distributed tracing library for Node.js and the browser.\n\n## Installation\n\n```\nnpm install --save lightstep-tracer opentracing\n```\n\nAll modern browsers and Node versions \u003e= 12 are supported. Users who need support for Node 8 and 10 can use v0.32.0 and prior.\n\n## Getting started\n\nTo use LightStep as the OpenTracing binding, initialize the global `Tracer` with the LightStep implementation:\n\n```javascript\nvar opentracing = require('opentracing');\nvar lightstep   = require('lightstep-tracer');\n\nopentracing.initGlobalTracer(new lightstep.Tracer({\n    access_token   : '{your_access_token}',\n    component_name : '{your_service_or_app_name}',\n}));\n```\n\nThe **[LightStep JavaScript Tracing Cookbook](doc/cookbook.md)** 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](doc/cookbook.md#browser-quick-start)**.\n\n* For more information about using the OpenTracing API, see http://opentracing.io/\n* See [examples/browser](https://github.com/lightstep/lightstep-tracer-javascript/tree/master/examples/browser) for a complete JavaScript browser example\n* See [examples/node](https://github.com/lightstep/lightstep-tracer-javascript/tree/master/examples/node) for a complete Node.js server-side example\n\nThe browser version of the code can be explicitly included using the following, which can be helpful in some [`browserify`](https://github.com/substack/node-browserify) (or similar) setups:\n\n```javascript\nvar lightstep = require('lightstep-tracer/browser');\n```\n\n\n## LightStep-specific API\n\nThe OpenTracing standard JavaScript API is [documented here](https://doc.esdoc.org/github.com/opentracing/opentracing-javascript/). The following describes LightStep-specific options and methods.\n\n### LightStep\n\n---\n\n#### new Tracer(options)\n\n**Required options**\n\n* `access_token` `string` *required* - the project access token\n* `component_name` `string` *required* - the string identifier for the application, service, or process\n\n**Standard options**\n\n* `verbosity` `number` *optional, default=1* - controls the level of logging to the console\n    - `0` - the client library will *never* log to the console\n    - `1` - error reporting will be throttled to the first error per minute\n    - `2` - all errors are logged to the console\n    - `3` - all errors, warnings, and info statements are logged to the console\n    - `4` - all log statements, including debugging details\n* `collector_host` `string` *optional* - custom collector hostname\n* `collector_port` `number` *optional* - custom collector port\n* `collector_path` `string` *optional* - custom collector base path (if served behind a reverse proxy)\n* `collector_encryption` `string` *optional, default='tls'*\n    - `tls` - use HTTPS encrypted connections\n    - `none` - use HTTP plain-text connections\n\n**Browser-specific initialization options**\n\n* `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.\n\n* `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.\n\n* `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`.\n\n* `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`.\n\n* `xhr_url_header_inclusion_patterns` `RegExp[]` - an array of regular expressions used to include URLs which auto-instrumented `XMLHttpRequest`s 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`.\n\n* `xhr_url_header_exclusion_patterns` `RegExp[]` - an array of regular expressions used to exclude URLs that auto-instrumented `XMLHttpRequest`s 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`.\n\n* `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.\n\n* `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`.\n\n* `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`.\n\n* `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`.\n\n* `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`.\n\n* `include_cookies` `bool` - if true, includes cookies in the span logs for both `window.fetch` and `XMLHttpRequest`. Defaults to true.\n\n**node-specific initialization options**\n\n* `nodejs_instrumentation` `bool` - if false, disables automatic instrumentation of node requests.\nThis must be set at initialization; changes after initialization will have no effect. Defaults to false.\n\n* `nodejs_url_inclusion_patterns` `RegExp[]` - an array of regular expressions used to whitelist\nURLs\nfor the `http` and `https` modules auto-instrumentation. The default value is wildcard matching all strings.\nFor a given URL to be instrumented, it must match at least one regular expression in\n`nodejs_url_inclusion_patterns` and not match any regular expressions in\n`nodejs_url_exclusion_patterns`.\n\n* `nodejs_url_exclusion_patterns` `RegExp[]` - an array of regular expressions used to exclude URLs\nfrom the `http` and `https` modules auto-instrumentation. The default value is an empty array. For a given URL\nto be instrumented, it must match at least one regular expression in\n`nodejs_url_inclusion_patterns`\nand not match any regular expressions in `nodejs_url_exclusion_patterns`.\n\n**Non-standard options**\n\n*NOTE: Future API compatibility on non-standard options is not guaranteed.*\n\n* `disable_reporting_loop` `bool` *optional*, *default=false* - if true, the timer that automatically sends reports to the collector will be disabled. This option is independent of `disable_report_on_exit`.\n* `disable_report_on_exit` `bool` *optional*, *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.\n* `report_timeout_millis` `number` *optional*, *default=30000* - the default timeout value, in milliseconds, for reports to the LightStep collector\n* `gzip_json_requests` `bool` *optional*, *default=true* - if true, the reports will be gzipped before sent to the collector.\n* `default_span_tags` `string` *optional* - an associative array of tags to add to every span started by the tracer (e.g., the active user id in a browser client)\n* `delay_initial_report_millis` `int` *optional*, *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.\n* `error_throttle_millis` `int` *optional*, *default=60000* - when `verbosity` is set to `1`, this the minimum time between logged errors.\n* `transport` `string` *optional*, *default=proto* - when `transport` is set to `thrift`, the Tracer will use Thrift as its transport instead of Proto over HTTP. (Not supported in React-Native)\n* `logger` `function(level: string, message: string, payload: any): void` *optional* - specify a custom logger function. Possible `level` values are `debug`, `info`, `warn` and `error`. By default messages will be logged to the console.\n* `disable_meta_event_reporting` `bool` *optional*, *default=false* - when `disable_meta_event_reporting` is set to `true`, the tracer will disable meta event reporting even if requested by the Satellite.\n* `propagators` `dictionary` *optional*, *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 includes `B3Propagator` that supports B3 headers on text maps and http headers. `DDPropagator` supports DataDog trace headers.\n* `clear_span_buffer_consecutive_errors` `number` *optional*, *default=null* - each consecutive buffer flush error will check to see if `clear_span_buffer_consecutive_errors` has 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. \n\nAn example configuration using custom propagators might look like:\n```js\nconst tracer = new lightstep.Tracer({\n  propagators: {\n    [opentracing.FORMAT_HTTP_HEADERS]: new lightstep.DDPropagator(),\n    [opentracing.FORMAT_TEXT_MAP]: new lightstep.B3Propagator()\n  }\n})\n```\n\n### SpanImp\n\n---\n\n#### generateTraceURL()\n\nReturns an absolute URL to the LightStep application for the trace containing this span. It is safe to call this method after `finish()`.\n\n```js\n...\nspan.finish();\n\nvar url = span.generateTraceURL())\nconsole.log('View the trace for this span at:', url);\n```\n\n\n### Release process using circleCI \n1. Run command\n```commandline\nmake release RELEASE_TYPE=patch\n```\n\n\n## License\n\n[The MIT License](LICENSE).\n\nCopyright (c) 2016, LightStep\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightstep%2Flightstep-tracer-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightstep%2Flightstep-tracer-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightstep%2Flightstep-tracer-javascript/lists"}