{"bugs":{"url":"https://github.com/jaegertracing/jaeger-client-node/issues"},"dist":{"shasum":"e3309b4753007070b70dfd7d9b8edc11e6323f15","tarball":"https://registry.npmjs.org/jaeger-client/-/jaeger-client-3.9.2-dev0.tgz","fileCount":439,"integrity":"sha512-/mB+llMDZNDYePXNja69pdYTkX2Vypl5qFwJ9S+BSfl0ZQv1cGVe27UGtFGftVQ4t6UVTlN+tnS/pfuUbSTaIw==","signatures":[{"sig":"MEUCIQDMJG6MxUJHa3UaMYGCGUiUpw09NG1XvZa+JPUoLno1LQIgXbsrYXLe1QXsaGlPo0E4FNR/IwB3wghML0z/6l/w9Gg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2514476},"main":"./dist/src/index.js","name":"jaeger-client","_from":".","author":{"name":"Onwukike Ibe","email":"oibe@uber.com"},"readme":"[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![NPM Published Version][npm-img]][npm] [![OpenTracing 1.0 Enabled][ot-img]][ot-url]\n\n# Jaeger Bindings for Javascript OpenTracing API\n\nThis is [Jaeger](http://jaegertracing.io/)'s client side instrumentation library for Node.js that implements [Javascript OpenTracing API 1.0](https://github.com/opentracing/opentracing-javascript/).\n\n## Contributing and Developing\n\nPlease see [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Installation\n\n`npm install --save jaeger-client`\n\n## Initialization\n\n```javascript\nvar initTracer = require('jaeger-client').initTracer;\n\n// See schema https://github.com/jaegertracing/jaeger-client-node/blob/master/src/configuration.js#L37\nvar config = {\n  serviceName: 'my-awesome-service',\n};\nvar options = {\n  tags: {\n    'my-awesome-service.version': '1.1.2',\n  },\n  metrics: metrics,\n  logger: logger,\n};\nvar tracer = initTracer(config, options);\n```\n\n### Metrics and Logging\n\nThe `metrics` and `logger` objects shown in the above example must satisfy the [MetricsFactory](./src/_flow/metrics.js#L34) and [Logger](./src/_flow/logger.js) APIs respectively.\n\n## Usage\n\nThe Tracer instance created by `initTracer` is OpenTracing-1.0 compliant. See [opentracing-javascript](https://github.com/opentracing/opentracing-javascript) for usage examples.\n\n### TChannel Span Bridging\n\nBecause [tchannel-node](https://github.com/uber/tchannel-node) does not have instrumentation for OpenTracing, Jaeger-Client exposes methods wrapping tchannel handlers, and encoded channels. An encoded channel is a channel wrapped in either a thrift encoder `TChannelAsThrift`, or json encoder `TChannelAsJson`. To wrap a server handler for thrift one can initialize a tchannel bridge, and wrap the encoded handler function with a `tracedHandler` decorator. The tchannel bridge takes an OpenTracing tracer, and a context factory. The context factory must be a function that returns a context with the methods 'getSpan', and 'setSpan' which retrieve and assign the span to the context respectively.\n\n```javascript\nimport { TChannelBridge } from 'jaeger-client';\nimport Context from 'some-conformant-context';\n\nfunction contextFactory() {\n  return new Context();\n}\n\nlet bridge = new TChannelBridge(tracer, { contextFactory: contextFactory });\nlet server = new TChannel({ serviceName: 'server' });\nserver.listen(4040, '127.0.0.1');\nlet serverThriftChannel = TChannelAsThrift({\n  channel: server,\n  entryPoint: path.join(__dirname, 'thrift', 'echo.thrift'), // file path to a thrift file\n});\n\nlet perProcessOptions = {};\nserverThriftChannel.register(\n  server,\n  'Echo::echo',\n  perProcessOptions,\n  bridge.tracedHandler((perProcessOptions, req, head, body, callback) => {\n    /* Your handler code goes here. */\n  })\n);\n```\n\nOutbound calls can be made in two ways, shown below.\n\n#### Using encoded channel to create a request and calling `request.send()`\n\n```javascript\nimport { TChannelBridge } from 'jaeger-client';\n\nlet bridge = new TChannelBridge(tracer);\n// Create the toplevel client channel.\nlet client = new TChannel();\n\n// Create the client subchannel that makes requests.\nlet clientSubChannel = client.makeSubChannel({\n  serviceName: 'server',\n  peers: ['127.0.0.1:4040'],\n});\n\nlet encodedThriftChannel = TChannelAsThrift({\n  channel: clientSubChannel,\n  entryPoint: path.join(__dirname, 'thrift', 'echo.thrift'), // file path to a thrift file\n});\n\n// wrap encodedThriftChannel in a tracing decorator\nlet tracedChannel = bridge.tracedChannel(encodedThriftChannel);\n\n// The encodedThriftChannel's (also true for json encoded channels) request object can call 'send' directly.\nlet req = tracedChannel.request({\n  serviceName: 'server',\n  context: context, // must be passed through from the service handler shown above\n  headers: { cn: 'echo' },\n});\n\n// headers should contain your outgoing tchannel headers if any.\n// In this instance 'send' is being called on the request object, and not the channel.\nreq.send('Echo::echo', headers, { value: 'some-string' });\n```\n\n#### Using top level channel to create a request and calling `encodedChannel.send(request)`\n\n```javascript\nlet tracedChannel = bridge.tracedChannel(encodedThriftChannel);\n\n// tracedChannel.channel refers to encodedThriftChannel's inner channel which\n// is clientSubChannel in this instance.\nlet req = tracedChannel.channel.request({\n  serviceName: 'server',\n  headers: { cn: 'echo' },\n  context: context, // must be passed through from the service handler shown above\n  timeout: someTimeout,\n});\n// send() can be called directly on the tracing decorator\ntracedChannel.send(req, 'Echo::echo', o.headers, { value: 'some-string' }, clientCallback);\n```\n\n### Debug Traces (Forced Sampling)\n\n#### Programmatically\n\nThe OpenTracing API defines a `sampling.priority` standard tag that can be used to affect the sampling of a span and its children:\n\n```javascript\nspan.setTag(opentracing_tags.SAMPLING_PRIORITY, 1);\n```\n\n#### Via HTTP Headers\n\nJaeger Tracer also understands a special HTTP Header `jaeger-debug-id`, which can be set in the incoming request, e.g.\n\n```sh\ncurl -H \"jaeger-debug-id: some-correlation-id\" http://myhost.com\n```\n\nWhen Jaeger sees this header in the request that otherwise has no tracing context, it ensures that the new trace started for this request will be sampled in the \"debug\" mode (meaning it should survive all downsampling that might happen in the collection pipeline), and the root span will have a tag as if this statement was executed:\n\n```javascript\nspan.setTag('jaeger-debug-id', 'some-correlation-id');\n```\n\nThis allows using Jaeger UI to find the trace by this tag.\n\n### Zipkin Compatibility\n\nSupport for [Zipkin's B3 Propagation HTTP headers](https://github.com/openzipkin/b3-propagation) is provided by the `ZipkinB3TextMapCodec`, which can be configured instead of the default `TextMapCodec`.\n\nThe new codec can be used by registering it with a tracer instance as both an injector and an extractor:\n\n```\nlet codec = new ZipkinB3TextMapCodec({ urlEncoding: true });\n\ntracer.registerInjector(opentracing.FORMAT_HTTP_HEADERS, codec);\ntracer.registerExtractor(opentracing.FORMAT_HTTP_HEADERS, codec);\n```\n\nThis can prove useful when compatibility with existing Zipkin tracing/instrumentation is desired.\n\n## License\n\n[Apache 2.0 License](./LICENSE).\n\n[ci-img]: https://travis-ci.org/jaegertracing/jaeger-client-node.svg?branch=master\n[ci]: https://travis-ci.org/jaegertracing/jaeger-client-node\n[cov-img]: https://coveralls.io/repos/github/jaegertracing/jaeger-client-node/badge.svg?branch=master\n[cov]: https://coveralls.io/github/jaegertracing/jaeger-client-node?branch=master\n[npm-img]: https://badge.fury.io/js/jaeger-client.svg\n[npm]: https://www.npmjs.com/package/jaeger-client\n[ot-img]: https://img.shields.io/badge/OpenTracing--1.0-enabled-blue.svg\n[ot-url]: http://opentracing.io\n","_shasum":"e3309b4753007070b70dfd7d9b8edc11e6323f15","engines":{"node":">=0.10"},"gitHead":"9083421ccd9de3c8eb2b6f9fb9921708873f6bf4","license":"Apache-2.0","scripts":{"flow":"flow","lint":"eslint $(ls src/ | grep '.js$') && echo '# linter passed' && npm run check-license","test":"make test","cover":"babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha -- test/ test/samplers/ test/baggage/","format":"prettier --write '**/*.{js,json,md}'","check-ls":"npm ls --loglevel=http --parseable 1>/dev/null && echo '# npm is in a good state'","test-all":"npm run test-core && npm run test-samplers && npm run test-crossdock && npm run test-baggage","coveralls":"npm run cover && cat ./coverage/lcov.info | coveralls","precommit":"lint-staged","test-core":"mocha --compilers js:babel-core/register test","test-dist":"mocha dist/test/ dist/test/baggage/ dist/test/samplers/","show-cover":"open coverage/lcov-report/index.html","test-baggage":"mocha --compilers js:babel-core/register test/baggage","check-license":"./scripts/check-license.sh","test-samplers":"mocha --compilers js:babel-core/register test/samplers","test-crossdock":"mocha --compilers js:babel-register crossdock/test"},"_npmUser":{"name":"uber","email":"opensource@uber.com"},"homepage":"https://github.com/jaegertracing/jaeger-client-node#readme","keywords":[],"repository":{"url":"git://github.com/jaegertracing/jaeger-client-node.git","type":"git"},"_npmVersion":"3.10.8","description":"Jaeger binding for OpenTracing Node","directories":{},"lint-staged":{"*.{js,json,md}":["prettier --write","git add"]},"maintainers":[{"name":"uber","email":"opensource@uber.com"},{"name":"wjang","email":"wonjun.jangobe@gmail.com"},{"name":"yurishkuro","email":"npmjs@ysh.us"}],"_nodeVersion":"6.9.1","contributors":[{"name":"Yuri Shkuro","email":"ys@uber.com"},{"name":"Won Jun Jang","email":"wjang@uber.com"}],"dependencies":{"thriftrw":"^3.5.0","xorshift":"^0.2.0","node-int64":"^0.4.0","opentracing":"^0.13.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"^3.5.0","rsvp":"^3.3.1","husky":"^0.14.3","mocha":"^3.0.1","sinon":"^1.17.5","eslint":"^3.14.1","lodash":"^4.15.0","semver":"^5","express":"^4.14.0","request":"2.74.0","flow-bin":"^0.30.0","minimist":"1.2.0","prettier":"1.10.2","tchannel":"^3.9.0","babel-cli":"^6.11.4","benchmark":"^2.1.1","coveralls":"^2.11.14","underscore":"^1.8.3","body-parser":"^1.15.2","lint-staged":"^6.0.0","uber-licence":"^2.0.2","babel-istanbul":"^0.11.0","babel-register":"^6.11.6","gulp-sourcemaps":"1.7.x","babel-preset-env":"^1.6.1","beautify-benchmark":"^0.2.4","source-map-support":"^0.4.5","eslint-plugin-react":"^7.1.0","eslint-config-airbnb":"^15.1.0","eslint-plugin-import":"^2.8.0","eslint-config-prettier":"^2.9.0","eslint-plugin-flowtype":"^2.4.0","eslint-plugin-jsx-a11y":"^5.1.1","babel-plugin-transform-class-properties":"^6.11.5","babel-plugin-transform-flow-strip-types":"^6.8.0"},"_npmOperationalInternal":{"tmp":"tmp/jaeger-client_3.9.2-dev0_1520022116910_0.1397032498110582","host":"s3://npm-registry-packages"},"_id":"jaeger-client@3.9.2-dev0","version":"3.9.2-dev0"}