-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Open
Labels
feature requestNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
🚀 The feature, motivation and pitch
- IGW hits
/metricscontinuously to understand the current load on the system - This leads to an overload of logs
- We can disable this with
--disable-uvicorn-access-log, but lose access to all access logs
We should have --disable-uvicorn-metrics-access-log to avoid logging * just * metrics. Per Gemini, we can do this with something like:
# Define the routes for which access logs should be disabled
EXCLUDE_PATHS = ["/health", "/metrics"]
class EndpointFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
# Check if the log record contains arguments and if the path matches an excluded path
if record.args and len(record.args) >= 3:
path = record.args[2] # The path is typically the third argument in uvicorn access logs
if path in EXCLUDE_PATHS:
return False # Exclude this log record
return True # Include all other log recordsCreate a command line arg like --disable-uvicorn-metrics-access-logwhich selectively disables logging hits to /metrics
Alternatives
No response
Additional context
No response
Before submitting a new issue...
- Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
Metadata
Metadata
Assignees
Labels
feature requestNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed