Repository navigation
Add daemon mode, Prometheus exporter, and official Dockerfile - #82
Merged
Merged
Conversation
--daemon runs headless with no per-hop stdout, intended for container and monitoring deployments; warns when started without an output sink. --prometheus <ADDR> serves an OpenMetrics endpoint (GET /metrics) plus GET /healthz for container orchestration. Per-hop sent/response/timeout counters, RTT avg/min/max/stddev gauges, loss ratio, ECMP responder count, and hop identity info series; per-target reachability, path length, and total probes. Hand-rolled HTTP/1.1 over the existing tokio runtime - no new dependencies. SIGTERM now triggers the same graceful shutdown as Ctrl-C on unix, so docker stop exits cleanly (code 0, not 143). The Dockerfile is a multi-stage Alpine/musl build pinned to the MSRV toolchain, producing a minimal runtime image with CA certificates for enrichment lookups.
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.
Summary
Implements the Docker & Daemon Mode roadmap section (all items except Docker Hub publishing, which needs registry credentials).
Daemon mode (
--daemon)--prometheusand/or--stream-json; warns when started with neither (no output sink)Prometheus exporter (
--prometheus <ADDR>):9090shorthand binds all interfaces; fullhost:portalso accepted; invalid addresses rejected at arg validationGET /metrics— OpenMetrics exposition: per-hop sent/response/timeout counters, RTT avg/min/max/stddev gauges, loss ratio, ECMP responder count,ttl_hop_infoidentity series; per-target reachability, path hops, total probes. Labels:target(resolved IP),host(name as given),ttlGET /healthz— 200 for container orchestrationSIGTERM handling
docker stopnow triggers the same graceful shutdown as Ctrl-C (repeat signal forces exit). Verified: container exits 0, not 143.Dockerfile
Multi-stage
rust:1.88-alpine(MSRV) →alpine:3.21with CA certificates for enrichment lookups. Docker grantsCAP_NET_RAWby default; docs cover--cap-add NET_RAW/ KubernetessecurityContextfor stricter runtimes.Testing
:9090shorthand, invalid addr rejection, conflict matrix, daemon+stream-json+prometheus composition)cargo fmt --check/clippy --all-targets -- -D warningsclean--daemon --prometheus :9090 1.1.1.1serves real probe metrics,curl /healthz200,docker stop→ graceful SIGTERM shutdown, exit code 0