mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 23:28:07 -05:00
fix duplicate promethues metrics
This commit is contained in:
@@ -143,6 +143,9 @@ def instrument_fastapi(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Create instrumentator with default metrics
|
# Create instrumentator with default metrics
|
||||||
|
# Use service-specific inprogress_name to avoid duplicate registration
|
||||||
|
# when multiple FastAPI apps are instrumented in the same process
|
||||||
|
service_subsystem = service_name.replace("-", "_")
|
||||||
instrumentator = Instrumentator(
|
instrumentator = Instrumentator(
|
||||||
should_group_status_codes=True,
|
should_group_status_codes=True,
|
||||||
should_ignore_untemplated=True,
|
should_ignore_untemplated=True,
|
||||||
@@ -150,7 +153,7 @@ def instrument_fastapi(
|
|||||||
should_instrument_requests_inprogress=True,
|
should_instrument_requests_inprogress=True,
|
||||||
excluded_handlers=excluded_handlers or ["/health", "/readiness"],
|
excluded_handlers=excluded_handlers or ["/health", "/readiness"],
|
||||||
env_var_name="ENABLE_METRICS",
|
env_var_name="ENABLE_METRICS",
|
||||||
inprogress_name="autogpt_http_requests_inprogress",
|
inprogress_name=f"autogpt_{service_subsystem}_http_requests_inprogress",
|
||||||
inprogress_labels=True,
|
inprogress_labels=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user