Skip to content

[probes.sched] Added custom interval for RDS discovery call - #1255

Merged
manugarg merged 8 commits into
cloudprober:mainfrom
arshbhatti8:custom-target-discovery-interval
Apr 9, 2026
Merged

manugarg merged 8 commits into
cloudprober:mainfrom
arshbhatti8:custom-target-discovery-interval

Conversation

@arshbhatti8

@arshbhatti8 arshbhatti8 commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Add a new targets_update_sec field to the ProbeDef proto, allowing users to configure how often the probe scheduler re-evaluates its target list on a per-probe basis.

Currently Cloudprober's probe scheduler re-evaluates (discovers) targets on a fixed 1-minute interval. For dynamic infrastructure — such as RDS-discovered targets in environments where instances spin up and down frequently — this default is too slow to detect changes promptly. There was no way to configure this interval per-probe, forcing users to either tolerate stale target lists or work around it at a higher level.

Changes:

  • probes/proto/config.proto — Adds optional int32 targets_update_sec = 103 to ProbeDef.
  • probes/options/options.go — Reads targets_update_sec from the probe config and sets TargetsUpdateInterval in Options.
  • probes/common/sched/sched.go — Applies TargetsUpdateInterval from options when initializing the scheduler, overriding the default before the existing floor check against the probe interval.
  • probes/common/sched/sched_test.go — Adds tests for the scheduler init logic covering default, custom, clamped, and zero-value cases.

Example config

probe {
  name: "my_probe"
  type: HTTP
  interval: "5s"
  timeout: "2s"

  targets {
    rds_targets { ... }
  }

  targets_update_sec: 10  # Re-discover targets every 10 seconds instead of 60
}

The existing behavior is preserved — if targets_update_sec is not set, the scheduler continues to default to 1 minute, and the floor of max(targets_update_sec, probe_interval) is still enforced.

@manugarg manugarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added a couple of comments. Can you also add unit tests for these changes please.

Comment thread targets/proto/targets.proto Resolved
Comment thread targets/proto/targets.proto Resolved
@arshbhatti8

Copy link
Copy Markdown
Contributor Author

@manugarg Please let me know if these changes look good and if you can approve the workflow so the tests can run, that would be great.

Comment thread probes/proto/config.proto Resolved
Comment thread probes/options/options_test.go Resolved
Comment thread probes/options/options.go Resolved
@arshbhatti8
arshbhatti8 requested a review from manugarg April 8, 2026 20:03
@manugarg manugarg changed the title Added custom interval for RDS discovery call [probes.sched] Added custom interval for RDS discovery call Apr 9, 2026
@manugarg
manugarg merged commit 415c2e3 into cloudprober:main Apr 9, 2026
10 checks passed
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.

2 participants