Socket
Book a DemoInstallSign in
Socket

@bookmate/zipkin-express-helpers

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bookmate/zipkin-express-helpers

Add zipkin headers to Express request object and read them back

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

zipkin-express-helpers

Instruments for adding zipkin headers to an Express request object and for reading them back.

Installation

npm install --save @bookmate/zipkin-express-helpers

Usage

If all you need is just to add zipkin headers to requests in Express (e.g. if you are using Express as a proxy), the most convenient way is to use a middleware:

const express = require('express');
const { createZipkinExpressMiddleware } = require('@bookmate/zipkin-express-helpers');

const localServiceName = 'name of this application';

const app = express();

app.use(createZipkinExpressMiddleware({localServiceName}));

For more fine-grained control, you may want to use ZipkinRequestDecorator (which is used in the middleware):

const express = require('express');
const { ZipkinRequestDecorator } = require('@bookmate/zipkin-express-helpers');

const localServiceName = 'name of this application';
const zipkinRequestDecorator = new ZipkinRequestDecorator({ localServiceName });

const customMiddleware = (req, res, next) => {
  zipkinRequestDecorator.addZipkinHeadersToRequest(req);
  // some custom logic
  next();
}

const app = express();

app.use(customMiddleware);

To read zipkin headers from a request, use readZipkinHeadersFromRequest function:

const { readZipkinHeadersFromRequest } = require('@bookmate/zipkin-express-helpers');

function myFunc(req) {
  const zipkinHeaders = readZipkinHeadersFromRequest(req);
  // do something with the headers
}

FAQs

Package last updated on 05 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.