Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Gray <[email protected]>
  • Loading branch information
graytaylor0 committed Nov 13, 2024
1 parent 005d515 commit ecca218
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.opensearch.dataprepper.model.annotations.AlsoRequired;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.model.annotations.UsesDataPrepperPlugin;
import org.opensearch.dataprepper.model.configuration.PluginModel;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
Expand All @@ -34,7 +35,7 @@ public class AggregateProcessorConfig {
@JsonProperty("identification_keys")
@NotEmpty
@ExampleValues({
@ExampleValues.Example(value = "group_id", description = "Aggregate based on the values of a group_id key in the Events")
@Example(value = "group_id", description = "Aggregate based on the values of a group_id key in the Events")
})
private List<String> identificationKeys;

Expand All @@ -47,9 +48,9 @@ public class AggregateProcessorConfig {
@JsonPropertyDescription("The amount of time that a group should exist before it is concluded automatically. Supports ISO_8601 notation strings (\"PT20.345S\", \"PT15M\", etc.) as well as simple notation for seconds (\"60s\") and milliseconds (\"1500ms\"). Default value is 180s.")
@JsonProperty(value = "group_duration", defaultValue = DEFAULT_GROUP_DURATION_SECONDS + "s")
@ExampleValues({
@ExampleValues.Example(value = "180s", description = "Aggregated groups will be flushed after 180 seconds"),
@ExampleValues.Example(value = "1000ms", description = "Aggregated groups will be flushed after 1,000 milliseconds"),
@ExampleValues.Example(value = "PT2H", description = "Aggregated groups will be flushed after 2 hours"),
@Example(value = "180s", description = "Aggregated groups will be flushed after 180 seconds"),
@Example(value = "1000ms", description = "Aggregated groups will be flushed after 1,000 milliseconds"),
@Example(value = "PT2H", description = "Aggregated groups will be flushed after 2 hours"),
})
private Duration groupDuration = Duration.ofSeconds(DEFAULT_GROUP_DURATION_SECONDS);

Expand All @@ -72,7 +73,7 @@ public class AggregateProcessorConfig {
@JsonPropertyDescription("A <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a>, such as <code>/some-key == \"test\"</code>, that will be evaluated to determine whether the processor will be run on the event.")
@JsonProperty("aggregate_when")
@ExampleValues({
@ExampleValues.Example(value = "/some_key == null", description = "Only includes events in the aggregations if the key some_key is null or does not exist.")
@Example(value = "/some_key == null", description = "Only includes events in the aggregations if the key some_key is null or does not exist.")
})
private String whenCondition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.model.annotations.UsesDataPrepperPlugin;
import org.opensearch.dataprepper.model.configuration.PluginModel;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
Expand Down Expand Up @@ -36,7 +37,7 @@ 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({
@ExampleValues.Example(value = "ip_address", description = "Anomalies will be detected separately for each unique IP address from the existing ip_address key of the Event.")
@Example(value = "ip_address", description = "Anomalies will be detected separately for each unique IP address from the existing ip_address key of the Event.")
})
private List<String> identificationKeys = Collections.emptyList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin;
import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.model.processor.Processor;
import org.opensearch.dataprepper.model.record.Record;
import org.slf4j.Logger;
Expand Down Expand Up @@ -65,9 +66,9 @@ 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."),
@ExampleValues.Example(value = "1000ms", description = "Delays for 1,000 milliseconds."),
@ExampleValues.Example(value = "PT10M", description = "Delays for 10 minutes."),
@Example(value = "1s", description = "Delays for 1 second."),
@Example(value = "1000ms", description = "Delays for 1,000 milliseconds."),
@Example(value = "PT10M", description = "Delays for 10 minutes."),
})
private Duration delayFor = Duration.ofSeconds(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotBlank;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;

import java.util.List;

Expand Down Expand Up @@ -63,15 +64,15 @@ public class CsvProcessorConfig {
"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({
@ExampleValues.Example(value = "column_one", description = "Specifies column_one as one of the column names to create")
@Example(value = "column_one", description = "Specifies column_one as one of the column names to create")
})
private List<String> columnNames;

@JsonProperty("csv_when")
@JsonPropertyDescription("A <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a> such as <code>/some_key == \"test\"</code>. " +
"If specified, the <code>csv</code> processor will only run on events when the expression evaluates to true. ")
@ExampleValues({
@ExampleValues.Example(value = "/some_key == null", description = "Only runs the csv processor if the key some_key is null or does not exist.")
@Example(value = "/some_key == null", description = "Only runs the csv processor if the key some_key is null or does not exist.")
})
private String csvWhen;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.plugins.processor.decompress.encoding.EncodingType;
import org.opensearch.dataprepper.plugins.processor.decompress.encoding.DecoderEngineFactory;

Expand All @@ -32,9 +33,6 @@ 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({
@ExampleValues.Example(value = "gzip", description = "Specifies gzip decompression")
})
private DecompressionType decompressionType;

@JsonPropertyDescription("A list of strings with which to tag events when the processor fails to decompress the keys inside an event. Defaults to <code>_decompression_failure</code>.")
Expand All @@ -44,7 +42,7 @@ public class DecompressProcessorConfig {
@JsonPropertyDescription("A <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a>, such as <code>/is_compressed == true</code>, that determines when the decompress processor will run on certain events.")
@JsonProperty("decompress_when")
@ExampleValues({
@ExampleValues.Example(value = "/some_key == null", description = "Only runs the decompress processor on the Event if the key some_key is null or does not exist.")
@Example(value = "/some_key == null", description = "Only runs the decompress processor on the Event if the key some_key is null or does not exist.")
})
private String decompressWhen;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static class Entry {
@ExampleValues({
@Example(value = "my_string_value", description = "Adds a value of 'my_string_value' to the key or metadata_key"),
@Example(value = "false", description = "Adds a value of false to the key or metadata_key"),
@Example(value = "10", description = "Adds a value of 10 to the key or metadata_key"),
@Example(value = "[ \"element_one\", \"element_two\" ]", description = "Adds an array value with two elements to the key or metadata_key"),
})
private Object value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opensearch.dataprepper.model.annotations.ConditionalRequired.IfThenElse;
import org.opensearch.dataprepper.model.annotations.ConditionalRequired.SchemaProperty;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.typeconverter.ConverterArguments;

import java.util.List;
Expand Down Expand Up @@ -70,10 +71,10 @@ public class ConvertEntryTypeProcessorConfig implements ConverterArguments {
private List<String> tagsOnFailure;

@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>")
@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_type</code> operation. If specified, the <code>convert_type</code> operation runs only when the expression evaluates to true. Example: <code>/mykey != \"test\"</code>")
@ExampleValues({
@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."),
@ExampleValues.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.")
@Example(value = "/some_key == null", description = "Only runs the convert_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_type processor on the Event if the key some_key is an integer.")
})
private String convertWhen;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import jakarta.validation.constraints.NotNull;
import org.opensearch.dataprepper.model.annotations.AlsoRequired;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;

import java.util.List;

Expand All @@ -36,9 +37,6 @@ public static class Entry {
@NotNull
@JsonProperty("to_key")
@JsonPropertyDescription("The key of the new entry to be added.")
@ExampleValues({
@ExampleValues.Example(value = "my_new_key", description = "Copies the value configured in from_key to a key of my_new_key")
})
private String toKey;

@JsonProperty("overwrite_if_to_key_exists")
Expand All @@ -50,8 +48,8 @@ public static class Entry {
@JsonPropertyDescription("A <a href=\"https://opensearch.org/docs/latest/data-prepper/pipelines/expression-syntax/\">conditional expression</a>, " +
"such as <code>/some-key == \"test\"</code>, that will be evaluated to determine whether the processor will be run on the event.")
@ExampleValues({
@ExampleValues.Example(value = "/some_key != null", description = "Only runs the copy_values processor on the Event if the existing key some_key is not null."),
@ExampleValues.Example(value = "/some_key typeof integer", description = "Only runs the copy_values processor on the Event if the key some_key is an integer.")
@Example(value = "/some_key != null", description = "Only runs the copy_values processor on the Event if the existing key some_key is not null."),
@Example(value = "/some_key typeof integer", description = "Only runs the copy_values processor on the Event if the key some_key is an integer.")
})
private String copyWhen;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.opensearch.dataprepper.model.annotations.ExampleValues;
import org.opensearch.dataprepper.model.annotations.ExampleValues.Example;
import org.opensearch.dataprepper.model.event.EventKey;
import org.opensearch.dataprepper.model.event.EventKeyConfiguration;
import org.opensearch.dataprepper.model.event.EventKeyFactory;
Expand All @@ -34,7 +35,7 @@ public class DeleteEntryProcessorConfig {
@JsonPropertyDescription("Specifies under what condition the <code>delete_entries</code> processor should perform deletion. " +
"By default, keys are always deleted. Example: <code>/mykey == \"---\"</code>")
@ExampleValues({
@ExampleValues.Example(value = "/some_key == null", description = "Only runs the delete_entries processor on the Event if the key some_key is null or does not exist.")
@Example(value = "/some_key == null", description = "Only runs the delete_entries processor on the Event if the key some_key is null or does not exist.")
})
private String deleteWhen;

Expand Down

0 comments on commit ecca218

Please sign in to comment.