This repository was archived by the owner on Jan 8, 2020. It is now read-only.
File tree 1 file changed +8
-4
lines changed
src/main/java/org/keedio/flume/metrics
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 12
12
*/
13
13
package org .keedio .flume .metrics ;
14
14
15
+ import java .util .concurrent .TimeUnit ;
16
+
15
17
import org .apache .flume .instrumentation .MonitoredCounterGroup ;
16
18
17
19
/**
@@ -66,16 +68,18 @@ public void startProcess(){
66
68
67
69
public void endProcess (int events ){
68
70
69
- long runningTime = System .currentTimeMillis () - getStartTime ();
70
- long processTime = System .currentTimeMillis () - startProcessTime ;
71
+ long runningTime = TimeUnit . MILLISECONDS . toSeconds ( System .currentTimeMillis () - getStartTime () );
72
+ long processTime = TimeUnit . MILLISECONDS . toSeconds ( System .currentTimeMillis () - startProcessTime ) ;
71
73
long throughput = 0L ;
72
74
73
75
if (events > 0 && processTime > 0 )
74
- throughput = 1000 * events /processTime ;
76
+ throughput = events /processTime ;
75
77
if (getMaxThroughput () < throughput )
76
78
set (MAX_THROUGHPUT ,throughput );
77
79
78
- set (AVERAGE_THROUGHPUT , getEventCount ()/(runningTime /1000 ));
80
+ if (runningTime > 0 && getEventCount () > 0 )
81
+ set (AVERAGE_THROUGHPUT , (getEventCount ()/runningTime ));
82
+
79
83
set (CURRENT_THROUGHPUT ,throughput );
80
84
}
81
85
}
You can’t perform that action at this time.
0 commit comments