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

Metadata

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 Provenance Actions
python_grpc_prometheus-0.2.0.tar.gz 4.4 kB Without provenance Details for python_grpc_prometheus-0.2.0.tar.gz

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

Security for python-grpc-prometheus 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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