Skip to content

Commit 175ff45

Browse files
committed
Add prometheus_metrics_include_in_schema
1 parent e3f02fe commit 175ff45

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class YourFastApiSettings(FastApiSettings):
233233
service_name: str
234234

235235
prometheus_metrics_path: str = "/metrics"
236+
prometheus_metrics_include_in_schema: bool = False
236237
prometheus_instrumentator_params: dict[str, typing.Any] = {}
237238
prometheus_instrument_params: dict[str, typing.Any] = {}
238239
prometheus_expose_params: dict[str, typing.Any] = {}
@@ -244,6 +245,7 @@ Parameters description:
244245

245246
- `service_name` - will be attached to metric's names, but has to be named in [snake_case](https://en.wikipedia.org/wiki/Snake_case).
246247
- `prometheus_metrics_path` - path to metrics handler.
248+
- `prometheus_metrics_include_in_schema` - whether to include metrics route in OpenAPI schema.
247249
- `prometheus_instrumentator_params` - will be passed to `Instrumentor` during initialization.
248250
- `prometheus_instrument_params` - will be passed to `Instrumentor.instrument(...)`.
249251
- `prometheus_expose_params` - will be passed to `Instrumentor.expose(...)`.

microbootstrap/instruments/prometheus_instrument.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class BasePrometheusConfig(BaseInstrumentConfig):
1414
service_name: str = "micro-service"
1515

1616
prometheus_metrics_path: str = "/metrics"
17+
prometheus_metrics_include_in_schema: bool = False
1718

1819

1920
class LitestarPrometheusConfig(BasePrometheusConfig):

0 commit comments

Comments
 (0)