deemoliu commented on code in PR #14366:
URL: https://github.com/apache/pinot/pull/14366#discussion_r1842875147


##########
pinot-plugins/pinot-input-format/pinot-clp-log/src/main/java/org/apache/pinot/plugin/inputformat/clplog/CLPLogMessageDecoder.java:
##########
@@ -38,18 +38,27 @@
  * details. The implementation is based on {@link 
org.apache.pinot.plugin.inputformat.json.JSONMessageDecoder}.
  */
 public class CLPLogMessageDecoder implements StreamMessageDecoder<byte[]> {
+  public static final String ERROR_SAMPLING_PERIOD_CONFIG_KEY = 
"errorSamplingPeriod";
   private static final Logger LOGGER = 
LoggerFactory.getLogger(CLPLogMessageDecoder.class);
+  private static final int DEFAULT_ERROR_SAMPLING_PERIOD = 10000;
 
   private RecordExtractor<Map<String, Object>> _recordExtractor;
+  // Period at which errors should be sampled for printing:
+  // * 0            - Don't print errors
+  // * n > 0        - Print one error every n errors
+  private int _errorSamplingPeriod = DEFAULT_ERROR_SAMPLING_PERIOD;
+  private int _numErrorsUntilNextPrint = 0;
 
   @Override
   public void init(Map<String, String> props, Set<String> fieldsToRead, String 
topicName)
       throws Exception {
     String recordExtractorClass = null;
     String recordExtractorConfigClass = null;
+    String errorSamplingPeriodString = null;
     if (null != props) {
       recordExtractorClass = props.get(RECORD_EXTRACTOR_CONFIG_KEY);
       recordExtractorConfigClass = 
props.get(RECORD_EXTRACTOR_CONFIG_CONFIG_KEY);
+      errorSamplingPeriodString = props.get(ERROR_SAMPLING_PERIOD_CONFIG_KEY);

Review Comment:
   can you please provide an example of the props.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to