python-grpc-prometheus
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
import prometheus_client
from python_grpc_prometheus.prometheus_server_interceptor import PromServerInterceptor
psi = PromServerInterceptor()
server = grpc.server(ThreadPoolExecutor(max_workers=10), interceptors=(psi,))
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