Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
SuccessRateFailsAggregatorProvider.java
Go to the documentation of this file.
1 package com.griddynamics.jagger.engine.e1.collector;
2 
3 import static com.griddynamics.jagger.util.StandardMetricsNamesUtil.SUCCESS_RATE_AGGREGATOR_FAILED_ID;
4 
14 public class SuccessRateFailsAggregatorProvider implements MetricAggregatorProvider {
15 
17  @Override
19  return new SuccessRateFailsAggregator();
20  }
21 
22  private static class SuccessRateFailsAggregator implements MetricAggregator<Number>
23  {
24  long failNum = 0;
25 
26  @Override
27  public void append(Number calculated)
28  {
29  if (calculated.intValue() == 0)
30  failNum++;
31  }
32 
33  @Override
34  public Double getAggregated() {
35  return new Double(failNum);
36  }
37 
38  @Override
39  public void reset() {
40  }
41 
42  @Override
43  public String getName() {
44  return SUCCESS_RATE_AGGREGATOR_FAILED_ID;
45  }
46  }
47 }