-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/chiwanpark/flume/plugins/RedisSinkCounter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.chiwanpark.flume.plugins; | ||
|
||
import org.apache.flume.instrumentation.SinkCounter; | ||
|
||
public class RedisSinkCounter extends SinkCounter implements RedisSinkCounterMBean { | ||
private static final String COUNTER_REDIS_SINK_SEND_TIME_MICROS = "redis.sink.sendTimeMicros"; | ||
private static final String COUNTER_REDIS_SINK_ROLLBACK = "redis.sink.rollback"; | ||
private static final String COUNTER_REDIS_SINK_SUCCESS = "redis.sink.success"; | ||
|
||
private static final String[] ATTRIBUTES = new String[] { | ||
COUNTER_REDIS_SINK_SEND_TIME_MICROS, | ||
COUNTER_REDIS_SINK_ROLLBACK, | ||
COUNTER_REDIS_SINK_SUCCESS | ||
}; | ||
|
||
public RedisSinkCounter(String name) { | ||
super(name, ATTRIBUTES); | ||
} | ||
|
||
public void incrementSinkSendTimeMicros(long delta) { | ||
this.addAndGet(COUNTER_REDIS_SINK_SEND_TIME_MICROS, delta); | ||
} | ||
|
||
public long getSinkSendTimeMicros() { | ||
return this.get(COUNTER_REDIS_SINK_SEND_TIME_MICROS); | ||
} | ||
|
||
public void incrementSinkRollback() { | ||
this.increment(COUNTER_REDIS_SINK_ROLLBACK); | ||
} | ||
|
||
public long getSinkRollback() { | ||
return this.get(COUNTER_REDIS_SINK_ROLLBACK); | ||
} | ||
|
||
public void incrementSinkSuccess() { | ||
this.increment(COUNTER_REDIS_SINK_SUCCESS); | ||
} | ||
|
||
public long getSinkSuccess() { | ||
return this.get(COUNTER_REDIS_SINK_SUCCESS); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/chiwanpark/flume/plugins/RedisSinkCounterMBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.chiwanpark.flume.plugins; | ||
|
||
public interface RedisSinkCounterMBean { | ||
public long getSinkSendTimeMicros(); | ||
public long getSinkRollback(); | ||
public long getSinkSuccess(); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/chiwanpark/flume/plugins/RedisSourceCounter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.chiwanpark.flume.plugins; | ||
|
||
import org.apache.flume.instrumentation.SourceCounter; | ||
import org.apache.flume.instrumentation.SourceCounterMBean; | ||
|
||
public class RedisSourceCounter extends SourceCounter implements SourceCounterMBean { | ||
private static final String COUNTER_REDIS_SOURCE_SENT = "redis.source.sent"; | ||
private static final String COUNTER_REDIS_SOURCE_RETRY = "redis.source.retry"; | ||
private static final String COUNTER_REDIS_SOURCE_ERROR = "redis.source.error"; | ||
private static final String[] ATTRIBUTES = new String[] { | ||
COUNTER_REDIS_SOURCE_SENT, | ||
COUNTER_REDIS_SOURCE_RETRY, | ||
COUNTER_REDIS_SOURCE_ERROR | ||
}; | ||
|
||
public RedisSourceCounter(String name) { | ||
super(name, ATTRIBUTES); | ||
} | ||
|
||
public void incrementSourceSent() { | ||
this.increment(COUNTER_REDIS_SOURCE_SENT); | ||
} | ||
|
||
public long getSourceSent() { | ||
return this.get(COUNTER_REDIS_SOURCE_SENT); | ||
} | ||
|
||
public void incrementSourceRetry() { | ||
this.increment(COUNTER_REDIS_SOURCE_RETRY); | ||
} | ||
|
||
public long getSourceRetry() { | ||
return this.get(COUNTER_REDIS_SOURCE_RETRY); | ||
} | ||
|
||
public void incrementSourceError() { | ||
this.increment(COUNTER_REDIS_SOURCE_ERROR); | ||
} | ||
|
||
public long getSourceError() { | ||
return this.get(COUNTER_REDIS_SOURCE_ERROR); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/chiwanpark/flume/plugins/RedisSourceCounterMBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.chiwanpark.flume.plugins; | ||
|
||
public interface RedisSourceCounterMBean { | ||
public long getSourceSent(); | ||
public long getSourceRetry(); | ||
public long getSourceError(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters