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

python-grpc-prometheus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-grpc-prometheus

Python gRPC Prometheus Interceptors

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

python-grpc-prometheus

Build Status

ChangeLog

Installation

Installation from PyPI:

pip install python-grpc-prometheus

Usage

Check the available interceptors in the source code. This example uses the PromServerInterceptor. Usage example:

import grpc
from concurrent.futures import ThreadPoolExecutor
# Importing this whole package so that I can use prometheus_client.start_http_server()
# instead of just start_http_server(), which is not too descriptive. But it's your call.
import prometheus_client
from python_grpc_prometheus.prometheus_server_interceptor import PromServerInterceptor


# Add the required interceptor(s) where you create your grpc server, e.g.
psi = PromServerInterceptor()
server = grpc.server(ThreadPoolExecutor(max_workers=10), interceptors=(psi,))
# Start the http server where prometheus can fetch the data from. Use whatever listen port you prefer.
prometheus_client.start_http_server(8000)
# ...

Now, when running your application, you can check http://localhost:8000 in a browser. Note: the grpc_* metrics will just show commented out (with their descriptions) until your application actually receives gRPC calls.

TODO

  • add stream support

FAQs


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