Skip to content

[cloudprober] Add single run interface - #1081

Merged
manugarg merged 9 commits into
mainfrom
run-once
Aug 2, 2025
Merged

manugarg merged 9 commits into
mainfrom
run-once

Conversation

@manugarg

@manugarg manugarg commented May 19, 2025 •

Copy link
Copy Markdown
Contributor

Implement a single run interface for Cloudprober. You'll be able to ask Cloudprober to run probes just once and print the results.

[Note that interface being introduced in this PR will evolve]

  • In probes, add a new interface called ProbeWithRunOnce to identify probe types that implement the RunOnce interface.
  • Add RunOnce support to HTTP probe. Note that RunOnce doesn't support multiple requests per HTTP probe.

One part that needs a lot of work still and will evolve with time is how we arrange the results and how we output them. Most of that code is in the singlerun package. I am thinking of two output formats right now -- text for human operators, and json for machines. JSON still needs to be implemented, but here is how text format looks like right now:

[samwise 14:33:33 ~/code/cloudprober-wt/run-once(run-once)]$ go run ./cmd/cloudprober --config_file=$HOME/cloudprober_google.cfg --run_once 2>/dev/null
Probe: google_http
  Target: google87.c2om
    Status: failed
    Error: error creating HTTP request for target: google87.c2om, err: error resolving target: google87.c2om, lookup google87.c2om on 127.0.0.53:53: no such host


Probe: google_http_1.1.1.1
  Target: google.com
    Status: ok (latency: 203.725872ms)
    Metrics: 
      1753997640 labels=ptype=http total=1 success=1 latency=200.338 timeouts=0 resp-code=map:code,200:1 dns_latency=13.747 tls_handshake_latency=80.397
      1753997640 labels=ptype=http ssl_earliest_cert_expiry_sec=5137201

@manugarg
manugarg marked this pull request as draft May 19, 2025 19:27
@manugarg
manugarg marked this pull request as ready for review August 1, 2025 03:06
@manugarg
manugarg merged commit 0734d1e into main Aug 2, 2025
@manugarg
manugarg deleted the run-once branch August 2, 2025 04:00
@manugarg manugarg added this to the v0.14.1 milestone Jan 20, 2026
manugarg pushed a commit that referenced this pull request Feb 9, 2026
Max redirect handling got broken in v0.14.1 because of #1081. This change fixes that and adds a more complete test.
conallob pushed a commit to conallob/cloudprober that referenced this pull request Mar 10, 2026
Max redirect handling got broken in v0.14.1 because of cloudprober#1081. This change fixes that and adds a more complete test.
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