Debian Codegraph @

docs/usage/metrics/prometheus.rst

raw
1 Prometheus
2 ==========
3
4 Litestar includes optional Prometheus exporter that is exported from ``litestar.plugins.prometheus``. To use
5 this package, you should first install the required dependencies:
6
7 .. code-block:: bash
8 :caption: as separate package
9
10 pip install prometheus-client
11
12
13 .. code-block:: bash
14 :caption: as a Litestar extra
15
16 pip install 'litestar[prometheus]'
17
18 Once these requirements are satisfied, you can instrument your Litestar application:
19
20 .. literalinclude:: /examples/plugins/prometheus/using_prometheus_exporter.py
21 :language: python
22 :caption: Using the Prometheus Exporter
23
24 You can also customize the configuration:
25
26 .. literalinclude:: /examples/plugins/prometheus/using_prometheus_exporter_with_extra_configs.py
27 :language: python
28 :caption: Configuring the Prometheus Exporter