Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

Enhanced internal/server/health.go with debug logging to improve troubleshooting and visibility of health check operations.

Changes

Logger Declaration

  • Added logger import: "github.com/githubnext/gh-aw-mcpg/internal/logger"
  • Created logger with proper naming convention: var logHealth = logger.New("server:health")

Debug Logging Added (5 calls)

  1. BuildHealthResponse: Log when building health response
  2. BuildHealthResponse: Log number of servers retrieved
  3. BuildHealthResponse: Log when server error detected (includes server name)
  4. BuildHealthResponse: Log final health status determination
  5. HandleHealth: Log incoming health check requests (method and remote address)
  6. HandleHealth: Log health response summary (status and server count)

Logger Guidelines Compliance

Naming Convention: Follows pkg:filename pattern (server:health)
No Side Effects: All log arguments are simple variables, no function calls
Meaningful Messages: Each log provides context useful for debugging
Proper Formatting: Uses Printf with format strings for structured output
Single File Focus: Only modified health.go for focused, reviewable changes

Debug Output Example

When DEBUG=server:health or DEBUG=* is set:

server:health Building health response +0ms
server:health Retrieved status for 3 servers +2ms
server:health Overall health status determined: healthy +1ms
server:health Health check request: method=GET, remote=127.0.0.1:54321 +0ms
server:health Health response: status=healthy, servers=3 +3ms

Testing Notes

The enhanced logging will help diagnose:

  • Health endpoint performance issues
  • Server status retrieval problems
  • Individual server failures affecting overall health
  • Client health check patterns and frequency

Note: This PR focuses on a single file for thorough, reviewable changes following the logging enhancement guidelines.

AI generated by Go Logger Enhancement

@github-actions github-actions bot added automation enhancement New feature or request labels Jan 17, 2026
@lpcox lpcox marked this pull request as ready for review January 18, 2026 15:46
@lpcox lpcox merged commit 9b44686 into main Jan 18, 2026
@lpcox lpcox deleted the add-health-logging-de981a4948c537f6 branch January 18, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants