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
docs: correct defaults, lifecycle and install facts (#267)
- README: second bootstrapper on one app raises ConfigurationError from bootstrap(); list FastMCP
- configuration: Prometheus, swagger and health checks are on by default; OTel also enabled by
opentelemetry_log_traces; document opentelemetry_insecure default and warning, and the
ignored litestar_logging_middleware_config warning; drop removed-field history
- quickstart: say which instruments are on by default; skipped_instruments omits dep-missing skips
- free: use FreeConfig instead of the backward-compatible alias
- performance: include the logging table the text refers to; trim prose
- fastmcp: drop version-history paragraph
- quote extras in install commands so zsh does not glob them; Litestar spelling
`lite-bootstrap` wires production observability — OpenTelemetry, Prometheus, Sentry, and structlog — into FastAPI, Litestar, and FastStream services in a few lines, with no boilerplate.
21
+
`lite-bootstrap` wires production observability — OpenTelemetry, Prometheus, Sentry, and structlog — into FastAPI, Litestar, FastStream, and FastMCP services in a few lines, with no boilerplate.
22
22
23
23
With `lite-bootstrap`, you receive an application with lightweight built-in support for:
24
24
@@ -33,7 +33,7 @@ With `lite-bootstrap`, you receive an application with lightweight built-in supp
@@ -43,7 +43,7 @@ Those instruments can be bootstrapped for:
43
43
44
44
A few constraints that aren't obvious from the API:
45
45
46
-
-**One bootstrapper per application instance.** Constructing two `FastAPIBootstrapper`s around the same `fastapi.FastAPI` (or two `FastMcpBootstrapper`s around the same `FastMCP`) stacks teardown hooks and re-wraps the lifespan. The library warns and skips the second attachment, but the second bootstrapper's `teardown()`won't fire on ASGI shutdown.
46
+
-**One bootstrapper per application instance.** Constructing two `FastAPIBootstrapper`s around the same `fastapi.FastAPI` (or two `FastMcpBootstrapper`s around the same `FastMCP`) is not supported. The second bootstrapper warns at construction, and its `bootstrap()`raises `ConfigurationError`.
47
47
-**One `OpenTelemetryInstrument` per process.**`bootstrap()` calls `opentelemetry.trace.set_tracer_provider(...)`, which the OTel SDK enforces as set-once — subsequent calls log a warning and have no effect. `teardown()` flushes spans and closes exporters but can't reset the process-global pointer.
48
48
-**`teardown()` is idempotent.**`BaseBootstrapper.teardown()` short-circuits if not bootstrapped; per-instrument teardown methods are safe to call multiple times.
49
49
-**Partial teardown failures are aggregated.** If an instrument's teardown raises, the bootstrapper continues with the rest of the instruments and raises `TeardownError` at the end with all collected failures.
@@ -52,7 +52,7 @@ A few constraints that aren't obvious from the API:
52
52
53
53
Usage examples:
54
54
55
-
- with LiteStar - [litestar-sqlalchemy-template](https://github.com/modern-python/litestar-sqlalchemy-template)
55
+
- with Litestar - [litestar-sqlalchemy-template](https://github.com/modern-python/litestar-sqlalchemy-template)
56
56
- with FastAPI - [fastapi-sqlalchemy-template](https://github.com/modern-python/fastapi-sqlalchemy-template)
57
57
58
58
## Acknowledgements
@@ -68,7 +68,7 @@ The following ideas were borrowed:
68
68
The following intentionally differ:
69
69
70
70
-**Configuration**: `lite-bootstrap` uses frozen `dataclass` configs (no `pydantic` / `pydantic-settings` runtime dependency), which is what makes it "lite". `microbootstrap` configures everything through `pydantic-settings` models.
71
-
-**Granular extras**: `lite-bootstrap` has exactly **one** mandatory runtime dependency, the pure-Python `typing-extensions`; every instrument (`sentry`, `otl`, `logging`, `pyroscope`) and every framework (`fastapi`, `litestar`, `faststream`) is its own extra, plus an opt-in `orjson` speedup for logging, per-pair combos (`fastapi-sentry`, `litestar-otl`, `faststream-metrics`, …) and `*-all` rollups. You install only what you actually use. It also runs on free-threaded CPython (3.13t/3.14t): every extra whose dependencies are pure Python installs there, and the ones that don't are blocked upstream — `orjson` and `pyroscope` have no free-threaded wheels, and `otl` needs `grpcio`, so use `otl-http` instead. `microbootstrap` bundles the full observability stack (opentelemetry, sentry-sdk, structlog, pyroscope-io, rich, pydantic-settings, …) as base dependencies and only splits framework packages into extras.
71
+
-**Granular extras**: `lite-bootstrap` has exactly **one** mandatory runtime dependency, the pure-Python `typing-extensions`; every instrument (`sentry`, `otl`, `logging`, `pyroscope`) and every framework (`fastapi`, `litestar`, `faststream`, `fastmcp`) is its own extra, plus an opt-in `orjson` speedup for logging, per-pair combos (`fastapi-sentry`, `litestar-otl`, `faststream-metrics`, …) and `*-all` rollups. You install only what you actually use. It also runs on free-threaded CPython (3.13t/3.14t): every extra whose dependencies are pure Python installs there, and the ones that don't are blocked upstream — `orjson` and `pyroscope` have no free-threaded wheels, and `otl` needs `grpcio`, so use `otl-http` instead. `microbootstrap` bundles the full observability stack (opentelemetry, sentry-sdk, structlog, pyroscope-io, rich, pydantic-settings, …) as base dependencies and only splits framework packages into extras.
72
72
-**Scope**: `lite-bootstrap` is deliberately narrow — only instrument wiring. It does not include a Granian server runner or a console writer.
Copy file name to clipboardExpand all lines: docs/introduction/configuration.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,8 @@ Additional parameters can also be supplied through the settings object:
25
25
26
26
Read more about sentry_sdk params [here](https://docs.sentry.io/platforms/python/configuration/options/).
27
27
28
-
Sentry is the second most expensive instrument in the stack, and the settings that actually move
29
-
the number are not the ones most people reach for. See[Performance](performance.md).
28
+
Sentry is the second most expensive instrument in the stack. Its cost comes almost entirely from the ASGI
29
+
integration; see[Performance](performance.md).
30
30
31
31
### Sentry logging integration
32
32
@@ -52,9 +52,8 @@ Under either, `sentry_logging_breadcrumb_level` is ignored and lite-bootstrap wa
52
52
53
53
Prometheus is the cheapest of the three non-logging instruments; see [Performance](performance.md).
54
54
55
-
To bootstrap Prometheus, you must provide at least:
56
-
57
-
-`prometheus_metrics_path`.
55
+
Prometheus is on by default when its extra is installed, serving metrics at `prometheus_metrics_path`
56
+
(default: `/metrics`). Set `prometheus_metrics_path` to an empty string to disable it.
58
57
59
58
Additional parameters:
60
59
@@ -103,6 +102,7 @@ To bootstrap Opentelemetry, you must provide at least one of:
103
102
104
103
-`opentelemetry_endpoint`, for traces.
105
104
-`opentelemetry_metrics_endpoint`, for metrics.
105
+
-`opentelemetry_log_traces=True`, to log spans to stdout.
106
106
107
107
Additional parameters:
108
108
@@ -111,7 +111,7 @@ Additional parameters:
111
111
-`opentelemetry_endpoint` - will be passed to `OTLPSpanExporter` as endpoint. Under `opentelemetry_exporter_protocol="http"` this is a full URL (e.g. `http://collector:4318/v1/traces`).
112
112
-`opentelemetry_namespace` - will be passed to the `Resource`.
113
113
-`opentelemetry_exporter_protocol` - OTLP exporter transport: `"grpc"` (default, needs the `otl` extra) or `"http"` (needs the `otl-http` extra, no `grpcio` - installable on free-threaded Python).
114
-
-`opentelemetry_insecure` - whether the gRPC OTLP connection is insecure (gRPC only; for `http` the endpoint URL scheme carries security).
114
+
-`opentelemetry_insecure` - whether the gRPC OTLP connection is insecure (default: `True`; gRPC only; for `http` the endpoint URL scheme carries security). While it is `True`, an endpoint pointing at a non-local host triggers a warning that telemetry is sent unencrypted.
115
115
-`opentelemetry_instrumentors` - a list of extra instrumentors.
116
116
-`opentelemetry_log_traces` - traces will be logged to stdout.
117
117
-`opentelemetry_sampler` - an `opentelemetry.sdk.trace.sampling.Sampler` deciding which traces are recorded. Unset, the SDK's own default applies: `parentbased_always_on`, which records every trace that is not the child of a non-recording remote parent, unless `OTEL_TRACES_SAMPLER` / `OTEL_TRACES_SAMPLER_ARG` say otherwise.
Additional parameters for Litestar's access-log middleware:
267
267
268
268
-`litestar_logging_middleware_enabled` - turn on request/response access logging (default: `False`).
269
-
-`litestar_logging_middleware_config` - a caller-supplied `LoggingMiddlewareConfig` that replaces the built-in defaults wholesale.
269
+
-`litestar_logging_middleware_config` - a caller-supplied `LoggingMiddlewareConfig` that replaces the built-in defaults wholesale. It is ignored, with a warning, unless `litestar_logging_middleware_enabled` is `True`.
270
270
271
271
See [the Litestar integration guide](../integrations/litestar.md#logging) for what gets logged and why access logging defaults to off.
272
272
@@ -283,8 +283,7 @@ it defaults to off.
283
283
284
284
The per-MCP-message access log is **off by default**:
285
285
286
-
-`fastmcp_logging_middleware_enabled` - turn on the access log (default: `False`). Replaces
287
-
`logging_turn_off_middleware`, which has been removed.
286
+
-`fastmcp_logging_middleware_enabled` - turn on the access log (default: `False`).
288
287
289
288
See [the FastMCP integration guide](../integrations/fastmcp.md#logging) for what gets logged.
290
289
@@ -329,11 +328,11 @@ To bootstrap swagger, you have the following parameters:
329
328
-`swagger_path`
330
329
-`swagger_offline_docs` - option to turn on offline docs.
331
330
332
-
For Litestar`swagger_path`is required to bootstrap swagger instrument.
331
+
Swagger is on by default at `swagger_path` (default: `/docs`). For Litestar, set `swagger_path`to an empty string to disable it.
333
332
334
333
## Health checks
335
334
336
-
To bootstrap Health checks, you must provide set `health_checks_enabled` to True.
335
+
Health checks are on by default; set `health_checks_enabled=False` to disable them.
0 commit comments