From e7138ac8f6378362d44ae8c0b67a75dc97cb3964 Mon Sep 17 00:00:00 2001 From: Katherine Shen <40495707+shenkw1@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:47:18 -0600 Subject: [PATCH] Schema revisions (#5260) * fix schemas Signed-off-by: Katherine Shen --- .../aggregate/AggregateProcessorConfig.java | 2 +- .../processor/LambdaProcessorConfig.java | 27 +++++++++++++------ .../keyvalue/KeyValueProcessorConfig.java | 4 +-- .../otelmetrics/OTelMetricsSourceTest.java | 1 - 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java index bd08de94c6..e1522b23ed 100644 --- a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java +++ b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorConfig.java @@ -31,7 +31,7 @@ public class AggregateProcessorConfig { @JsonPropertyDescription("An unordered list by which to group events. Events with the same values as these keys are put into the same group. " + "If an event does not contain one of the identification_keys, then the value of that key is considered to be equal to null. " + - "At least one identification_key is required. And example configuration is [\"sourceIp\", \"destinationIp\", \"port\"].") + "At least one identification_key is required. An example configuration is [\"sourceIp\", \"destinationIp\", \"port\"].") @JsonProperty("identification_keys") @NotEmpty @ExampleValues({ 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 5d7e05d7c0..cfa7417896 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 @@ -7,33 +7,44 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; +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 java.util.Collections; import java.util.List; import org.opensearch.dataprepper.plugins.lambda.common.config.InvocationType; 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." + + "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"; - @JsonPropertyDescription("invocation type defines the way we want to call lambda function") - @JsonProperty("invocation_type") + @JsonPropertyDescription("Specifies the invocation type, either request-response or event. Default is request-response.") + @JsonProperty(value = "invocation_type", defaultValue = DEFAULT_INVOCATION_TYPE) private InvocationType invocationType = InvocationType.REQUEST_RESPONSE; - @JsonPropertyDescription("Defines the way Data Prepper treats the response from Lambda") + @JsonPropertyDescription("Specifies how Data Prepper interprets and processes Lambda function responses. Default is false.") @JsonProperty("response_events_match") private boolean responseEventsMatch = false; - @JsonPropertyDescription("defines a condition for event to use this processor") - @JsonProperty("lambda_when") - private String whenCondition; - @JsonProperty("tags_on_failure") @JsonPropertyDescription( "A List of Strings that specifies the tags to be set in the event when lambda fails to " + "or exception occurs. This tag may be used in conditional expressions in " + - "other parts of the configuration") + "other parts of the configuration.") private List tagsOnFailure = Collections.emptyList(); + @JsonPropertyDescription("Defines a condition for event to use this processor.") + @ExampleValues({ + @Example(value = "event['status'] == 'process'", description = "The processor will only run on this condition.") + }) + @JsonProperty("lambda_when") + private String whenCondition; + public List getTagsOnFailure() { return tagsOnFailure; } diff --git a/data-prepper-plugins/key-value-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/keyvalue/KeyValueProcessorConfig.java b/data-prepper-plugins/key-value-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/keyvalue/KeyValueProcessorConfig.java index 9c8edc7db3..501dbb9d54 100644 --- a/data-prepper-plugins/key-value-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/keyvalue/KeyValueProcessorConfig.java +++ b/data-prepper-plugins/key-value-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/keyvalue/KeyValueProcessorConfig.java @@ -124,13 +124,13 @@ public class KeyValueProcessorConfig { }) private Object nonMatchValue = DEFAULT_NON_MATCH_VALUE; - @JsonProperty(value = "include_keys", defaultValue = "[]") + @JsonProperty("include_keys") @JsonPropertyDescription("An array specifying the keys that should be included in the destination field. " + "By default, all keys will be added.") @NotNull private List includeKeys = DEFAULT_INCLUDE_KEYS; - @JsonProperty(value = "exclude_keys", defaultValue = "[]") + @JsonProperty("exclude_keys") @JsonPropertyDescription("An array specifying the parsed keys that should be excluded from the destination field. " + "By default, no keys will be excluded.") @NotNull diff --git a/data-prepper-plugins/otel-metrics-source/src/test/java/org/opensearch/dataprepper/plugins/source/otelmetrics/OTelMetricsSourceTest.java b/data-prepper-plugins/otel-metrics-source/src/test/java/org/opensearch/dataprepper/plugins/source/otelmetrics/OTelMetricsSourceTest.java index f3342a612e..4e67c050f5 100644 --- a/data-prepper-plugins/otel-metrics-source/src/test/java/org/opensearch/dataprepper/plugins/source/otelmetrics/OTelMetricsSourceTest.java +++ b/data-prepper-plugins/otel-metrics-source/src/test/java/org/opensearch/dataprepper/plugins/source/otelmetrics/OTelMetricsSourceTest.java @@ -36,7 +36,6 @@ import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; import io.opentelemetry.proto.collector.metrics.v1.MetricsServiceGrpc; -import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc; import io.opentelemetry.proto.metrics.v1.NumberDataPoint; import io.opentelemetry.proto.common.v1.InstrumentationLibrary;