From 9074a220af8647d325de616ea973fce56f279e67 Mon Sep 17 00:00:00 2001 From: Hai Yan <8153134+oeyh@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:51:20 -0500 Subject: [PATCH] Update Prepper plugins to use Processor (#1686) * Update prepper to processor for StringPrepper * Update prepper to processor for GrokPrepper * Update prepper to processor for OTelTraceGroupPrepper * Update prepper to processor for OTelTraceRawPrepper * Update prepper to processor for NoOpPrepper * Update prepper to processor in readme files Signed-off-by: Hai Yan --- .../amazon/dataprepper/plugins/prepper/NoOpPrepper.java | 3 +-- .../amazon/dataprepper/plugins/prepper/StringPrepper.java | 8 ++++---- .../dataprepper/plugins/prepper/grok/GrokPrepper.java | 8 ++++---- .../prepper/oteltracegroup/OTelTraceGroupPrepper.java | 8 ++++---- data-prepper-plugins/otel-trace-raw-prepper/README.md | 2 +- .../plugins/prepper/oteltrace/OTelTraceRawPrepper.java | 8 ++++---- data-prepper-plugins/service-map-stateful/README.md | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/NoOpPrepper.java b/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/NoOpPrepper.java index 86fbbd31da..40320df981 100644 --- a/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/NoOpPrepper.java +++ b/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/NoOpPrepper.java @@ -7,13 +7,12 @@ import com.amazon.dataprepper.model.annotations.DataPrepperPlugin; import com.amazon.dataprepper.model.event.Event; -import com.amazon.dataprepper.model.prepper.Prepper; import com.amazon.dataprepper.model.processor.Processor; import com.amazon.dataprepper.model.record.Record; import java.util.Collection; -@DataPrepperPlugin(name = "no-op", pluginType = Prepper.class) +@DataPrepperPlugin(name = "no-op", pluginType = Processor.class) public class NoOpPrepper implements Processor, Record> { public NoOpPrepper() { diff --git a/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/StringPrepper.java b/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/StringPrepper.java index 716001c7d7..13f7fd7915 100644 --- a/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/StringPrepper.java +++ b/data-prepper-plugins/common/src/main/java/com/amazon/dataprepper/plugins/prepper/StringPrepper.java @@ -10,7 +10,7 @@ import com.amazon.dataprepper.model.configuration.PluginSetting; import com.amazon.dataprepper.model.event.Event; import com.amazon.dataprepper.model.event.JacksonEvent; -import com.amazon.dataprepper.model.prepper.Prepper; +import com.amazon.dataprepper.model.processor.Processor; import com.amazon.dataprepper.model.record.Record; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -24,11 +24,11 @@ import java.util.stream.Collectors; /** - * An simple String implementation of {@link Prepper} which generates new Records with upper case or lowercase content. The current + * A simple String implementation of {@link Processor} which generates new Records with uppercase or lowercase content. The current * simpler implementation does not handle errors (if any). */ -@DataPrepperPlugin(name = "string_converter", pluginType = Prepper.class, pluginConfigurationType = StringPrepper.Configuration.class) -public class StringPrepper implements Prepper, Record> { +@DataPrepperPlugin(name = "string_converter", pluginType = Processor.class, pluginConfigurationType = StringPrepper.Configuration.class) +public class StringPrepper implements Processor, Record> { private static Logger LOG = LoggerFactory.getLogger(StringPrepper.class); private final ObjectMapper objectMapper = new ObjectMapper(); private final TypeReference> mapTypeReference = new TypeReference>() {}; diff --git a/data-prepper-plugins/grok-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/grok/GrokPrepper.java b/data-prepper-plugins/grok-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/grok/GrokPrepper.java index a807e4efeb..c5b5252c3d 100644 --- a/data-prepper-plugins/grok-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/grok/GrokPrepper.java +++ b/data-prepper-plugins/grok-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/grok/GrokPrepper.java @@ -10,8 +10,8 @@ import com.amazon.dataprepper.model.annotations.SingleThread; import com.amazon.dataprepper.model.configuration.PluginSetting; import com.amazon.dataprepper.model.event.Event; -import com.amazon.dataprepper.model.prepper.AbstractPrepper; -import com.amazon.dataprepper.model.prepper.Prepper; +import com.amazon.dataprepper.model.processor.AbstractProcessor; +import com.amazon.dataprepper.model.processor.Processor; import com.amazon.dataprepper.model.record.Record; import io.micrometer.core.instrument.Counter; import io.micrometer.core.instrument.Timer; @@ -52,8 +52,8 @@ @SingleThread -@DataPrepperPlugin(name = "grok", pluginType = Prepper.class) -public class GrokPrepper extends AbstractPrepper, Record> { +@DataPrepperPlugin(name = "grok", pluginType = Processor.class) +public class GrokPrepper extends AbstractProcessor, Record> { private static final Logger LOG = LoggerFactory.getLogger(GrokPrepper.class); diff --git a/data-prepper-plugins/otel-trace-group-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltracegroup/OTelTraceGroupPrepper.java b/data-prepper-plugins/otel-trace-group-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltracegroup/OTelTraceGroupPrepper.java index 84d6dffa3f..21df3b6760 100644 --- a/data-prepper-plugins/otel-trace-group-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltracegroup/OTelTraceGroupPrepper.java +++ b/data-prepper-plugins/otel-trace-group-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltracegroup/OTelTraceGroupPrepper.java @@ -7,8 +7,8 @@ import com.amazon.dataprepper.model.annotations.DataPrepperPlugin; import com.amazon.dataprepper.model.configuration.PluginSetting; -import com.amazon.dataprepper.model.prepper.AbstractPrepper; -import com.amazon.dataprepper.model.prepper.Prepper; +import com.amazon.dataprepper.model.processor.AbstractProcessor; +import com.amazon.dataprepper.model.processor.Processor; import com.amazon.dataprepper.model.record.Record; import com.amazon.dataprepper.plugins.prepper.oteltracegroup.model.TraceGroup; import com.fasterxml.jackson.core.JsonProcessingException; @@ -42,8 +42,8 @@ import java.util.Set; import java.util.stream.Stream; -@DataPrepperPlugin(name = "otel_trace_group_prepper", pluginType = Prepper.class) -public class OTelTraceGroupPrepper extends AbstractPrepper, Record> { +@DataPrepperPlugin(name = "otel_trace_group_prepper", pluginType = Processor.class) +public class OTelTraceGroupPrepper extends AbstractProcessor, Record> { public static final String RECORDS_IN_MISSING_TRACE_GROUP = "recordsInMissingTraceGroup"; public static final String RECORDS_OUT_FIXED_TRACE_GROUP = "recordsOutFixedTraceGroup"; diff --git a/data-prepper-plugins/otel-trace-raw-prepper/README.md b/data-prepper-plugins/otel-trace-raw-prepper/README.md index cc3abb0650..b962f0c5b3 100644 --- a/data-prepper-plugins/otel-trace-raw-prepper/README.md +++ b/data-prepper-plugins/otel-trace-raw-prepper/README.md @@ -14,7 +14,7 @@ prepper: * `trace_flush_interval`: An `int` represents the time interval in seconds to flush all the descendant spans without any root span. Default to 180. ## Metrics -Apart from common metrics in [AbstractPrepper](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-api/src/main/java/com/amazon/dataprepper/model/prepper/AbstractPrepper.java), otel-trace-raw-prepper introduces the following custom metrics. +Apart from common metrics in [AbstractProcessor](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-api/src/main/java/com/amazon/dataprepper/model/processor/AbstractProcessor.java), otel-trace-raw-prepper introduces the following custom metrics. ### Counter - `spanProcessingErrors`: records the number of processing exceptions for invalid spans. diff --git a/data-prepper-plugins/otel-trace-raw-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltrace/OTelTraceRawPrepper.java b/data-prepper-plugins/otel-trace-raw-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltrace/OTelTraceRawPrepper.java index 9dd1e7130b..f788af5b58 100644 --- a/data-prepper-plugins/otel-trace-raw-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltrace/OTelTraceRawPrepper.java +++ b/data-prepper-plugins/otel-trace-raw-prepper/src/main/java/com/amazon/dataprepper/plugins/prepper/oteltrace/OTelTraceRawPrepper.java @@ -7,8 +7,8 @@ import com.amazon.dataprepper.model.annotations.DataPrepperPlugin; import com.amazon.dataprepper.model.configuration.PluginSetting; -import com.amazon.dataprepper.model.prepper.AbstractPrepper; -import com.amazon.dataprepper.model.prepper.Prepper; +import com.amazon.dataprepper.model.processor.AbstractProcessor; +import com.amazon.dataprepper.model.processor.Processor; import com.amazon.dataprepper.model.record.Record; import com.amazon.dataprepper.plugins.prepper.oteltrace.model.OTelProtoHelper; import com.amazon.dataprepper.plugins.prepper.oteltrace.model.RawSpan; @@ -39,8 +39,8 @@ import java.util.concurrent.locks.ReentrantLock; -@DataPrepperPlugin(name = "otel_trace_raw_prepper", pluginType = Prepper.class) -public class OTelTraceRawPrepper extends AbstractPrepper, Record> { +@DataPrepperPlugin(name = "otel_trace_raw_prepper", pluginType = Processor.class) +public class OTelTraceRawPrepper extends AbstractProcessor, Record> { private static final long SEC_TO_MILLIS = 1_000L; private static final Logger LOG = LoggerFactory.getLogger(OTelTraceRawPrepper.class); diff --git a/data-prepper-plugins/service-map-stateful/README.md b/data-prepper-plugins/service-map-stateful/README.md index 970791386e..44e84de079 100644 --- a/data-prepper-plugins/service-map-stateful/README.md +++ b/data-prepper-plugins/service-map-stateful/README.md @@ -14,7 +14,7 @@ processor: * window_duration(Optional) => An `int` represents the fixed time window in seconds to evaluate service-map relationships. Default is ```180```. ## Metrics -Besides common metrics in [AbstractPrepper](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-api/src/main/java/com/amazon/dataprepper/model/prepper/AbstractPrepper.java), service-map-stateful prepper introduces the following custom metrics. +Besides common metrics in [AbstractProcessor](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-api/src/main/java/com/amazon/dataprepper/model/processor/AbstractProcessor.java), service-map-stateful prepper introduces the following custom metrics. ### Gauge - `spansDbSize`: measures total spans byte sizes in MapDB across the current and previous window durations.