@echo-health/grpc-interceptors

0.0.12 • Public • Published

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 server = interceptors.serverProxy(new grpc.Server());
server.addService(proto.MyPackage.MyService.service, { Method1, Method2 });

const myMiddlewareFunc = function (ctx, next) {

    // do stuff before call
    console.log('Making gRPC call...');

    await next()

    // do stuff after call
    console.log(ctx.status.code);
}

server.use(myMiddlewareFunc);

Available Interceptors

Readme

Keywords

none

Package Sidebar

Install

npm i @echo-health/grpc-interceptors

Weekly Downloads

6

Version

0.0.12

License

ISC

Unpacked Size

22 kB

Total Files

19

Last publish

Collaborators

  • markoecho
  • maximus1108
  • dthoecho
  • andflett
  • ilyatulvio
  • jaywayawyaj
  • echohealth