Skip to content

fix bug with uvicorn and prometheus conflicting#12

Open
IanC114 wants to merge 1 commit into
SCE-Development:devfrom
IanC114:metrics-handler
Open

fix bug with uvicorn and prometheus conflicting#12
IanC114 wants to merge 1 commit into
SCE-Development:devfrom
IanC114:metrics-handler

Conversation

@IanC114

@IanC114 IanC114 commented Jul 16, 2026

Copy link
Copy Markdown

Fix bug with uvicorn and prometheus conflicting, causing the program to crash.

When uvicorn starts the server, it imports server.py, rerunning all top-level code. This causes prometheus to create duplicate metrics and throw an error.

I created a metrics handler class to handle all prometheus metrics. This change is compatible with uvicorn's live reload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant