You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by br...@apache.org on 2012/09/11 00:46:19 UTC
git commit: FLUME-1556: It would be nice if NullSink logged the
number of event processed every 10K or so
Updated Branches:
refs/heads/trunk 04c2de495 -> 3875a4b92
FLUME-1556: It would be nice if NullSink logged the number of event processed every 10K or so
(Ted Malaska via Brock Noland)
Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/3875a4b9
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/3875a4b9
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/3875a4b9
Branch: refs/heads/trunk
Commit: 3875a4b92178ee6407003c206a94713908ebeb41
Parents: 04c2de4
Author: Brock Noland <br...@apache.org>
Authored: Mon Sep 10 17:45:28 2012 -0500
Committer: Brock Noland <br...@apache.org>
Committed: Mon Sep 10 17:45:28 2012 -0500
----------------------------------------------------------------------
.../main/java/org/apache/flume/sink/NullSink.java | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flume/blob/3875a4b9/flume-ng-core/src/main/java/org/apache/flume/sink/NullSink.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/sink/NullSink.java b/flume-ng-core/src/main/java/org/apache/flume/sink/NullSink.java
index 5cc1521..cada6ec 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/sink/NullSink.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/sink/NullSink.java
@@ -52,9 +52,11 @@ public class NullSink extends AbstractSink implements Configurable {
private static final Logger logger = LoggerFactory.getLogger(NullSink.class);
private static final int DFLT_BATCH_SIZE = 100;
+ private static final int DFLT_LOG_EVERY_N_EVENTS = 10000;
private CounterGroup counterGroup;
private int batchSize = DFLT_BATCH_SIZE;
+ private int logEveryNEvents = DFLT_LOG_EVERY_N_EVENTS;
public NullSink() {
counterGroup = new CounterGroup();
@@ -66,6 +68,11 @@ public class NullSink extends AbstractSink implements Configurable {
logger.debug(this.getName() + " " +
"batch size set to " + String.valueOf(batchSize));
Preconditions.checkArgument(batchSize > 0, "Batch size must be > 0");
+
+ logEveryNEvents = context.getInteger("logEveryNEvents", DFLT_LOG_EVERY_N_EVENTS);
+ logger.debug(this.getName() + " " +
+ "log event N events set to " + logEveryNEvents);
+ Preconditions.checkArgument(logEveryNEvents > 0, "logEveryNEvents must be > 0");
}
@Override
@@ -75,12 +82,16 @@ public class NullSink extends AbstractSink implements Configurable {
Channel channel = getChannel();
Transaction transaction = channel.getTransaction();
Event event = null;
+ long eventCounter = counterGroup.get("events.success");
try {
transaction.begin();
int i = 0;
for (i = 0; i < batchSize; i++) {
event = channel.take();
+ if (++eventCounter % logEveryNEvents == 0) {
+ logger.info("Null sink {} successful processed {} events.", getName(), eventCounter);
+ }
if(event == null) {
status = Status.BACKOFF;
break;