Repository navigation
[probes] Validate probe type specific config in configtest - #1563
Merged
Merged
Conversation
Add ValidateConfig() to the probe types that have config-only checks in their Init: HTTP, DNS, PING, TCP, EXTERNAL, SQL, GRPC, EXTERNAL_GRPC and BROWSER. Init calls it first, and configtest calls it through the new probes.ValidateConfig(), so these errors now fail configtest instead of showing up only at startup: - HTTP: relative_url not starting with '/', bad proxy_url, bad response_metrics_options. - HTTP, DNS, BROWSER: requests_per_probe * requests_interval_msec + timeout exceeding the interval. - DNS: invalid query_type. - PING: payload_size out of bounds. - TCP: tls_config with tls_handshake explicitly set to false. - EXTERNAL: empty or unparseable command, bad output_metrics_options. - SQL: missing flavor, both query and query_file, validators or response_metrics_options without a query, bad response_metrics_options. - GRPC: both body and body_file, xds scheme without xds support. - EXTERNAL_GRPC: missing server or probe_type, bad output_metrics_options.
- Move the requests_per_probe * requests_interval_msec check into a shared options.ValidateRequestsDuration(), used by HTTP, DNS and BROWSER. It multiplies as int64, so large values no longer overflow int32 and pass the check. - Keep the gRPC xds check in Init only: it depends on the build tags, and configtest may run on a different build. - SQL: run ValidateConfig before the flavor switch, so the flavor error is in one place. - EXTERNAL_GRPC: don't build a payload parser in ValidateConfig if output_metrics_options is not set.
Converting requests_per_probe * requests_interval_msec to time.Duration can still overflow int64 for very large values. Compare in milliseconds instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-configtestinstead 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'sInitcalls it first, and configtest calls it through the newprobes.ValidateConfig().Configtest now also catches:
relative_urlnot starting with/(still redacted withredact_url_query_in_logs), badproxy_url, badresponse_metrics_options.requests_per_probe*requests_interval_msec+ timeout exceeding the interval. The check is now shared (options.ValidateRequestsDuration()) and compares in milliseconds as int64, so very large values no longer overflow and pass. The error now shows the requests part in milliseconds and the timeout separately.query_type.payload_sizeout of bounds.tls_configwithtls_handshakeexplicitly set to false.command, badoutput_metrics_options.flavor, bothqueryandquery_file, validators orresponse_metrics_optionswithout a query, badresponse_metrics_options.bodyandbody_file.serverorprobe_type, badoutput_metrics_options.Notes
Init.dns_probe(<name>):. Configtest and startup init prefix the probe name; probes added through theAddProbegRPC call get the error without it, like the other probe types' errors already do.xdsscheme in a build without xds support stays inInitonly. It depends on the build tags, and configtest may run on a different build than the one that runs the probe.query_fileat init, as that's only known after reading the file.Not covered yet
Starlark (compile errors, empty
tls_configskey), and checks outside probe types: RDS and k8s targets, alert notifiers, probestatus surfacer defined twice, prometheus and bigquery surfacer checks, servers, and tracing.