-
Notifications
You must be signed in to change notification settings - Fork 202
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
Adds example annotations to a handful of processors #5140
Adds example annotations to a handful of processors #5140
Conversation
Signed-off-by: Taylor Gray <[email protected]>
@@ -31,6 +32,9 @@ public class DecompressProcessorConfig { | |||
@JsonPropertyDescription("The type of decompression to use for the keys in the event. Only <code>gzip</code> is supported.") | |||
@JsonProperty("type") | |||
@NotNull | |||
@ExampleValues({ |
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.
Let's avoid example values for enumerations. The enumeration set is the full list of examples.
@@ -63,6 +64,11 @@ public void shutdown() { | |||
public static class Configuration { | |||
@JsonProperty("for") | |||
@JsonPropertyDescription("The duration of time to delay. Defaults to <code>1s</code>.") | |||
@ExampleValues({ | |||
@ExampleValues.Example(value = "1s", description = "Delays for 1 second."), |
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.
You can import Example
so that you have @Example
throughout.
@@ -34,14 +36,17 @@ public class AnomalyDetectorProcessorConfig { | |||
|
|||
@JsonPropertyDescription("If provided, anomalies will be detected within each unique instance of these keys. For example, if you provide the ip field, anomalies will be detected separately for each unique IP address.") | |||
@JsonProperty("identification_keys") | |||
@ExampleValues({ |
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.
I think we don't need an example here since this is just a key.
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.
Same here. I think for lists it doesn't hurt to have a placeholder value
@@ -61,11 +63,17 @@ public class CsvProcessorConfig { | |||
"the header in <code>column_names_source_key</code> generates the event fields. If too few columns are specified " + | |||
"in this field, the remaining column names are automatically generated. " + | |||
"If too many column names are specified in this field, the CSV processor omits the extra column names.") | |||
@ExampleValues({ |
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 fits in the category of source examples which I don't see as adding a whole lot of value.
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.
I think for the list values like this, the example is helpful. This makes it clear what to input even though the resulting config is a list and the description shows a full List
@@ -84,6 +94,11 @@ public static class Entry { | |||
@AlsoRequired.Required(name="format", allowedValues = {"null"}), | |||
@AlsoRequired.Required(name=VALUE_EXPRESSION_KEY, allowedValues = {"null"}) | |||
}) | |||
@ExampleValues({ |
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.
Perhaps include a number as well.
@@ -70,6 +72,10 @@ public class ConvertEntryTypeProcessorConfig implements ConverterArguments { | |||
|
|||
@JsonProperty("convert_when") | |||
@JsonPropertyDescription("Specifies a condition using a <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a> for performing the <code>convert_entry_type</code> operation. If specified, the <code>convert_entry_type</code> operation runs only when the expression evaluates to true. Example: <code>/mykey != \"---\"</code>") | |||
@ExampleValues({ | |||
@Example(value = "/some_key == null", description = "Only runs the convert_entry_type processor on the Event if the existing key some_key is null or does not exist."), |
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.
Please use convert_type
in the documentation.
@@ -70,6 +72,10 @@ public class ConvertEntryTypeProcessorConfig implements ConverterArguments { | |||
|
|||
@JsonProperty("convert_when") | |||
@JsonPropertyDescription("Specifies a condition using a <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a> for performing the <code>convert_entry_type</code> operation. If specified, the <code>convert_entry_type</code> operation runs only when the expression evaluates to true. Example: <code>/mykey != \"---\"</code>") | |||
@ExampleValues({ | |||
@Example(value = "/some_key == null", description = "Only runs the convert_entry_type processor on the Event if the existing key some_key is null or does not exist."), | |||
@Example(value = "/some_key typeof integer", description = "Only runs the convert_entry_type processor on the Event if the key some_key is an integer.") |
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.
Please use convert_type
in the documentation.
@@ -35,6 +37,9 @@ public static class Entry { | |||
@NotNull | |||
@JsonProperty("to_key") | |||
@JsonPropertyDescription("The key of the new entry to be added.") | |||
@ExampleValues({ |
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.
Let's avoid source/target examples.
Signed-off-by: Taylor Gray <[email protected]>
579b26c
to
ecca218
Compare
Description
Adds examples annotations for the following processors
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.