Skip to main content

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

Release files for python-grpc-prometheus 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-grpc-prometheus 0.2.0
File Size Uploaded
python_grpc_prometheus-0.2.0.tar.gz 4.4 kB Details

Release files / python_grpc_prometheus-0.2.0.tar.gz

Download URL python_grpc_prometheus-0.2.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9dcc3bec8d3b5ced4381b8b13c224d3c499b6957e09b1edd4dbea6832e80f7d3
BLAKE2b-256 checksum
How to use checksums
71b8e799163d7bb76d6ad2b8362a218f0e2e0044ebc415870261978d23fc4847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page