Socket
Socket
Sign inDemoInstall

@pionerlabs/grpc-interceptors

Package Overview
Dependencies
107
Maintainers
31
Versions
7
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
136
increased by78.95%
Maintainers
31
Install size
1.60 MB
Created
Weekly downloads
 

Readme

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

Last updated on 27 May 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc