-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strict_mode top-level config option #166
base: main
Are you sure you want to change the base?
Conversation
fa9efbb
to
a41b78f
Compare
Signed-off-by: Jem Davies <[email protected]>
a41b78f
to
b058924
Compare
Signed-off-by: Jem Davies <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice man. Left some comments
public/service/stream_builder.go
Outdated
@@ -89,6 +90,7 @@ func NewStreamBuilder() *StreamBuilder { | |||
configSpec: tmpSpec, | |||
env: globalEnvironment, | |||
envVarLookupFn: os.LookupEnv, | |||
strictMode: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this'll be false by default so unsure this is necessary. See how lintingDisabled
is never set.
website/docs/configuration/about.md
Outdated
|
||
Introduced in v1.4.0. | ||
|
||
The default behavior of Bento is to attempt to send messages that have errored to the configured sink. The `strict_mode` option can be set to `true` to override this default behavior of Bento, and instead will reject any message batches with messages that have errors in them. Ultimately this will propagate a Nack to the input layer, which then depending on the component configured will either be handled or the message will be reprocessed from scratch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default behavior of Bento is to attempt to send messages that have errored to the configured sink. The `strict_mode` option can be set to `true` to override this default behavior of Bento, and instead will reject any message batches with messages that have errors in them. Ultimately this will propagate a Nack to the input layer, which then depending on the component configured will either be handled or the message will be reprocessed from scratch. | |
When `strict_mode` is set to `true`, Bento will reject all batches containing messages with errors, propagating a `nack` to the input layer. The input component's `nack` behaviour will then determine how these rejected messages are handled, otherwise re-processing them from scratch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great explanation. Think we simplify a bit though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated - think that we should keep the first sentence for context - rewrote the other sentences - with the suggestion in mind.
func (w *AsyncWriter) getStrictMode() bool { | ||
v := reflect.ValueOf(w.mgr) | ||
|
||
if v.Kind() == reflect.Pointer && !v.IsNil() { | ||
v = v.Elem() | ||
} | ||
|
||
if v.Kind() == reflect.Struct { | ||
field := v.FieldByName("StrictMode") | ||
if field.IsValid() && field.Kind() == reflect.Bool { | ||
return field.Bool() | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we are using reflect here?
return nil | ||
}) | ||
if hasErrors { | ||
w.log.Error("Failed to send message to %v: message batch contains errors\n", w.typeStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the \n
is necessary
w.log.Error("Failed to send message to %v: message batch contains errors\n", w.typeStr) | |
w.log.Error("Failed to send message to %v: message batch contains errors", w.typeStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other calls in this func to w.log.Error - do have a \n
.
internal/config/schema.go
Outdated
@@ -59,6 +61,7 @@ func observabilityFields() docs.FieldSpecs { | |||
}), | |||
docs.FieldString(fieldSystemCloseDelay, "A period of time to wait for metrics and traces to be pulled or pushed from the process.").HasDefault("0s"), | |||
docs.FieldString(fieldSystemCloseTimeout, "The maximum period of time to wait for a clean shutdown. If this time is exceeded Bento will forcefully close.").HasDefault("20s"), | |||
docs.FieldBool(fieldStrictMode, "Set strict_mode to true to override the default behavior of sending messages batches that have errored messages to the configured sink, and instead propagate a nack back to the source.").HasDefault(false).Advanced().AtVersion("1.4.0"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs.FieldBool(fieldStrictMode, "Set strict_mode to true to override the default behavior of sending messages batches that have errored messages to the configured sink, and instead propagate a nack back to the source.").HasDefault(false).Advanced().AtVersion("1.4.0"), | |
docs.FieldBool(fieldStrictMode, "Set `strict_mode` to `true` to override the default behavior of sending messages batches containing errored messages to the `output` layer, instead rejecting the batch and propagating a `nack` back to the source.").HasDefault(false).Advanced().AtVersion("1.4.0"), |
Signed-off-by: Jem Davies <[email protected]>
Signed-off-by: Jem Davies <[email protected]>
Signed-off-by: Jem Davies <[email protected]>
No description provided.