Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@samcorky
Copy link
Contributor

  • Added a dedicated healthcheck script in docker/healthcheck.py for efficient and modular healthcheck handling.
  • Updated the Dockerfile to incorporate the new healthcheck script.
  • Enhanced HttpRequestLoggingMiddleware to ignore logging for requests with the x-skip-logging header for local development convenience.

…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.
@samcorky samcorky linked an issue Sep 26, 2025 that may be closed by this pull request
@sjefferson99 sjefferson99 requested a review from Copilot October 4, 2025 19:50
Copy link
Contributor

Copilot AI left a 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.

@sjefferson99 sjefferson99 requested a review from Copilot October 4, 2025 20:02
Copy link
Contributor

Copilot AI left a 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.

Copy link
Member

@sjefferson99 sjefferson99 left a 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?

@samcorky
Copy link
Contributor Author

samcorky commented Oct 9, 2025

This change adds functionality to skip the debug request detail log output for local requests that provide the x-skip-logging header with a value of true.

When the following environment variables set:

  • SMIB_WEBSERVER_LOG_REQUEST_DETAILS=true
  • SMIB_LOGGING_LOG_LEVEL=debug

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 (127.0.0.1, localhost) (from within the container itself), and the x-skip-logging header has a value of true, and the above env vars are set, the request details are not logged.

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.

@samcorky samcorky requested a review from sjefferson99 October 9, 2025 09:32
Copy link
Member

@sjefferson99 sjefferson99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tranquil.

@samcorky samcorky merged commit 3fffd53 into master Oct 14, 2025
@samcorky samcorky deleted the 389-disable-logging-for-internal-health-check branch October 14, 2025 08:27
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.

Disable logging for internal health check

3 participants