Repository navigation
docs: share field descriptions with benthos and scan benthos internals for copies - #4877
Conversation
| service.NewStringField(hsiFieldRateLimit). | ||
| Description("An optional xref:components:rate_limits/about.adoc[rate limit] to throttle requests by."). | ||
| ShortDescription("An optional rate limit resource to throttle requests by."). | ||
| Description("The name of an optional xref:components:rate_limits/about.adoc[rate limit resource] that the gateway applies to each request it receives. When the rate limit is reached, the gateway rejects the request with a `429` response and a `Retry-After` header."). |
There was a problem hiding this comment.
Generated docs aren't regenerated. This PR changes field descriptions in gateway, file, otlp_http, redis rate limit, cassandra, pulsar, oauth2 and retries. It doesn't update docs/modules/. For example, docs/modules/components/partials/fields/inputs/gateway.adoc still has the old "Specify the status code to return with synchronous responses" text.
CONTRIBUTING.md §6: "Run task docs and commit the result … CI fails on stale docs." CLAUDE.md says to regenerate with CGO_ENABLED=1 TAGS=x_benthos_extra task docs.
Suggested fix: regenerate the docs once benthos is bumped and commit the output in its own commit (§3.4.1).
There was a problem hiding this comment.
This waits on the benthos release. The PR uses constructors and constants that are on benthos main but not yet released, so it can't build against the pinned v4.81.0. The docs regenerate in the same commit as the benthos bump.
d095285 to
0836173
Compare
0836173 to
8a73be7
Compare
8872cb1 to
dfee1b5
Compare
| service.NewStringField(hsiFieldRateLimit). | ||
| Description("An optional xref:components:rate_limits/about.adoc[rate limit] to throttle requests by."). | ||
| ShortDescription("An optional rate limit resource to throttle requests by."). | ||
| Description("The name of an optional xref:components:rate_limits/about.adoc[rate limit resource] that the gateway applies to each request it receives. When the rate limit is reached, the gateway rejects the request with a `429` response and a `Retry-After` header."). | ||
| ShortDescription("An optional rate limit resource that the gateway applies to each request."). | ||
| Default(""), | ||
| service.NewObjectField(hsiFieldResponse, | ||
| service.NewInterpolatedStringField(hsiFieldResponseStatus). | ||
| Description("Specify the status code to return with synchronous responses. This is a string value, which allows you to customize it based on resulting payloads and their metadata."). | ||
| ShortDescription("The status code returned with synchronous responses."). | ||
| Description("The HTTP status code that the gateway returns when the pipeline produces a synchronous response. The value is interpolated against the first response message, so the code can depend on its contents and metadata."). | ||
| ShortDescription("The HTTP status code the gateway returns with synchronous responses."). | ||
| Examples(`${! json("status") }`, `${! meta("status") }`). | ||
| Default("200"), | ||
| service.NewInterpolatedStringMapField(hsiFieldResponseHeaders). | ||
| Description("Specify headers to return with synchronous responses."). | ||
| Description("The headers that the gateway adds to synchronous responses. Header values are interpolated against the first response message."). |
There was a problem hiding this comment.
Generated docs not regenerated (CONTRIBUTING.md §6). §6 says: "Run task docs and commit the result … CI fails on stale docs." This PR rewrites field descriptions here and in cassandra, cypher, bigquery, file, otlp_http, pulsar, redis rate_limit and others, but no files under docs/modules/ changed. For example, docs/modules/components/partials/fields/inputs/gateway.adoc still has the old text "Specify headers to return with synchronous responses".
Fix: after the benthos bump that adds the new constructors, regenerate with CGO_ENABLED=1 TAGS=x_benthos_extra task docs (see CLAUDE.md) and commit the updated partials.
There was a problem hiding this comment.
This waits on the benthos release. The PR uses constructors and constants that are on benthos main but not yet released, so it can't build against the pinned v4.81.0. The docs regenerate in the same commit as the benthos bump.
dfee1b5 to
9e47c83
Compare
|
|
||
| // ParseConfig parses OAuth2 configuration from a parsed config. | ||
| // ParseConfig parses OAuth2 configuration from a parsed config of a field | ||
| // defined with service.NewOAuth2Field. |
There was a problem hiding this comment.
Build dependency: go.mod still pins benthos v4.81.0
This PR switches to service.NewOAuth2Field, service.NewRetryBackOffFields and service.NewMaxRetriesField and deletes the local copies (oauth2.FieldSpec, retries.CommonRetryBackOffFields, retries.MaxRetriesDescription). But go.mod was not changed, so it still pins github.com/redpanda-data/benthos/v4 v4.81.0. The first commit's message says: "Needs a benthos release that exports the new constants." If v4.81.0 doesn't export these constructors, every caller fails to compile (otlp, schemaregistry, redpanda tracer, aws, mongodb, kafka sarama).
Fix: bump benthos in go.mod/go.sum (task bump-benthos) in this PR, or hold the PR until that release exists.
Also check that the field names the new constructors produce still match what the parsers read. oauth2.ParseConfig reads fieldEnabled, fieldClientKey, etc. retries.CommonRetryBackOffCtorFromParsed reads max_retries, backoff.initial_interval, etc. The kafka sarama output parses with oskFieldMaxRetries. If any name differs, configs will fail to parse at runtime, not at compile time.
There was a problem hiding this comment.
Expected. This PR waits on a benthos release that includes the new constructors. It gets the go.mod bump and regenerated docs then.
d8113b5 to
c31d0ac
Compare
c31d0ac to
ff7b04a
Compare
fa3ee71 to
44dc6fa
Compare
666ac2b to
bf7d829
Compare
bf7d829 to
6f79099
Compare
…rnals Use the retry and oauth2 description constants that benthos now exports from public/service, and give the gateway, file, redis rate limit, otlp http, and cassandra reconnection fields descriptions of their own behaviour. The copies test now scans benthos's internal packages too. Needs a benthos release that exports the new constants.
…e pulsar tls text
Use service.NewOAuth2Field, service.NewRetryBackOffFields and service.NewMaxRetriesField in place of the local copies, and give the pulsar root_cas_file field its own description of how the client uses the file.
6f79099 to
39aa44e
Compare
| LintRule(`root = if this.parse_duration().catch(0) < 1 { "reconnection.max_interval must be a positive duration"}`), | ||
| ). | ||
| Description("Configure exponential backoff for reconnection attempts to DOWN nodes. When enabled, this replaces the driver's default constant reconnection policy with an exponential backoff strategy that gradually increases the delay between reconnection attempts. This reduces connection storm scenarios during widespread outages while ensuring eventual recovery.").Version("4.66.0"). | ||
| Description("Exponential backoff for the retries the driver makes within one connection attempt to a host. It applies on the initial connection and on each `reconnect_interval` attempt to a node marked as DOWN, and replaces the driver's default of 3 retries 1s apart.").Version("4.66.0"). |
There was a problem hiding this comment.
gocql uses MaxRetries as the total number of connection attempts, not as the number of retries after the first attempt.
Each loop iteration is one connection attempt, and the loop runs GetMaxRetries() times: connectionpool.go#L565-L581 (gocql v1.7.0, the version in go.mod).
Thus the fallback ConstantReconnectionPolicy{MaxRetries: 3, Interval: 1 * time.Second} makes 3 attempts, not 3 retries.
| Description("Exponential backoff for the retries the driver makes within one connection attempt to a host. It applies on the initial connection and on each `reconnect_interval` attempt to a node marked as DOWN, and replaces the driver's default of 3 retries 1s apart.").Version("4.66.0"). | |
| Description("Exponential backoff between the connection attempts that the driver makes each time it connects to a host. It applies on the initial connection and on each `reconnect_interval` attempt to a node marked as DOWN, and replaces the driver's default of 3 attempts 1s apart.").Version("4.66.0"). |
Lines 125 and 128 also say "the retries ... within one connection attempt". If you take this change, "the connection attempts each time the driver connects to a host" fits there too.
There was a problem hiding this comment.
Thanks, taken in 5339e84, and lines 125 and 128 now say "the connection attempts each time the driver connects to a host" too.
| @@ -122,13 +122,13 @@ func clientFields(tlsVersion string) []*service.ConfigField { | |||
| Description("The maximum number of retry attempts."). | |||
There was a problem hiding this comment.
This PR does not change this text, but the PR body lists max_retries as changed.
The value is the total number of connection attempts: connectionpool.go#L565.
Also, the driver waits one more interval after the last failed attempt, before it returns the error: connectionpool.go#L581.
| Description("The maximum number of retry attempts."). | |
| Description("The maximum number of connection attempts each time the driver connects to a host."). |
| Fields( | ||
| service.NewInterpolatedStringField(foFieldPath). | ||
| Description("The file to write to, if the file does not yet exist it will be created."). | ||
| Description("The path of the file to write to. The output creates the file and any missing parent directories. A write fails when the file name contains a NUL byte. On Windows it also fails for `<`, `>`, `:`, `\"`, `|`, `?`, `*`, and control characters, and on macOS for `:`, which macOS would turn into a path separator."). |
There was a problem hiding this comment.
Two points:
- The code rejects a NUL byte anywhere in the path, not only in the file name: output_file.go#L268. The Windows and macOS checks look only at the file name: output_file.go#L275-L282.
- macOS does not turn
:into a path separator. I ranos.WriteFile("a:b.txt", ...)on macOS 26.6 with APFS, and it createda:b.txtin the same directory. Finder shows:as/, but the file does not move. The claim comes from the code comment at L265-L266 and the error at L326, which have the same problem. The validation is still useful, so I suggest removing only the reason.
| Description("The path of the file to write to. The output creates the file and any missing parent directories. A write fails when the file name contains a NUL byte. On Windows it also fails for `<`, `>`, `:`, `\"`, `|`, `?`, `*`, and control characters, and on macOS for `:`, which macOS would turn into a path separator."). | |
| Description("The path of the file to write to. The output creates the file and any missing parent directories. A write fails when the path contains a NUL byte. On Windows it also fails when the file name contains `<`, `>`, `:`, `\"`, `|`, `?`, `*`, or a control character, and on macOS when the file name contains `:`."). |
There was a problem hiding this comment.
Thanks for testing it. Taken in 5339e84. I also removed the HFS+/APFS reason from the code comment and from the error message, which now says the output rejects a colon on macOS.
|
|
||
| spec.Field(service.NewIntField("count"). | ||
| Description("The maximum number of messages to allow for a given period of time."). | ||
| Description("The maximum number of requests allowed in each `interval`. Requests are counted in Redis under `key`, so every Redpanda Connect instance that uses the same key shares this limit. The value must be greater than zero."). |
There was a problem hiding this comment.
The counter is one key in one Redis instance: rate_limit.go#L101-L104. Instances share the limit only when they use the same Redis instance and the same key.
| Description("The maximum number of requests allowed in each `interval`. Requests are counted in Redis under `key`, so every Redpanda Connect instance that uses the same key shares this limit. The value must be greater than zero."). | |
| Description("The maximum number of requests allowed in each `interval`. Requests are counted in Redis under `key`, so every Redpanda Connect instance that uses the same Redis instance and the same `key` shares this limit. The value must be greater than zero."). |
Not in this diff: the summary and description at L30-L31 call this a token bucket. The script is a fixed window counter: INCR, then PEXPIRE with interval on the first request of each window.
There was a problem hiding this comment.
Taken in 5339e84. I also replaced "token bucket" in the summary and description with how it works: a fixed window that starts with its first request, shared by instances that use the same Redis instance and key.
| Description("The graph database user to authenticate as, with `password` and, optionally, `realm`."), | ||
| service.NewStringField(coFieldBasicAuthPassword). | ||
| Description("The password to use for authentication. Used together with `username` for basic authentication."). | ||
| Description("The password of the graph database user set in `username`."). |
There was a problem hiding this comment.
I suggest that these descriptions do not say what kind of server the user belongs to.
- The engine is limited by the protocol, not by the Cypher language. The output connects with
neo4j-go-driver(L22), and theuriexamples use onlyneo4j://andbolt://schemes (L94-L103). So any server that speaks Bolt can be the target, for example Neo4j or Memgraph. usernameis the user that the driver sends inneo4j.BasicAuth(user, pass, realm)(L84) when it connects touri. It is an account on that server, whatever the engine is. "The graph database user" makes an assumption that the code does not need.- The new text must be different enough from other
usernamefields to pass the copy test. Naming the driver anduridoes that, and makes no claim about the engine. I did not run the copy test on this text.
| Description("The graph database user to authenticate as, with `password` and, optionally, `realm`."), | |
| service.NewStringField(coFieldBasicAuthPassword). | |
| Description("The password to use for authentication. Used together with `username` for basic authentication."). | |
| Description("The password of the graph database user set in `username`."). | |
| Description("The user that the driver authenticates as when it connects to `uri`, with `password` and, optionally, `realm`."), | |
| service.NewStringField(coFieldBasicAuthPassword). | |
| Description("The password of the user set in `username`."). |
Not in this diff: "graph database" is also at L46, L59, L89-L90, and L106. You can keep this change limited to these two fields, or fix all of them in a follow-up so the component stays consistent.
There was a problem hiding this comment.
Taken in 5339e84, and I fixed the other "graph database" mentions in the same change so the component reads consistently: the summary and description now say any database that speaks the Bolt protocol, such as Neo4j or Memgraph. The copies test passes on the new text.
…nd cypher auth text - cassandra: max_retries counts connection attempts, not retries. - file: the NUL check covers the whole path, and macOS doesn't turn ':' into a path separator (the code comment and error said so too). - redis rate limit: a fixed window shared per Redis instance and key, not a token bucket. - cypher: any Bolt server, not a particular graph database.
Stacked on #4876. Don't merge until redpanda-data/benthos#513 is released: this uses the field constructors that PR adds, so it doesn't build against benthos v4.81.0. Before merging, bump benthos.
Why
#4875 fails CI on copied field descriptions but skips copies of benthos's internal packages, because this repo can't import them. Those were real copies:
internal/oauth2andinternal/retriesforked the benthos field definitions, so a fix on one side never reached the other.What changes
service.NewOAuth2Field: the otlp outputs, the redpanda tracer, and schema registry. The duplicateoauth2.FieldSpecis deleted; parsing is unchanged because the field names are identical.service.NewRetryBackOffFields: the kinesis, firehose, sqs, dynamodb, and mongodb outputs and processor. The duplicateretries.CommonRetryBackOffFieldsis deleted.max_retriesusesservice.NewMaxRetriesField.rate_limitandsync_response.*: the gateway rejects with429andRetry-After.path: validates file names.count: a shared counter underkey.follow_redirects: a non-2xx response fails the write.max_retries, and backoff: gocql semantics.tls.root_cas_file.basic_authusername and password.max_in_flight.internal/as well aspublic/docs.FieldString("name", "description")style constructorsSchema diff for the touched components, before and after, with benthos on #513: no field names, types, defaults, or flags change. OAuth2
scopesandendpoint_paramsnow show their versions (3.45.0 and 4.21.0), and some descriptions change as listed above.With a local replace on #513, the build passes, the copy test reports zero copies, and tests and lint for the touched packages pass. As a negative control, restoring the old Pulsar text makes the copy test fail.