I am new user of Prometheus. I get *V*alueError: Duplicated timeseries in CollectorRegistry and I tried different ways but could not figure out out is the problem and how to solve it. My code looks like the following:
instrumentator.instrument(app) instrumentator.expose(app, include_in_schema=False) app.include_router(xxx) app.include_router(xxx) app.include_router(xxx) async def validation_exception_handler( request: Request, exc: RequestValidationError ) -> JSONResponse: # some code return await input_validation_exception_handler(request, exc) @app.exception_handler(HTTPException) async def custom_http_exception_handler( request: Request, exc: HTTPException ) -> JSONResponse: # some code return await http_exception_handler(request, exc) When I remove this exception handler everything is fine but if I add this exception handler then it raises the following exception: File "/app/app/main.py", line 113, in <module> async def custom_http_exception_handler( File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 161, in decorator self.add_exception_handler(exc_class_or_status_code, func) File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 135, in add_exception_handler self.middleware_stack = self.build_middleware_stack() File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 186, in build_middleware_stack app = cls(app=app, **options) File "/usr/local/lib/python3.8/site-packages/prometheus_fastapi_instrumentator/middleware.py", line 52, in __init__ self.instrumentations = instrumentations or [metrics.default()] File "/usr/local/lib/python3.8/site-packages/prometheus_fastapi_instrumentator/metrics.py", line 544, in default TOTAL = Counter( File "/usr/local/lib/python3.8/site-packages/prometheus_client/metrics.py", line 143, in __init__ registry.register(self) File "/usr/local/lib/python3.8/site-packages/prometheus_client/registry.py", line 43, in register raise ValueError( ValueError: Duplicated timeseries in CollectorRegistry: {'http_requests_created', 'http_requests_total', 'http_requests'} -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/7aaae82f-d4bb-488a-a037-31104d80bd7en%40googlegroups.com.