Registry / observability / zipkin-instrumentation-express

zipkin-instrumentation-express

JSON →
library0.22.0jsnpmunverified

Express middleware for distributed tracing with Zipkin.js. Version 0.22.0 is current stable, released as part of the openzipkin/zipkin-js monorepo with irregular release cadence. This package provides middleware that creates Zipkin spans for incoming HTTP requests to Express applications, automatically recording timing, tags, and annotations. Key differentiators: minimal configuration, tight integration with Zipkin's B3 propagation headers, support for custom sampler and tracer configurations. Suitable for Node.js Express apps requiring observability via Zipkin. Note: Not actively maintained (last release 0.22.0).

npm install zipkin-instrumentation-express
INSTALL
IMPORT
SIG · ZIPKIN-INSTRUMENTA
Z
zipkin-instrumentation-express
observabilityjavascriptv0.22.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

expressMiddleware
import { expressMiddleware } from 'zipkin-instrumentation-express'
const expressMiddleware = require('zipkin-instrumentation-express')
ESM and CommonJS both supported; TypeScript types included.
expressMiddleware (default)
import expressMiddleware from 'zipkin-instrumentation-express'
import { expressMiddleware as default } from 'zipkin-instrumentation-express'
Package has a default export as well as named export; both work.

Sets up Zipkin tracing middleware for Express app using batch recorder and HTTP transport.

import { Tracer, BatchRecorder, jsonEncoder } from 'zipkin'; import { HttpLogger } from 'zipkin-transport-http'; import { expressMiddleware } from 'zipkin-instrumentation-express'; import express from 'express'; const tracer = new Tracer({ recorder: new BatchRecorder({ logger: new HttpLogger({ endpoint: process.env.ZIPKIN_ENDPOINT || 'http://localhost:9411/api/v2/spans', jsonEncoder: jsonEncoder.JSON_V2 }) }), localServiceName: 'my-service' }); const app = express(); app.use(expressMiddleware({ tracer })); app.get('/', (req, res) => res.send('Hello tracing!')); app.listen(3000);
Debug
Known issues
deprecatedRequire-style import of zipkin modules may break in future versions; prefer ESM imports.
fix
Use import instead of require() for all zipkin packages.
affects: >=0.22.0
gotchaexpressMiddleware must be added before route handlers to trace all requests.
fix
Ensure the middleware is applied before app.get(), app.post(), etc.
affects: >=0.16.0
gotchaTracer's localServiceName must be set; otherwise, spans may be missing service name.
fix
Provide localServiceName when creating Tracer instance.
affects: >=0.19.0
Errors
Common errors & fixes
Error: Must be valid TraceId instance
Incorrect or missing tracer configuration leads to invalid Zipkin trace IDs.
fix
Ensure Tracer is initialized with a valid sampler and recorder.
TypeError: Cannot destructure property 'tracer' of 'undefined' or 'null'
expressMiddleware() called without options object or missing tracer property.
fix
Call expressMiddleware({ tracer }) where tracer is a valid Zipkin Tracer instance.
Upgrade
Version history
0.22.0latest on npm
Audit
Dependencies
zipkinrequiredCore Zipkin library required for tracer creation
expressrequiredPeer dependency for instrumentation to work with Express app
Agent activity
46 hits · last 30 days
node
38
OpenAI (training)
1
Resources
zipkin-instrumentation-express — npm install zipkin-instrumentation-express · libregistry