Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grpc-prometheus

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-prometheus

Interceptor for the server to collect statistics of calls through Prometheus

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

grpc-prometheus

npm version npm downloads

Interceptor for the server to collect statistics of calls through Prometheus

Install

npm i grpc-prometheus

Usage

const { serverInterceptorsFactory } = require("grpc-prometheus");

/*...*/

const server = await new GrpcHostBuilder()
  /*...*/
  .addInterceptor(
    serverInterceptorsFactory({
      timeBuckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 10],
    })
  )
  /*...*/
  .bind(grpcBind)
  .buildAsync();

Metrics example

# HELP grpc_server_handled_total Total number of RPCs completed on the server, regardless of success or failure.
# TYPE grpc_server_handled_total counter
grpc_server_handled_total{grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1

# HELP grpc_server_handling_seconds Histogram of response latency (seconds) of gRPC that had been application-level handled by the server.
# TYPE grpc_server_handling_seconds histogram
grpc_server_handling_seconds_bucket{le="0.005",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.01",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.025",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.05",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.1",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.25",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="0.5",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="1",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="2.5",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="10",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_bucket{le="+Inf",grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1
grpc_server_handling_seconds_sum{grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 0.001358001
grpc_server_handling_seconds_count{grpc_code="OK",grpc_method="SayHello",grpc_service="v1.Greeter",grpc_type="unary"} 1

Keywords

FAQs

Package last updated on 13 Mar 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc