From 791e355794bed42e39490063a504bc592c4b1093 Mon Sep 17 00:00:00 2001 From: Katherine Shen <40495707+shenkw1@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:22:21 -0600 Subject: [PATCH] Remove code tags from processor names, fill in default values (#5278) * remove code tags from processor names in descriptions, add missing default values Signed-off-by: Katherine Shen --- .../AnomalyDetectorProcessorConfig.java | 10 +++++----- .../modes/RandomCutForestModeConfig.java | 17 +++++++++-------- .../lambda/processor/LambdaProcessorConfig.java | 2 +- .../processor/date/DateProcessorConfig.java | 2 +- .../mutateevent/CopyValueProcessorConfig.java | 12 ++++++++---- .../obfuscation/ObfuscationProcessorConfig.java | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/AnomalyDetectorProcessorConfig.java b/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/AnomalyDetectorProcessorConfig.java index 69d4f8c8a4..578e22a351 100644 --- a/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/AnomalyDetectorProcessorConfig.java +++ b/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/AnomalyDetectorProcessorConfig.java @@ -23,17 +23,17 @@ @JsonClassDescription("The anomaly detector processor takes structured data and runs anomaly detection algorithms " + "on fields that you can configure in that data.") public class AnomalyDetectorProcessorConfig { + @JsonPropertyDescription("A non-ordered List that is used as input to the ML algorithm to detect anomalies in the values of the keys in the list. At least one key is required.") + @JsonProperty("keys") + @NotEmpty + private List keys; + @JsonPropertyDescription("The ML algorithm (or model) used to detect anomalies. You must provide a mode. See random_cut_forest mode.") @JsonProperty("mode") @NotNull @UsesDataPrepperPlugin(pluginType = AnomalyDetectorMode.class) private PluginModel detectorMode; - @JsonPropertyDescription("A non-ordered List that is used as input to the ML algorithm to detect anomalies in the values of the keys in the list. At least one key is required.") - @JsonProperty("keys") - @NotEmpty - private List keys; - @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({ diff --git a/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/modes/RandomCutForestModeConfig.java b/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/modes/RandomCutForestModeConfig.java index c477746253..74c90fca50 100644 --- a/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/modes/RandomCutForestModeConfig.java +++ b/data-prepper-plugins/anomaly-detector-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/anomalydetector/modes/RandomCutForestModeConfig.java @@ -13,6 +13,7 @@ import java.util.HashSet; public class RandomCutForestModeConfig { + public static final String DEFAULT_TYPE = "metrics"; public static final int DEFAULT_SHINGLE_SIZE = 4; private static final int MIN_SHINGLE_SIZE = 1; public static final int MAX_SHINGLE_SIZE = 60; @@ -27,31 +28,31 @@ public class RandomCutForestModeConfig { public static final String VERSION_1_0 = "1.0"; @JsonPropertyDescription("The algorithm version number. Default is 1.0.") - @JsonProperty("version") + @JsonProperty(value = "version", defaultValue = VERSION_1_0) private String version = VERSION_1_0; public static final Set validVersions = new HashSet<>(Set.of(VERSION_1_0)); @JsonPropertyDescription("The type of data sent to the algorithm. Default is metrics type") - @JsonProperty("type") + @JsonProperty(value = "type", defaultValue = DEFAULT_TYPE) private String type = RandomCutForestType.METRICS.toString(); public static final Set validTypes = new HashSet<>(Set.of(RandomCutForestType.METRICS.toString())); - @JsonPropertyDescription("The shingle size used in the ML algorithm. Default is 60.") - @JsonProperty("shingle_size") + @JsonPropertyDescription("The shingle size used in the ML algorithm. Default is 4.") + @JsonProperty(value = "shingle_size", defaultValue = "" + DEFAULT_SHINGLE_SIZE) private int shingleSize = DEFAULT_SHINGLE_SIZE; @JsonPropertyDescription("The sample size used in the ML algorithm. Default is 256.") - @JsonProperty("sample_size") + @JsonProperty(value = "sample_size", defaultValue = "" + DEFAULT_SAMPLE_SIZE) private int sampleSize = DEFAULT_SAMPLE_SIZE; @JsonPropertyDescription("The time decay value used in the ML algorithm. Used as the mathematical expression timeDecay divided by SampleSize in the ML algorithm. Default is 0.1") - @JsonProperty("time_decay") + @JsonProperty(value = "time_decay", defaultValue = "" + DEFAULT_TIME_DECAY) private double timeDecay = DEFAULT_TIME_DECAY; - @JsonPropertyDescription("Output after indicates the number of events to consume before outputting anamolies. Default is 32.") - @JsonProperty("output_after") + @JsonPropertyDescription("Output after indicates the number of events to consume before outputting anomalies. Default is 32.") + @JsonProperty(value = "output_after", defaultValue = "" + DEFAULT_OUTPUT_AFTER) private int outputAfter = DEFAULT_OUTPUT_AFTER; @AssertTrue(message = "Value of output_after must be less than or equal to the value of sample_size") diff --git a/data-prepper-plugins/aws-lambda/src/main/java/org/opensearch/dataprepper/plugins/lambda/processor/LambdaProcessorConfig.java b/data-prepper-plugins/aws-lambda/src/main/java/org/opensearch/dataprepper/plugins/lambda/processor/LambdaProcessorConfig.java index cfa7417896..c9675ed931 100644 --- a/data-prepper-plugins/aws-lambda/src/main/java/org/opensearch/dataprepper/plugins/lambda/processor/LambdaProcessorConfig.java +++ b/data-prepper-plugins/aws-lambda/src/main/java/org/opensearch/dataprepper/plugins/lambda/processor/LambdaProcessorConfig.java @@ -17,7 +17,7 @@ import org.opensearch.dataprepper.plugins.lambda.common.config.LambdaCommonConfig; @JsonPropertyOrder -@JsonClassDescription("The aws_lambda processor enables invocation of an AWS Lambda function within your Data Prepper pipeline in order to process events." + +@JsonClassDescription("The aws_lambda processor enables invocation of an AWS Lambda function within your Data Prepper pipeline in order to process events." + "It supports both synchronous and asynchronous invocations based on your use case.") public class LambdaProcessorConfig extends LambdaCommonConfig { static final String DEFAULT_INVOCATION_TYPE = "request-response"; diff --git a/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java b/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java index f813a8fa1f..2e3114d979 100644 --- a/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java +++ b/data-prepper-plugins/date-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/date/DateProcessorConfig.java @@ -142,7 +142,7 @@ public static boolean isValidPattern(final String pattern) { }) private List match; - @JsonProperty("destination") + @JsonProperty(value = "destination", defaultValue = DEFAULT_DESTINATION) @JsonPropertyDescription("The field used to store the timestamp parsed by the date processor. " + "Can be used with both match and from_time_received. Default is @timestamp.") private String destination = DEFAULT_DESTINATION; diff --git a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java index c7ec7683ef..e44c1da74e 100644 --- a/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java +++ b/data-prepper-plugins/mutate-event-processors/src/main/java/org/opensearch/dataprepper/plugins/processor/mutateevent/CopyValueProcessorConfig.java @@ -30,13 +30,15 @@ public static class Entry { @NotEmpty @NotNull @JsonProperty("from_key") - @JsonPropertyDescription("The key of the entry to be copied.") + @JsonPropertyDescription("The key of the entry to be copied. Either from_key and " + + "to_key or from_list and to_list must be defined.") private String fromKey; @NotEmpty @NotNull @JsonProperty("to_key") - @JsonPropertyDescription("The key of the new entry to be added.") + @JsonPropertyDescription("The key of the new entry to be added. Either from_key and " + + "to_key or from_list and to_list must be defined.") private String toKey; @JsonProperty("overwrite_if_to_key_exists") @@ -86,14 +88,16 @@ public Entry() { private List entries; @JsonProperty(FROM_LIST_KEY) - @JsonPropertyDescription("The key of the list of objects to be copied. to_list must also be defined.") + @JsonPropertyDescription("The key of the list of objects to be copied. Either from_key and " + + "to_key or from_list and to_list must be defined.") @AlsoRequired(values = { @AlsoRequired.Required(name = TO_LIST_KEY) }) private String fromList; @JsonProperty(TO_LIST_KEY) - @JsonPropertyDescription("The key of the new list to be added. from_list must also be defined.") + @JsonPropertyDescription("The key of the new list to be added. Either from_key and " + + "to_key or from_list and to_list must be defined.") @AlsoRequired(values = { @AlsoRequired.Required(name = FROM_LIST_KEY) }) diff --git a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java index c8a5ef4e07..fa0ddf355c 100644 --- a/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java +++ b/data-prepper-plugins/obfuscate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/obfuscation/ObfuscationProcessorConfig.java @@ -22,7 +22,7 @@ import java.util.List; @JsonPropertyOrder -@JsonClassDescription("The obfuscate process enables obfuscation of fields inside your documents in order to " + +@JsonClassDescription("The obfuscate processor enables obfuscation of fields inside your documents in order to " + "protect sensitive data.") public class ObfuscationProcessorConfig {