Skip to content

refactor: remove noisy debug logs from flash (AE-1966)#204

Merged
deanq merged 14 commits intomainfrom
refactor/clean-debug-logs
Feb 14, 2026
Merged

refactor: remove noisy debug logs from flash (AE-1966)#204
deanq merged 14 commits intomainfrom
refactor/clean-debug-logs

Conversation

@deanq
Copy link
Member

@deanq deanq commented Feb 14, 2026

Summary

Comprehensive cleanup of noisy debug logs and logging improvements across the flash library. Removed 59+ debug/info log statements that generated excessive output during development (200+ lines at startup), simplified DEBUG format, silenced HTTP transport logs, and fixed false redaction of Job/Template IDs.

Changes

Debug Log Removal (41 logs)

File Lines Removed Impact
client.py 5 @Remote decorator execution logs
execute_class.py 5 Per-class serialization logs (5-10× per run)
discovery.py 2 Per-resource discovery logs (10-20× per run)
scanner.py 6 Duplicate parse failure logs (3× per file)
load_balancer.py 3 Per-request selection logs (100+ per second)
resource_manager.py 7 Resource cache/deployment/save logs
serverless.py 4 Structural change detection logs
ignore.py 1 Per-file "Ignoring:" logs (50+ per build)
app.py 2 App hydration logs
runpod.py 4 API operation logs (finalize upload, fetch environment, deploy, fetch app)
file_lock.py 2 File lock acquired/released logs

API Logs (8 commented out, not removed)

  • runpod.py: Multi-KB GraphQL/REST request/response dumps preserved but commented for future debugging

Logging System Improvements

1. DEBUG Format Simplification

  • Removed %(name)s | %(filename)s:%(lineno)d from DEBUG format
  • Before: 2026-02-13 22:27:04,553 | DEBUG | runpod_flash.core.utils.file_lock | file_lock.py:105 | Message
  • After: 2026-02-13 22:27:04,553 | DEBUG | Message

2. HTTP/Async Transport Log Silencing

  • Set httpcore/httpx loggers to WARNING level
  • Set asyncio logger to WARNING level (prevents "Using selector: KqueueSelector")
  • Eliminates verbose connection traces: connect_tcp.started, send_request_headers, etc.

3. Sensitive Data Filter Fix

  • Replaced overly broad TOKEN_PATTERN with PREFIXED_KEY_PATTERN
  • Prevents false redaction of Job IDs, Worker IDs, Template IDs
  • Still redacts: Bearer tokens, API keys, prefixed keys (sk-, key_, api_), passwords/secrets

4. Template Update Logs

  • Changed template update logs from INFO to DEBUG level (2 occurrences)
  • Reduces console noise during deployments

Verification

  • ✅ All 972 tests passing
  • ✅ Code coverage maintained at 69.36% (required: 65%)
  • ✅ All ruff format/check passing
  • ✅ Startup debug output reduced from 200+ to <10 lines
  • ✅ Job IDs, Template IDs now visible in logs

Design Decisions

  • Removed logs that fire per-item (resources, classes, requests, files)
  • Removed operational logs (file locks, resource persistence, hydration)
  • Removed API operation logs that print full input data
  • Changed to DEBUG template update logs (from INFO)
  • Kept summary logs (total counts, operation status)
  • Kept all error/warning logs (actionable failures)
  • Commented API logs (not removed) to preserve for debugging
  • Fixed false redactions while maintaining security
  • Silenced external library debug logs (httpcore, httpx, asyncio)

@deanq deanq changed the title refactor: remove noisy debug logs from flash library refactor: remove noisy debug logs from flash Feb 14, 2026
@deanq deanq requested a review from Copilot February 14, 2026 06:05
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 removes noisy debug logs that were cluttering development output, reducing debug line count from 200+ to <20 during normal operations. The changes follow a consistent pattern: remove per-item logs while preserving summary logs, errors, and warnings.

Changes:

  • Removed 29+ debug log statements across 6 files that fired repeatedly during normal operations (per-resource, per-class, per-request)
  • Commented out (rather than deleted) multi-KB API request/response dumps in runpod.py to preserve for future debugging
  • Maintained all error/warning logs and summary-level informational logs

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/runpod_flash/runtime/load_balancer.py Removed 3 per-request selection debug logs that fired 100+ times per second
src/runpod_flash/execute_class.py Removed 5 per-class serialization debug logs that fired 5-10× per run
src/runpod_flash/core/discovery.py Removed 2 per-resource discovery debug logs that fired 10-20× per run
src/runpod_flash/core/api/runpod.py Commented out 8 debug logs dumping multi-KB API requests/responses, added noqa comment for json import
src/runpod_flash/client.py Removed 5 decorator execution debug logs and unused flash_resource_name variable
src/runpod_flash/cli/commands/build_utils/scanner.py Changed 6 debug logs to silent exception handling (pass) following codebase pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deanq deanq requested review from DeJayDev and KAJdev February 14, 2026 06:42
@deanq deanq changed the title refactor: remove noisy debug logs from flash refactor: remove noisy debug logs from flash (AE-1966) Feb 14, 2026
deanq added 11 commits February 13, 2026 23:24
Remove debug logs from client.py that fire on every @Remote function/class:
- RUNPOD_ENDPOINT_ID/FLASH_RESOURCE_NAME environment check logs
- Local dev mode stub creation logs
- is_local_function result logs
- Original function return logs
- Remote execution wrapper creation logs

