Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rob-blackbourn/bareasgi-prometheus

Prometheus metrics for bareASGI
https://github.com/rob-blackbourn/bareasgi-prometheus

Last synced: about 1 month ago
JSON representation

Prometheus metrics for bareASGI

Awesome Lists containing this project

README

        

# bareASGI-prometheus

[Prometheus](https://prometheus.io/) metrics for bareASGI (read the [docs](https://rob-blackbourn.github.io/bareASGI-prometheus/)).

## Installation

Install from the pie store

```bash
$ pip install bareASGI-prometheus
```

## Usage

The middleware can either be configured manually or with a helper.

### Manual Configuration

```python
from bareasgi import Application
from bareasgi_prometheus import PrometheusMiddleware, prometheus_view

...

prometheus_middleware = PrometheusMiddleware()
app = Application(middlewares=[prometheus_middleware])
app.http_router.add({'GET'}, '/metrics', prometheus_view)
```

### Helper Configuration

```python
from bareasgi import Application
from bareasgi_prometheus import add_prometheus_middleware

...

app = Application()
add_prometheus_middleware(app)
```