Skip to content

Added custom interval for RDS discovery call - #3

Merged
conallob merged 1 commit into
conallob:mainfrom
arshbhatti8:custom-target-discovery-interval
Mar 16, 2026
Merged

conallob merged 1 commit into
conallob:mainfrom
arshbhatti8:custom-target-discovery-interval

Conversation

@arshbhatti8

Copy link
Copy Markdown

Problem Statement
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.

Solution
This PR adds a new re_eval_sec field to the TargetsDef proto, allowing users to configure how often the probe scheduler re-evaluates its target list on a per-probe basis.

Changes:

targets/proto/targets.proto — Adds optional int32 re_eval_sec = 32 to TargetsDef. When set, this overrides the default 1-minute target update interval for the probe.
targets/proto/targets.pb.go — Regenerated protobuf Go bindings with GetReEvalSec() accessor.
probes/options/options.go — Reads re_eval_sec from the targets config and propagates it to Options.TargetsUpdateInterval.
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.

Example config:


probe {
  targets {


    rds_targets { ... }
    re_eval_sec: 10  # Re-discover targets every 10 seconds instead of 60
  }
}

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

Tested with the following config snippet:

interval_msec: 5000  
  timeout_msec: 2000    

  targets {
    rds_targets {
      rds_server_options {
        server_address: "localhost:9060"
      }
      resource_path: "ResourceDiscovery://ListResources"
      filter {
        key: "private"
        value: "false"
      }
      filter {
        key: "state"
        value: "RUNNING"
      }
    }
    re_eval_sec: 10  # How often to re-discover targets (seconds)
  }

First fetch for targets:
Screenshot 2026-03-16 at 11 46 12 AM

Second fetch:
Screenshot 2026-03-16 at 11 46 24 AM

@conallob
conallob merged commit 9ff2953 into conallob:main Mar 16, 2026
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