Socket
Book a DemoInstallSign in
Socket

@coozzy/node-grpc-interceptors

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coozzy/node-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.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
3
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 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

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

FAQs

Package last updated on 07 Dec 2023

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