Repository navigation
fix(server): replace production eprintln! with tracing macros (#11) - #52
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the server’s graceful-shutdown logging path to use tracing macros instead of writing directly to stderr, aligning shutdown-time observability with the project’s structured logging pipeline for JSON aggregation.
Changes:
- Replace
eprintln!in the graceful shutdown serve/drain branches withtracing::{error,warn,info}!. - Emit structured fields for drain timeout and include error context on failure paths.
- Convert SIGINT/SIGTERM and ctrl_c failure diagnostics to
tracingevents.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
226
to
+230
| if let Err(error) = fsync_jsonl_path(&events_path) { | ||
| eprintln!("graceful shutdown: events.jsonl fsync failed: {error}"); | ||
| tracing::error!(%error, path = ?events_path, "graceful shutdown: events.jsonl fsync failed"); | ||
| } | ||
| if let Err(error) = fsync_jsonl_path(&audit_path) { | ||
| eprintln!("graceful shutdown: audit.jsonl fsync failed: {error}"); | ||
| tracing::error!(%error, path = ?audit_path, "graceful shutdown: audit.jsonl fsync failed"); |
Comment on lines
214
to
216
| Ok(Err(error)) => { | ||
| eprintln!("graceful shutdown: serve error: {error}"); | ||
| tracing::error!(%error, "graceful shutdown: serve error"); | ||
| } |
Final acceptance gate on #11. The graceful-shutdown path was the last production code in crates/server/src/ using `eprintln!`; the two other `eprintln!` matches are test-only "SKIP: bundler not run" hints inside `#[test]` functions (wasm_host.rs, wasm_registry.rs), which #11's acceptance explicitly permits ("0 or only test-only matches"). Sites converted (all in `crates/server/src/main.rs`): - `serve error` → `tracing::error!(%error, ...)` - `drain timeout` → `tracing::warn!(timeout_seconds = ..., ...)` - `draining complete` → `tracing::info!` - `events.jsonl / audit.jsonl fsync failed` → `tracing::error!` with path field - SIGINT / SIGTERM received → `tracing::info!` - ctrl_c handler failed → `tracing::error!` Now flow through the tracing subscriber added in PR #28 instead of bypassing it. Production aggregators see a single JSON stream including shutdown events. 175/175 server tests green; clippy clean.
rawkode
force-pushed
the
issue-11-tracing-eprintln
branch
from
May 19, 2026 18:35
7ba52ac to
1c242ba
Compare
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final acceptance gate on #11 ("Observability"). The graceful-shutdown path was the last production code in `crates/server/src/` using `eprintln!`. Tracing subscriber (PR #28), log rotation (PR #43), and tracing-based ops (PR #28) all landed; this closes the gap so production aggregators see a single JSON stream.
Changes
All in `crates/server/src/main.rs` (graceful-shutdown path):
Remaining test-only matches (permitted by acceptance)
`grep -rn 'eprintln!|println!' crates/server/src/` returns 2 hits — both inside `#[test]` functions printing "SKIP: run bundler first" hints (`wasm_host.rs:2227`, `wasm_registry.rs:649`). #11's acceptance explicitly permits these.
Verification
Closes #11.