feat(netprobe): HTTP(S) + DoH endpoint probes via libcurl (Refs #697)#792
feat(netprobe): HTTP(S) + DoH endpoint probes via libcurl (Refs #697)#792leoparente wants to merge 21 commits into
Conversation
LCOV of commit
|
There was a problem hiding this comment.
Pull request overview
Adds an HTTP(S) probing mode to the existing netprobe input by introducing a libcurl curl_multi-driven transport integrated into the existing uvw/libuv event loop, and extends the netprobe handler to emit status-aware HTTP metrics (including optional per-phase timings).
Changes:
- Introduces
VisorHttpClient(libcurl multi + uvw poll/timer integration) andHttpProbeto issue periodic HTTP requests per target URL. - Extends netprobe input/handler signaling + metrics to record HTTP status outcomes, top status codes, response-time distributions, and optional per-phase quantiles.
- Adds unit and end-to-end tests plus handler documentation for the new HTTP probe mode.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/inputs/netprobe/test_netprobe.cpp | Adds HTTP config validation + end-to-end HTTP probe tests using an in-process httplib server. |
| src/inputs/netprobe/NetProbeInputStream.h | Adds HTTP-related members and a new probe_http_result signal path. |
| src/inputs/netprobe/NetProbeInputStream.cpp | Parses HTTP targets/method, creates HttpClient + HttpProbe instances, and closes HTTP transport during loop teardown. |
| src/inputs/netprobe/HttpProbe.h | Declares HttpProbe netprobe implementation for HTTP requests via HttpClient. |
| src/inputs/netprobe/HttpProbe.cpp | Implements periodic request scheduling and result/error mapping to existing netprobe error types. |
| src/inputs/netprobe/CMakeLists.txt | Builds HttpProbe and links netprobe to the new VisorHttpClient library; updates test link deps. |
| src/handlers/netprobe/test_net_probe.cpp | Adds unit tests for HTTP status-aware counters, TopN status codes, phase group gating, and merge behavior. |
| src/handlers/netprobe/README.md | Documents HTTP probe configuration, success semantics, and new metrics/groups. |
| src/handlers/netprobe/NetProbeStreamHandler.h | Adds HTTP metrics group + per-target HTTP metrics fields and new manager APIs. |
| src/handlers/netprobe/NetProbeStreamHandler.cpp | Wires new HTTP result signal, routes HTTP failures separately, and serializes/merges new metrics. |
| libs/visor_http_client/test_http_client.cpp | Adds HttpClient unit tests against an in-process httplib server (200/404/refused/timeout/close-in-flight). |
| libs/visor_http_client/HttpTypes.h | Defines HttpRequest, HttpResult, and HttpTimings structs shared between probe/handler. |
| libs/visor_http_client/HttpClient.h | Declares HttpClient and its uvw/libcurl integration contracts. |
| libs/visor_http_client/HttpClient.cpp | Implements the libcurl multi + uvw socket/timer glue and timing extraction. |
| libs/visor_http_client/CMakeLists.txt | Adds the new static library and its unit test target. |
| libs/CMakeLists.txt | Includes the new visor_http_client subdirectory in the build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…validation, metric help-text, e2e server-ready/port checks (Refs #697)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8053be1f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…type/question validation, curl-error logging, request() reentrancy guard, POLL_NONE stop, DoH top_status_codes (Refs #697)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9031e48f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d curl_slist_append OOM (Refs #697)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a7f4c393c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…o uppercase (Refs #697)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90029a8e2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… DoH response (TC bit + parsed-vs-declared records); accurate timeout comments (Refs #697)
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…EADME with actual semantics (Refs #697)
Summary
Adds two new netprobe input test types, both built on libcurl (already a dependency), sharing one transport:
http— an HTTP(S) endpoint probe (peer ofping/tcp): periodically requests a target URL and reports availability, status-aware success, response time, and an optional per-phase timing breakdown.doh— a DNS-over-HTTPS probe (RFC 8484): resolves a configured DNS query against a target DoH URL and reports DNS-aware availability (HTTP success and rcodeNOERROR), an rcode breakdown, and response time.Refs #697 — this supersedes that PR's hand-rolled HTTP/2-over-nghttp2 DoH transport with a complete, metric-emitting DoH probe on libcurl, and exceeds it (timings, status, rcode awareness).
Architecture
curl_multidriven by the existing netprobe uvw (libuv) event loop — no new threads:HttpClienttransport (libs/visor_http_client/): onecurl_multiper stream, curl sockets bridged touvw::poll_handle+ oneuvw::timer_handle; completions viacurl_multi_info_read; timing/status fromcurl_easy_getinfo. Loop-quiescent teardown (handles closed on the loop thread before the loop stops). Supports a request body, custom headers, and optional response-body capture (the HTTP probe stays zero-copy).HttpProbeandDohProbe(: NetProbe, peers ofPingProbe/TcpProbe) issue requests through the shared per-streamHttpClient.pcpp::DnsLayerand reusesvisor_dns's rcode/qtype name maps — no new dependency, and not the DNS stream handler (it can't attach to a netprobe input and its rich metrics degenerate for a single repeated query).libnghttp2(with_nghttp2=True) so curl negotiates h2 via ALPN for both probes; falls back to HTTP/1.1 transparently.Metrics
Status-aware, per-target, reusing the existing netprobe response-time histograms/quantiles + the opt-in
http_response_phasesgroup:successes(2xx/3xx),http_status_failures(4xx/5xx),top_status_codes, transport failures by cause.successes(HTTP success and rcode NOERROR),dns_response_failures(HTTP success but non-NOERROR/unparseable),http_status_failures,top_rcodes(e.g.NOERROR/NXDOMAIN/SRVFAIL/PARSE_ERROR), transport failures by cause.Config
Defaults: follow-redirects on (bounded to 10), TLS verification on, per-request
timeout_msec.Out of scope (v1)
DoH: DNSSEC validation, EDNS options, multiple queries per probe, rdata inspection beyond rcode. General: HTTP/3; custom auth; request bodies beyond DoH's. (
HTTP/2is enabled but not forced — curl negotiates.)Testing
unit-tests-visor-http-client(30) — HttpClient: 200/404/refused/timeout/close-in-flight, POST body + headers + response capture, per-phase timing sanity.unit-tests-handler-netprobe(84) — status-aware HTTP + DNS-aware DoH metric derivation,top_status_codes/top_rcodes, response-time,http_response_phaseson/off, merge.unit-tests-input-netprobe(41) — http/doh config validation + end-to-end tests (real stream → curl → in-process cpp-httplib server → handler) for HTTP and for DoH over both POST and GET, plus in-flight-stop teardown.All pass locally (Release, HTTP/2-enabled libcurl).
Reviewer notes
libnghttp2) is an isolated commit; libnghttp2 builds on musl/Alpine (it powers libcurl there), so it should be fine in the static pipeline — flag if the musl job disagrees.?dns=; the encoder is verified by inspection), and a single-unambiguous-in-flight-request variant of the DoH teardown test.🤖 Generated with Claude Code