2.1.1 • Published 1 year ago

grpc-clients-tracking v2.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

grpc-clients-tracking

npm version npm downloads

Interceptors for the client and server to collect statistics about consumer calls through Prometheus

Install

npm i grpc-clients-tracking

Usage

const { clientInterceptorsFactory, serverInterceptor } = require("grpc-clients-tracking");

/*...*/

const server = await new GrpcHostBuilder()
  /*...*/
  .addInterceptor(serverInterceptor)
  /*...*/
  .bind(grpcBind)
  .buildAsync();

/*...*/
const client = new ServerClient(grpcBind, grpc.credentials.createInsecure(), {
  interceptors: [clientInterceptorsFactory()],
});

Metrics example

# HELP grpc_server_calls_total Total number of calls, made by various consumers.
# TYPE grpc_server_calls_total counter
grpc_server_calls_total{consumer_name="consumer-app",consumer_version="1.0.1",client_version="2.3.5",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
2.1.1

1 year ago

2.1.0

2 years ago

2.0.0

3 years ago

1.0.0

4 years ago