Skip to content

fix bug with uvicorn and prometheus conflicting - #12

Merged
evanugarte merged 2 commits into
SCE-Development:devfrom
IanC114:metrics-handler
Jul 25, 2026
Merged

fix bug with uvicorn and prometheus conflicting#12
evanugarte merged 2 commits into
SCE-Development:devfrom
IanC114:metrics-handler

Conversation

@IanC114

@IanC114 IanC114 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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

@evanugarte
evanugarte merged commit 80417b6 into SCE-Development:dev Jul 25, 2026
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.

2 participants