-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace uvicorn access log with our logger #453
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since mlrun has its own logger now, access logs should be turned off imo.
Mixed logging with different formats are very confusing and will be problemtic to machine-parse if we ever want to do that
mlrun/api/main.py
Outdated
silent_logging_path in path_with_query_string | ||
for silent_logging_path in silent_logging_paths | ||
): | ||
logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info( | |
logger.debug( |
mlrun/api/main.py
Outdated
silent_logging_path in path_with_query_string | ||
for silent_logging_path in silent_logging_paths | ||
): | ||
logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info( | |
logger.debug( |
…ing + helps verify the logs are correct
mlrun/api/main.py
Outdated
@@ -51,6 +54,63 @@ async def http_status_error_handler( | |||
) | |||
|
|||
|
|||
def get_client_addr(scope): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def get_client_addr(scope): | |
def get_client_address(scope): |
This PR has 2 targets:
/healthz
calls (cause soon it will be used periodically by k8s readiness probe)In FastAPI the way to cause code to do something (logging) on each request and response is writing a middleware.
I wrote a middleware to log before request and after response and therefore we can disable uvicorn's access log
Here are some examples of what will be logged now:
/healthz
endpoint/healthz