zipkin-instrumentation-express
Express middleware and instrumentation that adds Zipkin tracing to the application.
Express Middleware
const express = ;const Tracer ExplicitContext ConsoleRecorder = ;const zipkinMiddleware = expressMiddleware; const ctxImpl = ;const recorder = ;const localServiceName = 'service-a'; // name of this applicationconst tracer = ctxImpl recorder localServiceName; const app = ; // Add the Zipkin middlewareapp;
Express HTTP Proxy
This library will wrap express-http-proxy to add headers and record traces.
const ConsoleRecorder Tracer ExplicitContext = ;const wrapExpressHttpProxy = ;const proxy = ; const ctxImpl = ;const recorder = ;const tracer = ctxImpl localServiceName: 'weather-app' recorder;const remoteServiceName = 'weather-api'; const zipkinProxy = ; app;
This can also be combined with Zipkin Express Middleware. Note the use of zipkin-context-cls
.
const ConsoleRecorder Tracer = ;const expressMiddleware wrapExpressHttpProxy = const CLSContext = ;const proxy = ; const ctxImpl = ;const recorder = ;const tracer = ctxImpl localServiceName: 'weather-app' recorder;const remoteServiceName = 'weather-api'; const zipkinProxy = ; app;