This package, `zipkin-transport-http`, provides the official HTTP transport mechanism for sending Zipkin trace data to a Zipkin collector server. It is a core component within the larger `zipkin-js` ecosystem, designed to integrate seamlessly with other `zipkin-js` packages like `zipkin` (for `BatchRecorder`) and various instrumentation libraries. The current stable version is `0.22.0`, released recently with improvements like a fallback for `fetch` and fixes. The project maintains a fairly active release cadence, frequently addressing bugs, adding new features such as configurable `fetch` API and SQS support in related packages, and improving TypeScript interfaces. Its primary differentiator is its deep integration and official support within the OpenZipkin JavaScript tracing suite, ensuring compatibility and alignment with Zipkin's tracing specifications.
npm install zipkin-transport-httpVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing `HttpLogger` with `node-fetch`, integrating it into a `BatchRecorder`, and creating a `Tracer` to send a simple span to a Zipkin collector.
Upgrade your Node.js runtime to version 10 or higher. For LTS recommendations, refer to Node.js official release schedule.
Upgrade your Node.js runtime to version 8 or higher (preferably 10+ due to the subsequent drop of Node.js 8 support).
Install `node-fetch` in your project: `npm install node-fetch@"^2.6.7"` (or `yarn add node-fetch@"^2.6.7"`). Note the peer dependency range `^1.4.0 <3.0.0` for `node-fetch`.
Upgrade `zipkin-transport-http` to version `0.18.6` or newer to resolve this specific error.
Ensure `node-fetch` is installed (`npm install node-fetch`) and passed explicitly as the `fetch` option during `HttpLogger` instantiation: `new HttpLogger({ endpoint: '...', fetch: require('node-fetch') })` or `fetch: fetch` if using ESM.Upgrade `zipkin-transport-http` to version `0.18.6` or newer. If the problem persists, ensure your Babel/TypeScript configuration is not aggressively transpiling `zipkin`'s internal classes.
For short-lived processes, manually call `recorder.flush()` before the process exits. For example, `await new Promise(resolve => recorder.flush(() => resolve()));`