Skip to content

Drive logging policy from startup env and reduce noisy defaults#58

Merged
erskingardner merged 2 commits into
masterfrom
codex/reduce-noisy-log-lines
May 14, 2026
Merged

Drive logging policy from startup env and reduce noisy defaults#58
erskingardner merged 2 commits into
masterfrom
codex/reduce-noisy-log-lines

Conversation

@erskingardner
Copy link
Copy Markdown
Member

@erskingardner erskingardner commented May 14, 2026

Summary

  • Removed the Rust-side log filtering/rewrite logic and restored direct EnvFilter initialization from RUST_LOG or TRANSPONDER_LOGGING_LEVEL
  • Kept the event receipt log concise with event_id, while leaving the rest of the application logging changes in place
  • Updated the deployment examples and docs to set the desired server-side RUST_LOG values explicitly for Transponder and its dependencies

Testing

  • cargo fmt
  • cargo test
  • cargo clippy -- -D warnings

Summary by CodeRabbit

  • Documentation

    • Updated deployment guides and development setup instructions with improved logging configuration examples.
    • Enhanced environment variable documentation for production deployments.
  • Chores

    • Refined logging configuration to use module-level control for granular visibility into specific components.
    • Adjusted log levels across services to reduce noise and improve message clarity.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Walkthrough

This PR unifies logging configuration across Transponder by replacing application-specific TRANSPONDER_LOGGING_LEVEL with standard Rust RUST_LOG environment variables in all deployment and development contexts. Concurrently, application code refines log levels for startup initialization, event processing, and push service responses to improve observability without excessive chatter.

Changes

Unified RUST_LOG Configuration and Application Logging

Layer / File(s) Summary
Environment and Deployment Configuration
AGENTS.md, README.md, compose.prod.yml, deploy/production.env.example, deploy/transponder.service.example, docker-compose.yml, docs/deployment.md, justfile
Documentation and example files transition from TRANSPONDER_LOGGING_LEVEL to RUST_LOG environment variable with per-crate granularity in all development guides, production Docker/systemd examples, and local development tooling.
Application Startup and Service Initialization Logging
src/main.rs
Metrics, APNs, and FCM initialization status messages refactored to emit info-level logs with improved context (including APNs environment field); server public key logging downgraded to debug to reduce normal-startup verbosity.
Event Processing and Relay Client Logging
src/nostr/events.rs, src/nostr/client.rs
Event receipt and successful processing elevated to info; relay addition downgraded to debug; gift-wrap unwrap and token decryption moved to info for visibility; structured fields clarified and simplified (notifications_admitted; event_id removed from duplicate/error paths).
Push Service Response Handling and Logging
src/push/apns.rs, src/push/fcm.rs
Successful APNs/FCM responses (200, 404) promoted to info level; error and unexpected-status paths simplified to log only HTTP status without consuming response bodies, reducing noise and I/O overhead in high-volume scenarios.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: shifting logging configuration to environment variables at startup and reducing verbose default log output across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/reduce-noisy-log-lines
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch codex/reduce-noisy-log-lines

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
deploy/transponder.service.example (1)

29-29: ⚡ Quick win

Use info as the production default for the transponder target.

Setting transponder=debug in the systemd production example conflicts with the PR goal of quieter defaults and can create avoidable log volume in normal operation. Prefer transponder=info here and document debug as a temporary troubleshooting override.

Proposed change
-Environment=RUST_LOG=info,transponder=debug,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn
+Environment=RUST_LOG=info,transponder=info,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deploy/transponder.service.example` at line 29, The systemd example sets
RUST_LOG with the transponder target at debug causing noisy production logs;
update the RUST_LOG environment value so the transponder target uses info
instead of debug (change "transponder=debug" to "transponder=info" in the
Environment line that defines RUST_LOG) and add a brief note that debug logging
is available as a temporary troubleshooting override (e.g., instruct operators
to set transponder=debug when needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@compose.prod.yml`:
- Line 27: The production compose default RUST_LOG currently enables verbose
transponder=debug; update the RUST_LOG default in the compose prod env entry
(the RUST_LOG line) to remove the transponder=debug setting or set it to a
non-debug level (e.g., transponder=info) so production containers do not start
with verbose transponder debug logs enabled.

In `@src/push/apns.rs`:
- Line 12: The APNs push-result logs were promoted to info! but must stay at
debug level; locate the logging calls in src/push/apns.rs that currently use
info! for success/invalid-token outcomes (and any similar uses in lines
~258-281) and change them back to debug! (ensure the tracing import still
includes debug). While updating, remove any user-identifying data from the log
messages so they remain non-sensitive and follow the push logging policy.

In `@src/push/fcm.rs`:
- Line 13: The push-result logs in src/push/fcm.rs were upgraded to info! but
must remain at debug level and must not contain any user-identifying
information; locate the push-result logging sites in this file (the
success/not-found logs around the push/result handling and the block around
lines ~355-381) and change any info! (or other non-debug) invocations to debug!
while ensuring the logged messages contain only generic push/result info (no
user IDs, emails, or tokens); keep the existing tracing import usage (debug) and
update any related tests or comments if they assert on log level.

---

