Skip to content

[config] Catch more init errors in configtest - #1525

Merged
manugarg merged 4 commits into
mainfrom
configtest-more-checks
Oct 5, 2026
Merged

manugarg merged 4 commits into
mainfrom
configtest-more-checks

Conversation

@manugarg

@manugarg manugarg commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

-configtest checks only config parsing and a handful of probe fields, so many config mistakes pass it and then fail at startup. This moves a first batch of pure config checks to where configtest can reach them.

Configtest now also catches:

  • Probes: missing targets, bad run_on regex, invalid schedule, validator errors (missing or duplicate name, bad regex, bad HTTP status range, bad jq filter), and invalid source_ip or one that doesn't match ip_version.
  • Duplicate probe names, among the probes that don't set run_on.
  • Targets: bad regex, bad static endpoints (e.g. duplicates), and bad DNS options (dns_server along with dns_options.server, bad server address, max_cache_age_sec smaller than ttl_sec). Same checks apply to the shared_targets definitions.
  • Shared targets: a probe referring to shared_targets that are not defined.
  • Surfacer options: bad latency_metric_pattern, bad metric name regexes, label filter without a key.

Notes

  • Probes with run_on are skipped in the duplicate name check. Two probes can share a name as long as they don't end up on the same host, and configtest can't tell which host the config is meant for.
  • ValidateProbeConfig now requires targets (for the probe types that need them), initializes validators and parses source_ip; BuildProbeOptions no longer does these itself. source_interface is still resolved in BuildProbeOptions, as it depends on the host.
  • New targets.Validate() is called only from configtest. Init still goes through targets.New, so nothing is validated or logged twice at startup.
  • Schedule is parsed twice at init: once to validate, and once to build it with the probe's logger. The Schedule: ... info log moved from parsePeriod to NewSchedule, so it's still logged once.
  • A config with dns_options.server now logs an INFO line (Overriding default resolver with: ...) during configtest, as the resolver options parser logs it.

Not covered yet

Errors that come from probe-type specific Init, type-specific targets (RDS, k8s), servers, tracing, and alert notifiers still show up only at init. Those need validation to be split out from resource creation first.

Configtest now also catches the following errors, which so far showed up
only at the init time:

- Probes: missing targets, bad run_on regex, invalid schedule, and
  validator errors (missing or duplicate name, bad regex, etc).
- Duplicate probe names, among the probes that don't set run_on.
- Surfacer options: bad latency_metric_pattern, bad metric name regexes,
  label filter without a key.
Configtest now also catches:

- Targets: bad regex, bad static endpoints (e.g. duplicates), and bad DNS
  options (dns_server along with dns_options.server, bad server address,
  max_cache_age_sec smaller than ttl_sec).
- Reference to shared targets that are not defined.
- Invalid source_ip, or source_ip that doesn't match the ip_version.
Surfacers usually don't have a name, in which case the error said
'surfacer ""'. Fall back to the surfacer type, like we do for the
surfacer's logger at the init time.
@manugarg
manugarg merged commit 7fcb3c8 into main Oct 5, 2026
13 checks passed
manugarg added a commit that referenced this pull request Nov 15, 2026
Follow-up to #1525. That PR covered checks common to all probes; this one covers the config-only checks that live in each probe type's Init, so they now fail -configtest instead of showing up only at startup.

Each of HTTP, DNS, PING, TCP, EXTERNAL, SQL, GRPC, EXTERNAL_GRPC and BROWSER gets a ValidateConfig(c, opts) function. The probe's Init calls it first, and configtest calls it through the new probes.ValidateConfig().
@manugarg
manugarg deleted the configtest-more-checks branch November 15, 2026 21:29
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