1.0.0 • Published 5 months ago

@coozzy/node-grpc-interceptors v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

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

1.0.0

5 months ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.10

3 years ago