Details
diff --git a/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java b/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
index e36040e..755cd57 100644
--- a/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
+++ b/azkaban-common/src/main/java/azkaban/metric/AbstractMetric.java
@@ -77,7 +77,7 @@ public abstract class AbstractMetric<T> implements IMetric<T> {
/**
* Method used to notify manager for a tracking event.
* Metric is free to call this method as per implementation.
- * Timer based or Azkaban events can be the most common implementation
+ * Timer based or Azkaban events are the most common implementation
* {@inheritDoc}
* @see azkaban.metric.IMetric#notifyManager()
*/
diff --git a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
index 39d18a1..b8f1f6e 100644
--- a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
+++ b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryNode.java
@@ -29,7 +29,7 @@ public class InMemoryHistoryNode {
* Takes snapshot of the metric with a given value
* @param val
*/
- public InMemoryHistoryNode(Object val) {
+ public InMemoryHistoryNode(final Object val) {
value = val;
date = new Date();
}
diff --git a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryStatistics.java b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryStatistics.java
index 72061b4..0af99f7 100644
--- a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryStatistics.java
+++ b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryHistoryStatistics.java
@@ -28,7 +28,7 @@ public final class InMemoryHistoryStatistics {
* @param data
* @return mean of data
*/
- public static double mean(List<InMemoryHistoryNode> data) {
+ public static double mean(final List<InMemoryHistoryNode> data) {
double total = 0.0;
for (InMemoryHistoryNode node : data) {
total = total + ((Number)node.getValue()).doubleValue() ;
@@ -41,7 +41,7 @@ public final class InMemoryHistoryStatistics {
* @param data
* @return standard deviation of data
*/
- public static double sdev(List<InMemoryHistoryNode> data) {
+ public static double sdev(final List<InMemoryHistoryNode> data) {
return Math.sqrt(variance(data));
}
@@ -51,7 +51,7 @@ public final class InMemoryHistoryStatistics {
* @param data
* @return variance of data
*/
- public static double variance(List<InMemoryHistoryNode> data) {
+ public static double variance(final List<InMemoryHistoryNode> data) {
double mu = mean(data);
double sumsq = 0.0;
for (InMemoryHistoryNode node : data) {
@@ -65,7 +65,7 @@ public final class InMemoryHistoryStatistics {
* @param x
* @return x*x
*/
- public static double sqr(double x) {
+ public static double sqr(final double x) {
return x * x;
}
}
diff --git a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
index e2a91fe..066d3a5 100644
--- a/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
+++ b/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java
@@ -30,6 +30,7 @@ import azkaban.metric.IMetric;
import azkaban.metric.IMetricEmitter;
import azkaban.utils.Props;
+
/**
* Metric Emitter which maintains in memory snapshots of the metrics
* This is also the default metric emitter and used by /stats servlet
@@ -84,7 +85,7 @@ public class InMemoryMetricEmitter implements IMetricEmitter {
* @see azkaban.metric.IMetricEmitter#reportMetric(azkaban.metric.IMetric)
*/
@Override
- public void reportMetric(IMetric<?> metric) throws Exception {
+ public void reportMetric(final IMetric<?> metric) throws Exception {
String metricName = metric.getName();
if (!historyListMapping.containsKey(metricName)) {
logger.info("First time capturing metric: " + metricName);
@@ -105,7 +106,8 @@ public class InMemoryMetricEmitter implements IMetricEmitter {
* @param useStats get statistically significant points only
* @return List of snapshots
*/
- public List<InMemoryHistoryNode> getDrawMetric(String metricName, Date from, Date to, Boolean useStats) {
+ public List<InMemoryHistoryNode> getDrawMetric(final String metricName, final Date from, final Date to,
+ final Boolean useStats) {
LinkedList<InMemoryHistoryNode> selectedLists = new LinkedList<InMemoryHistoryNode>();
if (historyListMapping.containsKey(metricName)) {
@@ -136,27 +138,27 @@ public class InMemoryMetricEmitter implements IMetricEmitter {
* filter snapshots using statistically significant points only
* @param selectedLists list of snapshots
*/
- private void statBasedSelectMetricHistory(LinkedList<InMemoryHistoryNode> selectedLists) {
+ private void statBasedSelectMetricHistory(final LinkedList<InMemoryHistoryNode> selectedLists) {
logger.debug("selecting snapshots which are far away from mean value");
Iterator<InMemoryHistoryNode> ite = selectedLists.iterator();
- Double mean = InMemoryHistoryStatistics.mean(selectedLists);
- Double std = InMemoryHistoryStatistics.sdev(selectedLists);
-
- while (ite.hasNext()) {
- InMemoryHistoryNode currentNode = ite.next();
- double value = ((Number)currentNode.getValue()).doubleValue() ;
- // remove all elements which lies in 95% value band
- if (value > mean + 2*std && value < mean + 2*std) {
- ite.remove();
- }
+ Double mean = InMemoryHistoryStatistics.mean(selectedLists);
+ Double std = InMemoryHistoryStatistics.sdev(selectedLists);
+
+ while (ite.hasNext()) {
+ InMemoryHistoryNode currentNode = ite.next();
+ double value = ((Number) currentNode.getValue()).doubleValue();
+ // remove all elements which lies in 95% value band
+ if (value > mean + 2 * std && value < mean + 2 * std) {
+ ite.remove();
}
+ }
}
/**
* filter snapshots by evenly selecting points across the interval
* @param selectedLists list of snapshots
*/
- private void generalSelectMetricHistory(LinkedList<InMemoryHistoryNode> selectedLists) {
+ private void generalSelectMetricHistory(final LinkedList<InMemoryHistoryNode> selectedLists) {
logger.debug("selecting snapshots evenly from across the time interval");
if (selectedLists.size() > numInstances) {
double step = (double) selectedLists.size() / numInstances;
@@ -180,7 +182,7 @@ public class InMemoryMetricEmitter implements IMetricEmitter {
* @param metricName Name of the metric
* @param firstAllowedDate End date of the interval
*/
- private void cleanUsingTime(String metricName, Date firstAllowedDate) {
+ private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
if (historyListMapping.containsKey(metricName) && historyListMapping.get(metricName) != null) {
synchronized (historyListMapping.get(metricName)) {
diff --git a/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java b/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
index bebb36d..e58023e 100644
--- a/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
+++ b/azkaban-common/src/main/java/azkaban/metric/TimeBasedReportingMetric.java
@@ -59,7 +59,7 @@ public abstract class TimeBasedReportingMetric<T> extends AbstractMetric<T> {
* Method to change tracking interval
* @param interval
*/
- public void updateInterval(long interval) {
+ public void updateInterval(final long interval) {
logger.debug(String.format("Updating tracking interval to %d milisecond for %s metric", interval, getName()));
timer.cancel();
timer = new Timer();