{"_id":"@creditkarma/zipkin-client-filter","_rev":"1-13a7c024b717d6302bf2237fe8ffc209","name":"@creditkarma/zipkin-client-filter","dist-tags":{"next":"0.11.0-alpha.0","latest":"0.11.0-alpha.0"},"versions":{"0.11.0-alpha.0":{"name":"@creditkarma/zipkin-client-filter","version":"0.11.0-alpha.0","description":"Express server middleware for the Apache Thrift protocol","main":"dist/main/index.js","types":"dist/main/index.d.ts","keywords":["thrift","typescript","tracing","zipkin"],"scripts":{"clean":"rimraf ./dist","lint":"tslint --fix './src/**/*.ts'","format":"prettier --write 'src/**/*.ts'","prebuild":"npm run clean && npm run lint && npm run format","build":"tsc","test":"npm run test:only","test:only":"echo 'No tests for zipkin-client-filter'; exit 0;"},"dependencies":{"@types/request":"^2.48.1","request":"^2.88.0","zipkin":"^0.14.3"},"peerDependencies":{"@creditkarma/thrift-client":"0.10.x","@creditkarma/thrift-server-core":"0.10.x","@creditkarma/thrift-zipkin-core":"0.10.x"},"devDependencies":{"@creditkarma/thrift-client":"^0.11.0-alpha.0","@creditkarma/thrift-server-core":"^0.11.0-alpha.0","@creditkarma/thrift-typescript":"^3.0.3-0","@creditkarma/thrift-zipkin-core":"^0.11.0-alpha.0","@types/node":"^8.10.38","prettier":"^1.15.1","rimraf":"^2.6.2","tslint":"^5.11.0","tslint-config-prettier":"^1.15.0","tslint-plugin-prettier":"^2.0.0","typescript":"3.1.x"},"_id":"@creditkarma/zipkin-client-filter@0.11.0-alpha.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},"dist":{"integrity":"sha512-M37cqLbQZ7DTXKceDBi1U9bmxm0e1b9F959PhwJy+OlQbjROTTPZz7PLQLOIp4dNptahoN9dveLrsQd705/Sfw==","shasum":"ffb0c1c191adf9ab4b023610b67715a73f509bfa","tarball":"https://registry.npmjs.org/@creditkarma/zipkin-client-filter/-/zipkin-client-filter-0.11.0-alpha.0.tgz","fileCount":9,"unpackedSize":22689,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcAKceCRA9TVsSAnZWagAAkC8P/RFw4sN9/a8p89D4khOa\nmxA2OyPlVvKXc1tkTDCRRNc9Q8kI5BJm1rK1YmV+NP+Sxgs5Bui/+M6h3IVw\nwbt+35newd4LN4UoUg3q7L20DDzm4udekPbUjy236WLI7/znz7rE8L99Cgag\nuI790mXrld8gTdctSfSS9sOFQK658uTT4nUOFTwbhpwH9PFMjX60lcUFMJLK\nUWNpmiK3u9T8kK4qO2xCy6561zslAb+cySfEO+lE7fOn3CdXEsDw8M3bDG6Y\njvJsLEj7qFz7+VvKLVrTC6m7ne7TBrQWyWG0zirHb4f5M5xW2rSdMymFmU3u\nw7p8dAmiEQVZaR8CaA2QWiVPl3RMl5z2aWG9Z07W2lD9xepcWb+8upG5ZqXn\n63JH741wM8w+VpXYAKjM4OkaEEffy5OKeax4VISa49OzP6rrFvQyB+Div4bw\nBYyiIxig3eTMd2D30TYXcryiL8oCPdLhtmjBygxvwIC/rsAZU1yk2Jjb6shw\n+AZP2x7hZfIQX5ksPqjwbDAf6FxbeZXEGxAOsSvGWhSEXOtg66IqKExnOH2D\nX9RwUwOe7xlJFkT1zCk39jYEOVMwprN/DlZiqi3NCS1e9nLuoyzLr4CySPr9\nTYX7w+r/POPqwGd3Qwxd4zzkk83W19yjvaY5FzGS/YTvrihDoFfFDjgE0oox\n6goa\r\n=Yrbb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5n++yy2ya8UChZ+dftCAHI5Jhzo2Kkl6DJwDBF6rPkAIhAI2YWfMN0NF6CxPaTm1shWenKHatImJT+HrLYtmMwvdg"}]},"maintainers":[{"name":"ouranosskia","email":"UGAPiro@gmail.com"},{"name":"ck-npm","email":"pie@creditkarma.com"},{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},{"name":"nnanceck","email":"nick.nance@creditkarma.com"},{"name":"wookiehangover","email":"samuel.breed@gmail.com"},{"name":"riley-stroud-ck","email":"riley.stroud@creditkarma.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zipkin-client-filter_0.11.0-alpha.0_1543546653883_0.7299747139023187"},"_hasShrinkwrap":false}},"time":{"created":"2018-11-30T02:57:33.808Z","0.11.0-alpha.0":"2018-11-30T02:57:34.004Z","modified":"2022-04-05T01:46:06.354Z"},"maintainers":[{"name":"ouranosskia","email":"UGAPiro@gmail.com"},{"name":"ck-npm","email":"pie@creditkarma.com"},{"name":"hightimesteddy","email":"hightimesteddy@gmail.com"},{"name":"nnanceck","email":"nick.nance@creditkarma.com"},{"name":"wookiehangover","email":"samuel.breed@gmail.com"},{"name":"riley-stroud-ck","email":"riley.stroud@creditkarma.com"}],"description":"Express server middleware for the Apache Thrift protocol","keywords":["thrift","typescript","tracing","zipkin"],"readme":"# Zipkin Client Filter\n\nOne of the problems that arise in microservice architectures is tracing the life of a request. Where do errors occur? Where are latencies? Just understanding all of the services a request touches can be non-trivial in complex systems.\n\nThis filter for [@creditkarma/thrift-client](https://github.com/creditkarma/thrift-server/tree/master/packages/thrift-client) helps to solve this problem by adding support for distributed tracing with [Zipkin](https://github.com/openzipkin/zipkin-js).\n\n## Installation\n\n`ZipkinClientFilter` has a few `peerDependencies`.\n\n```sh\nnpm install --save @creditkarma/thrift-server-core\nnpm install --save @creditkarma/thrift-client\nnpm install --save @creditkarma/thrift-zipkin-core\nnpm install --save @creditkarma/zipkin-client-filter\n```\n\n## Usage\n\nZipkin tracing is added to your Thrift client through filters.\n\n```typescript\nimport {\n    createHttpClient,\n} from '@creditkaram/thrift-client'\n\nimport {\n    ZipkinClientFilter,\n} from '@creditkarma/zipkin-client-filter'\n\nimport { Calculator } from './codegen/calculator'\n\nconst thriftClient: Calculator.Client<ThriftContext<CoreOptions>> =\n    createHttpClient(Calculator.Client, {\n        hostName: 'localhost',\n        port: 8080,\n        register: [ ZipkinClientFilter({\n            localServiceName: 'calculator-client',\n            remoteServiceName: 'calculator-service',\n            tracerConfig: {\n                endpoint: 'http://localhost:9411/api/v1/spans',\n                sampleRate: 0.1,\n            }\n        }) ]\n    })\n```\n\nIn order for tracing to be useful the services you are communicating with will also need to be setup with Zipkin tracing. Plugins are available for `thrift-server-hapi` and `thrift-server-express`. The provided plugins in Thrift Server only support HTTP transport at the moment.\n\n### Options\n\n* localServiceName (required): The name of your service.\n* remoteServiceName (optional): The name of the service you are calling.\n* tracerConfig.debug (optional): In debug mode all requests are sampled.\n* tracerConfig.endpoint (optional): URL of your collector (where to send traces).\n* tracerConfig.sampleRate (optional): Percentage (from 0 to 1) of requests to sample. Defaults to 0.1.\n* tracerConfig.httpInterval (optional): Sampling data is batched to reduce network load. This is the rate (in milliseconds) at which to empty the sample queue. Defaults to 1000.\n\nIf the endpoint is set then the plugin will send sampling data to the given endpoint over HTTP. If the endpoint is not set then sampling data will just be logged to the console.\n\n### Tracing Non-Thrift Endpoints\n\nSometimes, as part of completing your service request, you may need to gather data from both Thrift and non-Thrift endpoints. To get a complete picture you need to trace all of these calls. You can add Zipkin to other requests with instrumentation provided by the [OpenZipkin](https://github.com/openzipkin/zipkin-js) project.\n\nWhen constructing instrumentation provided by another library you need to use the same `Tracer` in order to maintain the correct trace context. You can import this shared `Tracer` through a call to `getTracerForService`. This assumes a `Tracer` has already been created for your service by usage of one of the Thrift Zipkin plugins.\n\n```typescript\nimport { getTracerForService } from '@creditkarma/thrift-server-core'\nimport * as wrapRequest from 'zipkin-instrumentation-request'\nimport * as request from 'request'\n\nconst tracer = getTracerForService('calculator-client')\nconst zipkinRequest = wrapRequest(request, { tracer, remoteServiceName: 'calculator-service' })\nzipkinRequest.get(url, (err, resp, body) => {\n    // Do something\n})\n```\n\n## Contributing\n\nFor more information about contributing new features and bug fixes, see our [Contribution Guidelines](../../CONTRIBUTING.md).\nExternal contributors must sign Contributor License Agreement (CLA)\n\n## License\n\nThis project is licensed under [Apache License Version 2.0](./LICENSE)\n","readmeFilename":"README.md"}