Also remove unused flash_resource_name variable that was only used in
the removed debug log.

These logs provide no actionable information during normal development
and create substantial noise (5-10 lines per decorated item).
Remove 5 debug log lines that fire for every @Remote class:
- Cached class data log (line 60)
- Retrieved cached class data log (lines 84-86)
- Successfully extracted class code log (line 125)
- Generated cache key log (line 185)
- Created remote class wrapper log (line 232)

These logs fire 5-10 times per run and only matter when debugging
class serialization issues, not during normal development.
Remove 2 debug log lines that fire for every decorated resource:
- Entry point resource discovery log (lines 55-57)
- Project directory resource discovery log (lines 408-410)

These logs fire 10-20 times per run. The INFO-level summary logs
already show total resource counts, making per-resource debug logs
redundant.
Remove 6 duplicate debug log lines across three scanning passes:
- First pass (resource configs): lines 77, 81
- Second pass (@Remote functions): lines 90, 94
- Third pass (function calls): lines 118, 122

These logs fire 3× per Python file during scanning (150+ logs for 50 files).
Parse failures in dependencies are expected and not actionable.

Keep SyntaxError warnings as they indicate actual issues.
Remove 3 debug log lines that fire on every request:
- ROUND_ROBIN selection log (lines 88-91)
- LEAST_CONNECTIONS selection log (lines 112-115)
- RANDOM selection log (line 128)

These logs fire on EVERY request (100+ times per second in production)
and would flood production systems with no actionable value.
Comment out (not remove) 8 debug log lines in API methods:

GraphQL (_execute_graphql):
- GraphQL Query log
- GraphQL Variables log
- GraphQL Response Status log
- GraphQL Response log

REST (_execute_rest):
- REST Request log
- REST Data log
- REST Response Status log
- REST Response log

These logs dump multi-KB JSON responses on every API call (10-50× per
deploy operation). Commenting out preserves them for future debugging
while silencing them during normal development.

Add noqa comment to json import since it's only used in commented code.
Removed 6 noisy logs that fire per-resource operation:
- get_or_deploy_resource called with config dump
- DRIFT DEBUG with existing/new config fields
- Resource found in cache (per-lookup)
- exists, reusing (per-reuse)
- Resource NOT found in cache (per-deployment)
- Config drift detected (redundant with warning log)
…cation

Removed %(name)s | %(filename)s:%(lineno)d from DEBUG format.
DEBUG and INFO now use the same clean format: timestamp | level | message

Updated test to match new behavior.
Removed 3 noisy logs:
- Version-triggering changes detected (INFO)
- Structural change in field (DEBUG, 2 occurrences)

These logs fire during endpoint updates and provide no actionable value.
Set httpcore and httpx loggers to WARNING level to suppress
verbose connection/request trace logs that appear in DEBUG mode:
- connect_tcp.started/complete
- start_tls.started/complete
- send_request_headers/body
- receive_response_headers

These low-level HTTP transport logs provide no actionable value
during normal development.
Replaced overly broad TOKEN_PATTERN with PREFIXED_KEY_PATTERN that only
redacts tokens with known sensitive prefixes (sk-, key_, api_).

This fixes false positives where Job IDs, Worker IDs, and Template IDs
were being redacted even though they're not sensitive.

Updated test to use prefixed token instead of generic long token.
@deanq deanq force-pushed the refactor/clean-debug-logs branch from a70183e to 18b4350 Compare February 14, 2026 07:26
Removed repetitive and overly-verbose debug logs:
- ignore.py: Remove per-file "Ignoring:" logs (pattern summary sufficient)
- app.py: Remove "already hydrated" debug log
- runpod.py: Remove logs that print full input_data/variables
  (finalizing upload, fetching environment, deploying environment)
- runpod.py: Change template update logs from info to debug
- serverless.py: Change template update log from info to debug

These logs added noise without value. Pattern summaries and
operation names provide sufficient context.
Removed verbose file locking and resource persistence logs:
- file_lock.py: Remove "File lock acquired" and "File lock released"
- resource_manager.py: Remove "Saved resources in .runpod/resources.pkl"
- logger.py: Silence asyncio logger (prevents "Using selector: KqueueSelector")

These operational details added noise without debugging value.
Removed:
- runpod.py: "Fetching flash app by name for input:"
- app.py: "Hydrating app"

These operation-level logs add noise without debugging value.
@deanq deanq merged commit 826f169 into main Feb 14, 2026
6 checks passed
@deanq deanq deleted the refactor/clean-debug-logs branch February 14, 2026 16:36
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.

2 participants