Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pionerlabs/grpc-interceptors

Package Overview
Dependencies
Maintainers
31
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pionerlabs/grpc-interceptors

This library provides a way to instrument Node.js gRPC clients and servers with interceptors/middleware e.g. for Prometheus metrics, Zipkin tracing etc.

  • 0.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98
increased by46.27%
Maintainers
31
Weekly downloads
 
Created
Source

grpc-interceptors

This library provides a way to instrument Node.js gRPC clients and servers with interceptors/middleware e.g. for Prometheus metrics, Zipkin tracing etc.

Usage

const interceptors = require('grpc-interceptors');
const grpc = require('grpc');

const server = interceptors.serverProxy(new grpc.Server());
server.addService(proto.MyPackage.MyService.service, { Method1, Method2 });

const myMiddlewareFunc = async function (ctx, next, errorCb) {

    try {
    // do stuff before call
    console.log('Making gRPC call...');
    await next()
    // do stuff after call
    console.log(ctx.status.code);
    } catch(e) {
        errorCb({
            code: grpc.status.INTERNAL,
            message: 'Some error occurred!'
        });
    }
}

server.use(myMiddlewareFunc);


Available Interceptors

  • client-zipkin-interceptor
  • server-zipkin-interceptor
  • prometheus-interceptor

FAQs

Package last updated on 27 May 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc