Skip to content

Commit

Permalink
Update value name of apdex metric
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahmily committed Nov 28, 2019
1 parent 506f3dd commit c14aaa4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* contributes to poor customer experiences in your app. For example:
*
* 10000: All responses are satisfactory.
* Tolerating responses half satisfy a user. For example, if all responses are Tolerating, then the Apdex score will
* Tolerating responses half satisfy a user. For example, if all responses are Tolerating, then the Apdex value will
* be 5000.
* 0: None of the responses are satisfactory.
*
Expand All @@ -48,12 +48,12 @@ public abstract class ApdexMetrics extends Metrics implements IntValueHolder {
protected static final String S_NUM = "s_num";
// Level: tolerated
protected static final String T_NUM = "t_num";
protected static final String SCORE = "score";
protected static final String VALUE = "value";

@Getter @Setter @Column(columnName = TOTAL_NUM) private int totalNum;
@Getter @Setter @Column(columnName = S_NUM) private int sNum;
@Getter @Setter @Column(columnName = T_NUM) private int tNum;
@Getter @Setter @Column(columnName = SCORE, isValue = true, function = Function.Avg) private int score;
@Getter @Setter @Column(columnName = VALUE, isValue = true, function = Function.Avg) private int value;

@Entrance
public final void combine(@SourceFrom int value, @Arg String name, @Arg boolean status) {
Expand All @@ -77,10 +77,10 @@ public final void combine(@SourceFrom int value, @Arg String name, @Arg boolean
}

@Override public void calculate() {
score = (sNum + tNum / 2) * 10000 / totalNum;
value = (sNum + tNum / 2) * 10000 / totalNum;
}

@Override public int getValue() {
return score;
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@ public void testEntrance() {
apdex.combine(200, "foo", true);
apdex.combine(300, "bar", true);
apdex.calculate();
assertThat(apdex.getScore(), is(10000));
assertThat(apdex.getValue(), is(10000));

apdex = new ApdexMetricsImpl();
apdex.combine(200, "foo", true);
apdex.combine(1500, "bar", true);
apdex.calculate();
assertThat(apdex.getScore(), is(5000));
assertThat(apdex.getValue(), is(5000));

apdex = new ApdexMetricsImpl();
apdex.combine(200, "foo", true);
apdex.combine(300, "bar", false);
apdex.calculate();
assertThat(apdex.getScore(), is(5000));
assertThat(apdex.getValue(), is(5000));

apdex = new ApdexMetricsImpl();
apdex.combine(200, "foo", true);
apdex.combine(1500, "bar", false);
apdex.calculate();
assertThat(apdex.getScore(), is(5000));
assertThat(apdex.getValue(), is(5000));

apdex = new ApdexMetricsImpl();
apdex.combine(200, "foo", true);
apdex.combine(5000, "bar", true);
apdex.calculate();
assertThat(apdex.getScore(), is(5000));
assertThat(apdex.getValue(), is(5000));
}

@Test
Expand All @@ -84,7 +84,7 @@ public void testCombine() {

apdex1.combine(apdex2);
apdex1.calculate();
assertThat(apdex1.getScore(), is(6000));
assertThat(apdex1.getValue(), is(6000));
}

public class ApdexMetricsImpl extends ApdexMetrics {
Expand Down

0 comments on commit c14aaa4

Please sign in to comment.