Skip to content

Add Graylog logging configuration #252#264

Open
Alexj9837 wants to merge 13 commits intomainfrom
numtracker_graylog
Open

Add Graylog logging configuration #252#264
Alexj9837 wants to merge 13 commits intomainfrom
numtracker_graylog

Conversation

@Alexj9837
Copy link
Copy Markdown

#252

Summary

  • Add tracing-gelf layer to ship structured logs to a Graylog instance via GELF TCP
  • Expose --graylog <URL> and --logging-level <LEVEL> CLI flags (also via NUMTRACKER_GRAYLOG / NUMTRACKER_GRAYLOG_LOG_LEVEL env vars)
  • Add Graylog env var injection to Helm chart with numtracker.graylog.enabled/host/level values

@Alexj9837 Alexj9837 marked this pull request as ready for review March 16, 2026 15:59
Comment thread src/cli/mod.rs Outdated
Comment thread .vscode/launch.json Outdated
Copy link
Copy Markdown
Contributor

@ZohebShaikh ZohebShaikh left a comment

Choose a reason for hiding this comment

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

Looks good only few minor things

Comment thread src/logging.rs Outdated
Comment thread src/logging.rs Outdated
Comment thread src/logging.rs Outdated
Comment thread src/logging.rs Outdated
@Alexj9837 Alexj9837 force-pushed the numtracker_graylog branch from bda4336 to 831a990 Compare March 18, 2026 15:44
- Extract GraylogOptions into its own struct, independent of TracingOptions
- Remove .vscode/launch.json (to be added in a separate PR)
- Remove version/build additional_field calls from Graylog logger
- Switch let-else to if-let in init_graylog
- Warn when Graylog URL has no port rather than silently defaulting
- Add reconnect loop so dropped connections recover automatically
- Improve connection error messages to distinguish DNS failure from TCP errors
@Alexj9837 Alexj9837 force-pushed the numtracker_graylog branch from 831a990 to 0a86a82 Compare March 30, 2026 13:56
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 72.07207% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.19%. Comparing base (a25367f) to head (926a966).

Files with missing lines Patch % Lines
src/logging.rs 56.52% 30 Missing ⚠️
src/main.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   76.35%   76.19%   -0.16%     
==========================================
  Files          13       13              
  Lines        1937     2046     +109     
==========================================
+ Hits         1479     1559      +80     
- Misses        458      487      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@tpoliaw tpoliaw left a comment

Choose a reason for hiding this comment

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

Looks pretty good, thanks for looking at it. A couple of changes could make the error handling a bit cleaner and keep it more consistent with what is already there though.

Comment thread src/cli/mod.rs Outdated
Comment thread src/cli/mod.rs Outdated
Comment thread src/cli/mod.rs Outdated
Comment thread src/main.rs Outdated
async fn main() -> Result<(), Box<dyn Error>> {
let args = Cli::init();
let _ = logging::init(args.log_level(), args.tracing());
let _ = logging::init(args.log_level(), args.tracing(), &args.graylog);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should probably handle errors here. Currently if any log setup fails you get no output and debugging why is a pain.

Comment thread Cargo.toml Outdated
Comment thread .gitignore
Comment thread src/logging.rs Outdated
Comment thread src/logging.rs Outdated
@Alexj9837 Alexj9837 force-pushed the numtracker_graylog branch 3 times, most recently from 498354e to 59d5002 Compare April 20, 2026 15:36
@Alexj9837 Alexj9837 force-pushed the numtracker_graylog branch from 59d5002 to 926a966 Compare April 20, 2026 15:42
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.

3 participants