You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-10Lines changed: 71 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,10 @@ With <b>microbootstrap</b>, you receive an application with lightweight built-in
45
45
46
46
Those instruments can be bootstrapped for:
47
47
48
-
-`fastapi`
49
-
-`litestar`
48
+
-`fastapi`,
49
+
-`litestar`,
50
+
- or `faststream` service,
51
+
- or even a service that doesn't use one of these frameworks.
50
52
51
53
Interested? Let's dive right in ⚡
52
54
@@ -71,22 +73,30 @@ Interested? Let's dive right in ⚡
71
73
72
74
## Installation
73
75
74
-
You can install the package using either `pip` or `poetry`.
75
76
Also, you can specify extras during installation for concrete framework:
76
77
77
78
-`fastapi`
78
79
-`litestar`
80
+
-`faststream` (ASGI app)
81
+
82
+
Also we have `granian` extra that is requires for `create_granian_server`.
83
+
84
+
For uv:
85
+
86
+
```bash
87
+
uv add "microbootstrap[fastapi]"
88
+
```
79
89
80
90
For poetry:
81
91
82
92
```bash
83
-
$ poetry add microbootstrap -E fastapi
93
+
poetry add microbootstrap -E fastapi
84
94
```
85
95
86
96
For pip:
87
97
88
98
```bash
89
-
$ pip install microbootstrap[fastapi]
99
+
pip install "microbootstrap[fastapi]"
90
100
```
91
101
92
102
## Quickstart
@@ -224,7 +234,7 @@ These settings are subsequently passed to the [sentry-sdk](https://pypi.org/proj
224
234
225
235
### Prometheus
226
236
227
-
Prometheus integration presents a challenge because the underlying libraries for `FastAPI`and `Litestar` differ significantly, making it impossible to unify them under a single interface. As a result, the Prometheus settings for `FastAPI`and `Litestar` must be configured separately.
237
+
Prometheus integration presents a challenge because the underlying libraries for `FastAPI`, `Litestar`and `FastStream` differ significantly, making it impossible to unify them under a single interface. As a result, the Prometheus settings for `FastAPI`, `Litestar`and `FastStream` must be configured separately.
228
238
229
239
#### FastAPI
230
240
@@ -234,7 +244,7 @@ To bootstrap prometheus you have to provide `prometheus_metrics_path`
234
244
from microbootstrap.settings import FastApiSettings
235
245
236
246
237
-
classYourFastApiSettings(FastApiSettings):
247
+
classYourSettings(FastApiSettings):
238
248
service_name: str
239
249
240
250
prometheus_metrics_path: str="/metrics"
@@ -255,7 +265,7 @@ Parameters description:
255
265
-`prometheus_instrument_params` - will be passed to `Instrumentor.instrument(...)`.
256
266
-`prometheus_expose_params` - will be passed to `Instrumentor.expose(...)`.
257
267
258
-
FastApi prometheus bootstrapper uses [prometheus-fastapi-instrumentator](https://github.com/trallnag/prometheus-fastapi-instrumentator) that's why there are three different dict for parameters.
268
+
FastAPI prometheus bootstrapper uses [prometheus-fastapi-instrumentator](https://github.com/trallnag/prometheus-fastapi-instrumentator) that's why there are three different dict for parameters.
259
269
260
270
#### Litestar
261
271
@@ -265,7 +275,7 @@ To bootstrap prometheus you have to provide `prometheus_metrics_path`
265
275
from microbootstrap.settings import LitestarSettings
266
276
267
277
268
-
classYourFastApiSettings(LitestarSettings):
278
+
classYourSettings(LitestarSettings):
269
279
service_name: str
270
280
271
281
prometheus_metrics_path: str="/metrics"
@@ -280,6 +290,30 @@ Parameters description:
280
290
-`prometheus_metrics_path` - path to metrics handler.
281
291
-`prometheus_additional_params` - will be passed to `litestar.contrib.prometheus.PrometheusConfig`.
282
292
293
+
#### FastStream
294
+
295
+
To bootstrap prometheus you have to provide `prometheus_metrics_path` and `prometheus_middleware_cls`:
296
+
297
+
```python
298
+
from microbootstrap import FastStreamSettings
299
+
from faststream.redis.prometheus import RedisPrometheusMiddleware
<b>microbootstrap</b> provides in-memory JSON logging through the use of [structlog](https://pypi.org/project/structlog/).
@@ -412,6 +461,18 @@ Parameter descriptions:
412
461
-`swagger_offline_docs` - A boolean value that, when set to True, allows the Swagger JS bundles to be accessed offline. This is because the service starts to host via static.
413
462
-`swagger_extra_params` - Additional parameters to pass into the OpenAPI configuration.
414
463
464
+
#### FastStream AsyncAPI documentation
465
+
466
+
AsyncAPI documentation is available by default under `/asyncapi` route. You can change that by setting `asyncapi_path`:
0 commit comments