Skip to content

Commit 96f35fe

Browse files
authored
Use global Prometheus registry instead of custom collector registry in FastStream bootstrapper (#124)
1 parent c5c13ed commit 96f35fe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

microbootstrap/bootstrappers/faststream.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,19 @@ def is_ready(self) -> bool:
7676
return bool(self.instrument_config.prometheus_middleware_cls and super().is_ready())
7777

7878
def bootstrap_before(self) -> dict[str, typing.Any]:
79-
self.collector_registry = prometheus_client.CollectorRegistry()
8079
return {
8180
"asgi_routes": (
8281
(
8382
self.instrument_config.prometheus_metrics_path,
84-
prometheus_client.make_asgi_app(self.collector_registry),
83+
prometheus_client.make_asgi_app(prometheus_client.REGISTRY),
8584
),
8685
)
8786
}
8887

8988
def bootstrap_after(self, application: AsgiFastStream) -> AsgiFastStream: # type: ignore[override]
9089
if self.instrument_config.prometheus_middleware_cls and application.broker:
9190
application.broker.add_middleware(
92-
self.instrument_config.prometheus_middleware_cls(registry=self.collector_registry)
91+
self.instrument_config.prometheus_middleware_cls(registry=prometheus_client.REGISTRY)
9392
)
9493
return application
9594

0 commit comments

Comments
 (0)