Skip to content

Don't warn about a missing Prometheus extra while the metrics path is still the default #398

Open

Description

@lesnik512

PrometheusConfig.prometheus_metrics_path defaults to /metrics (lite_bootstrap/instruments/prometheus_instrument.py:12), so the Prometheus instrument counts as configured on FastAPI, Litestar and FastMCP even when the user never mentions Prometheus. A service installed without the -metrics extra then gets an InstrumentDependencyMissingWarning and a logged warning every time a bootstrapper is constructed (bootstrappers/base.py:66-77). configuration.md says Prometheus "is on by default when its extra is installed", so a missing extra should be a quiet opt-out.

Found in the 2.0 audit.

Decision: the defaults stay

The audit asked whether every framework should share one default. They keep the ones they have:

  • FastAPI, Litestar and FastMCP keep /metrics. Making it opt-in would break every service whose scraper expects /metrics without config, and nothing would fail at startup.
  • FastStream stays opt-in. It already was in 1.16.0, where the instrument needed prometheus_middleware_cls or prometheus_collector_registry (faststream_bootstrapper.py:217-221 at the tag); FastStream Prometheus: use the default registry and make the metrics path opt-in #375 moved the switch to the path. Broker metrics need a middleware class specific to the broker, which lite-bootstrap can't pick, so a default /metrics would serve only process metrics.

Work

  • When prometheus_metrics_path still has its default value and prometheus_client is missing, skip the instrument silently, as a not-configured skip. Keep the warning when the user set the path to anything else.
  • A user who sets "/metrics" explicitly can't be told apart from the default, so they get no warning. Accept that gap rather than adding a sentinel default.
  • Say in the Prometheus section of configuration.md why FastStream is opt-in and the other frameworks are not.
  • Test first: on FastAPI with prometheus_client hidden, constructing the bootstrapper with default config emits no warning, and with prometheus_metrics_path="/custom" it still warns.

Breaking changes

None. A warning goes away, and no default changes.

Activity

  1. added this to the 2.0.0 milestone on Oct 29, 2026
  2. added
    enhancementNew feature or request
    bugSomething isn't working
    and removed
    enhancementNew feature or request
    on Oct 29, 2026
  3. removed this from the 2.0.0 milestone on Oct 29, 2026
  4. changed the title [-]Use one Prometheus metrics path default across frameworks[/-] [+]Don't warn about a missing Prometheus extra while the metrics path is still the default[/+] on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions