-
Notifications
You must be signed in to change notification settings - Fork 1
Add healthcheck script and improve logging middleware #390
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
Add healthcheck script and improve logging middleware #390
Conversation
…ddleware - Introduce `docker/healthcheck.py` for cleaner healthcheck logic. - Update Dockerfile to use the new healthcheck script. - Enhance `HttpRequestLoggingMiddleware` to bypass logging for local requests with `x-skip-logging` header.
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.
Pull Request Overview
This PR adds a dedicated healthcheck script and enhances the HTTP logging middleware to support selective logging for development. The changes improve both monitoring capabilities and developer experience.
- Added a standalone Python healthcheck script for Docker health monitoring
- Enhanced HTTP request logging middleware to conditionally skip logging based on headers and client host
- Fixed spelling errors in Dockerfile comments
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docker/healthcheck.py | New dedicated healthcheck script that replaces inline Docker healthcheck command |
| src/smib/events/middlewares/http_middleware.py | Enhanced logging middleware with local host detection and skip-logging header support |
| Dockerfile | Updated to use new healthcheck script and corrected spelling in comments |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sjefferson99
left a comment
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.
@sam57719 Not exactly sure what this does or what changes when I run this version. Can you provide some documentation on the feature and how to use it?
|
This change adds functionality to skip the debug request detail log output for local requests that provide the When the following environment variables set:
The log output is flooded with the same lines over and over again from the healthcheck, which can make it tricky to find the actual log you are looking for. Essentially, if this is a local request ( This is currently only used to prevent the /api/ping requests from being logged when running from the health check. The health check has also been moved from an inline Python snippet in the Dockerfile to an externalised healthcheck.py file for ease of modification and readability. |
sjefferson99
left a comment
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.
Tranquil.
docker/healthcheck.pyfor efficient and modular healthcheck handling.Dockerfileto incorporate the new healthcheck script.HttpRequestLoggingMiddlewareto ignore logging for requests with thex-skip-loggingheader for local development convenience.