Nitpick comments:
In `@deploy/transponder.service.example`:
- Line 29: The systemd example sets RUST_LOG with the transponder target at
debug causing noisy production logs; update the RUST_LOG environment value so
the transponder target uses info instead of debug (change "transponder=debug" to
"transponder=info" in the Environment line that defines RUST_LOG) and add a
brief note that debug logging is available as a temporary troubleshooting
override (e.g., instruct operators to set transponder=debug when needed).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d606ff5a-9561-4084-a312-b73017c21310

📥 Commits

Reviewing files that changed from the base of the PR and between 194cb81 and 774a35d.

📒 Files selected for processing (13)
  • AGENTS.md
  • README.md
  • compose.prod.yml
  • deploy/production.env.example
  • deploy/transponder.service.example
  • docker-compose.yml
  • docs/deployment.md
  • justfile
  • src/main.rs
  • src/nostr/client.rs
  • src/nostr/events.rs
  • src/push/apns.rs
  • src/push/fcm.rs

Comment thread compose.prod.yml
TRANSPONDER_HEALTH_BIND_ADDRESS: "0.0.0.0:8080"
TRANSPONDER_LOGGING_LEVEL: ${TRANSPONDER_LOGGING_LEVEL:-info}
TRANSPONDER_LOGGING_FORMAT: json
RUST_LOG: ${RUST_LOG:-info,transponder=debug,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use a non-debug default for transponder in production.

The default includes transponder=debug, which keeps verbose app logs enabled by default in compose.prod.yml.

Suggested patch
-      RUST_LOG: ${RUST_LOG:-info,transponder=debug,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn}
+      RUST_LOG: ${RUST_LOG:-info,transponder=info,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUST_LOG: ${RUST_LOG:-info,transponder=debug,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn}
RUST_LOG: ${RUST_LOG:-info,transponder=info,nostr_relay_pool=info,nostr_sdk=info,nostr=info,reqwest=warn,hyper=warn,hyper_util=warn,h2=warn,tower=warn,rustls=warn,tungstenite=warn,tokio_tungstenite=warn}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@compose.prod.yml` at line 27, The production compose default RUST_LOG
currently enables verbose transponder=debug; update the RUST_LOG default in the
compose prod env entry (the RUST_LOG line) to remove the transponder=debug
setting or set it to a non-debug level (e.g., transponder=info) so production
containers do not start with verbose transponder debug logs enabled.

Comment thread src/push/apns.rs
use serde::{Deserialize, Serialize};
use tokio::sync::RwLock;
use tracing::{debug, error, trace, warn};
use tracing::{debug, error, info, trace, warn};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep APNs push-result logs at debug level.

The success/invalid-token result logs were promoted to info!, which increases noise and diverges from the push logging policy.

Suggested patch
-use tracing::{debug, error, info, trace, warn};
+use tracing::{debug, error, trace, warn};
@@
-                info!("APNs notification accepted");
+                debug!("APNs notification accepted");
@@
-                info!("APNs token no longer valid");
+                debug!("APNs token no longer valid");

As per coding guidelines: src/push/**/*.rs: Use tracing at debug level for push results, never include user-identifying information.

Also applies to: 258-281

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/push/apns.rs` at line 12, The APNs push-result logs were promoted to
info! but must stay at debug level; locate the logging calls in src/push/apns.rs
that currently use info! for success/invalid-token outcomes (and any similar
uses in lines ~258-281) and change them back to debug! (ensure the tracing
import still includes debug). While updating, remove any user-identifying data
from the log messages so they remain non-sensitive and follow the push logging
policy.

Comment thread src/push/fcm.rs
use serde::{Deserialize, Serialize};
use tokio::sync::RwLock;
use tracing::{debug, error, trace, warn};
use tracing::{debug, error, info, trace, warn};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep FCM push-result logs at debug level.

The success/not-found push-result logs were promoted to info!, which is noisier than the repo push logging policy.

Suggested patch
-use tracing::{debug, error, info, trace, warn};
+use tracing::{debug, error, trace, warn};
@@
-                info!("FCM notification accepted");
+                debug!("FCM notification accepted");
@@
-                info!("FCM token not found");
+                debug!("FCM token not found");

As per coding guidelines: src/push/**/*.rs: Use tracing at debug level for push results, never include user-identifying information.

Also applies to: 355-381

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/push/fcm.rs` at line 13, The push-result logs in src/push/fcm.rs were
upgraded to info! but must remain at debug level and must not contain any
user-identifying information; locate the push-result logging sites in this file
(the success/not-found logs around the push/result handling and the block around
lines ~355-381) and change any info! (or other non-debug) invocations to debug!
while ensuring the logged messages contain only generic push/result info (no
user IDs, emails, or tokens); keep the existing tracing import usage (debug) and
update any related tests or comments if they assert on log level.

@github-actions
Copy link
Copy Markdown

❌ Code Coverage Report

Metric Value
Line Coverage 93.29%
Lines Covered 8401 / 9005
Change from master -0.01%

⚠️ Coverage has decreased! Please add tests to maintain or improve coverage.

View detailed coverage

Download the coverage-html artifact from this workflow run to view the detailed coverage report.

Or run locally:

cargo llvm-cov --html
open target/llvm-cov/html/index.html

@erskingardner erskingardner merged commit 5cc3195 into master May 14, 2026
9 of 10 checks passed
@erskingardner erskingardner deleted the codex/reduce-noisy-log-lines branch May 14, 2026 09:11
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.

1 participant