{"repo":"trallnag/prometheus-fastapi-instrumentator","free":true,"listed":false,"github":"https://github.com/trallnag/prometheus-fastapi-instrumentator","clone":"git clone https://github.com/trallnag/prometheus-fastapi-instrumentator.git","description":"Instrument your FastAPI with Prometheus metrics.","language":"Python","stars":1481,"topics":["prometheus","fastapi","metrics","exporter","instrumentation"],"license":"ISC","category":"analytics","readme_excerpt":"Prometheus FastAPI Instrumentator A configurable and modular Prometheus Instrumentator for your FastAPI. Install prometheus-fastapi-instrumentator from PyPI. Here is the fast track to get started with a pre-configured instrumentator. Import the instrumentator class: Instrument your app with default metrics and expose the metrics: Depending on your code you might have to use the following instead: With this, your FastAPI is instrumented and metrics are ready to be scraped. The defaults give you: - Counter http requests total with handler , status and method . Total number of requests. - Summary http request size bytes with handler . Added up total of the content lengths of all incoming requests. - Summary http response size bytes with handler . Added up total of the content lengths of all outgoing responses. - Histogram http request duration seconds with handler and method . Only a few buckets to keep cardinality low. - Histogram http request duration highr seconds without any labels. Large number of buckets ( 20). In addition, following behavior is active: - Status codes are grouped into 2xx , 3xx and so on. - Requests without a matching template are grouped into the handler none . If one of these presets does not suit your needs you can do one of multiple things: - Pick one of the already existing closures from metrics and pass it to the instrumentator instance. See here how to do that. - Create your own instrumentation function that you can pass to an instrumentator instanc","default_branch":null,"files":null,"tree":[],"storefront":"/r/trallnag","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/trallnag/prometheus-fastapi-instrumentator/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}