• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 17976260211

24 Sep 2025 12:13PM UTC coverage: 44.715% (+0.02%) from 44.695%
17976260211

push

github

web-flow
Replace global logger with context-aware logging in operator (#2007)

Resolves #1830

This change replaces all instances of global logger usage in the
ToolHive operator with context-aware logging to preserve trace
context for better observability.

Changes:
- Updated validateRunConfig() to accept context and use log.FromContext()
- Updated helper functions in mcpserver_controller.go to use context-aware logging:
  - ensureRequiredEnvVars()
  - serviceForMCPServer()
  - deploymentNeedsUpdate()
  - generateKubernetesOIDCArgs()
  - generateConfigMapOIDCArgs()
- Removed unused global logger imports
- Updated function signatures to accept context.Context parameters
- Fixed all calling sites to pass context
- Updated test files to accommodate new function signatures
- Fixed linting issues (line length violations)

All tests pass and no regressions introduced.

19 of 35 new or added lines in 2 files covered. (54.29%)

4 existing lines in 2 files now uncovered.

15711 of 35136 relevant lines covered (44.71%)

15.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.2
/cmd/thv-operator/controllers/mcpserver_controller.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc