}
public NewIssuesNotification setStatistics(String projectName, NewIssuesStatistics.Stats stats) {
- setDefaultMessage(stats.getDistributedMetricStats(RULE_TYPE).getOnLeak() + " new issues on " + projectName + ".\n");
+ setDefaultMessage(stats.getDistributedMetricStats(RULE_TYPE).getOnCurrentAnalysis() + " new issues on " + projectName + ".\n");
setRuleTypeStatistics(stats);
setAssigneesStatistics(stats);
private void setRuleStatistics(NewIssuesStatistics.Stats stats) {
Metric metric = Metric.RULE;
- List<Map.Entry<String, MetricStatsInt>> fiveBiggest = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnLeak);
+ List<Map.Entry<String, MetricStatsInt>> fiveBiggest = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnCurrentAnalysis);
int i = 1;
for (Map.Entry<String, MetricStatsInt> ruleStats : fiveBiggest) {
String ruleKey = ruleStats.getKey();
.orElseThrow(() -> new IllegalStateException(String.format("Rule with key '%s' does not exist", ruleKey)));
String name = rule.getName() + " (" + rule.getLanguage() + ")";
setFieldValue(metric + DOT + i + LABEL, name);
- setFieldValue(metric + DOT + i + COUNT, String.valueOf(ruleStats.getValue().getOnLeak()));
+ setFieldValue(metric + DOT + i + COUNT, String.valueOf(ruleStats.getValue().getOnCurrentAnalysis()));
i++;
}
}
private void setComponentsStatistics(NewIssuesStatistics.Stats stats) {
Metric metric = Metric.COMPONENT;
int i = 1;
- List<Map.Entry<String, MetricStatsInt>> fiveBiggest = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnLeak);
+ List<Map.Entry<String, MetricStatsInt>> fiveBiggest = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnCurrentAnalysis);
for (Map.Entry<String, MetricStatsInt> componentStats : fiveBiggest) {
String uuid = componentStats.getKey();
String componentName = detailsSupplier.getComponentNameByUuid(uuid)
.orElseThrow(() -> new IllegalStateException(String.format("Component with uuid '%s' not found", uuid)));
setFieldValue(metric + DOT + i + LABEL, componentName);
- setFieldValue(metric + DOT + i + COUNT, String.valueOf(componentStats.getValue().getOnLeak()));
+ setFieldValue(metric + DOT + i + COUNT, String.valueOf(componentStats.getValue().getOnCurrentAnalysis()));
i++;
}
}
private void setTagsStatistics(NewIssuesStatistics.Stats stats) {
Metric metric = Metric.TAG;
int i = 1;
- for (Map.Entry<String, MetricStatsInt> tagStats : fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnLeak)) {
- setFieldValue(metric + DOT + i + COUNT, String.valueOf(tagStats.getValue().getOnLeak()));
+ for (Map.Entry<String, MetricStatsInt> tagStats : fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnCurrentAnalysis)) {
+ setFieldValue(metric + DOT + i + COUNT, String.valueOf(tagStats.getValue().getOnCurrentAnalysis()));
setFieldValue(metric + DOT + i + LABEL, tagStats.getKey());
i++;
}
private void setAssigneesStatistics(NewIssuesStatistics.Stats stats) {
Metric metric = Metric.ASSIGNEE;
- List<Map.Entry<String, MetricStatsInt>> entries = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnLeak);
+ List<Map.Entry<String, MetricStatsInt>> entries = fiveBiggest(stats.getDistributedMetricStats(metric), MetricStatsInt::getOnCurrentAnalysis);
int i = 1;
for (Map.Entry<String, MetricStatsInt> assigneeStats : entries) {
String assigneeUuid = assigneeStats.getKey();
String name = detailsSupplier.getUserNameByUuid(assigneeUuid).orElse(assigneeUuid);
setFieldValue(metric + DOT + i + LABEL, name);
- setFieldValue(metric + DOT + i + COUNT, String.valueOf(assigneeStats.getValue().getOnLeak()));
+ setFieldValue(metric + DOT + i + COUNT, String.valueOf(assigneeStats.getValue().getOnCurrentAnalysis()));
i++;
}
}
private void setRuleTypeStatistics(NewIssuesStatistics.Stats stats) {
DistributedMetricStatsInt distributedMetricStats = stats.getDistributedMetricStats(RULE_TYPE);
- setFieldValue(RULE_TYPE + COUNT, String.valueOf(distributedMetricStats.getOnLeak()));
+ setFieldValue(RULE_TYPE + COUNT, String.valueOf(distributedMetricStats.getOnCurrentAnalysis()));
Arrays.stream(RuleType.values())
.forEach(ruleType -> setFieldValue(
RULE_TYPE + DOT + ruleType + COUNT,
- String.valueOf(distributedMetricStats.getForLabel(ruleType.name()).map(MetricStatsInt::getOnLeak).orElse(0))));
+ String.valueOf(distributedMetricStats.getForLabel(ruleType.name()).map(MetricStatsInt::getOnCurrentAnalysis).orElse(0))));
}
@Override
import static org.sonar.server.issue.notification.NewIssuesStatistics.Metric.TAG;
public class NewIssuesStatistics {
- private final Predicate<DefaultIssue> onLeakPredicate;
+ private final Predicate<DefaultIssue> onCurrentAnalysisPredicate;
private final Map<String, Stats> assigneesStatistics = new LinkedHashMap<>();
private final Stats globalStatistics;
- public NewIssuesStatistics(Predicate<DefaultIssue> onLeakPredicate) {
- this.onLeakPredicate = onLeakPredicate;
- this.globalStatistics = new Stats(onLeakPredicate);
+ public NewIssuesStatistics(Predicate<DefaultIssue> onCurrentAnalysisPredicate) {
+ this.onCurrentAnalysisPredicate = onCurrentAnalysisPredicate;
+ this.globalStatistics = new Stats(onCurrentAnalysisPredicate);
}
public void add(DefaultIssue issue) {
globalStatistics.add(issue);
String userUuid = issue.assignee();
if (userUuid != null) {
- assigneesStatistics.computeIfAbsent(userUuid, a -> new Stats(onLeakPredicate)).add(issue);
+ assigneesStatistics.computeIfAbsent(userUuid, a -> new Stats(onCurrentAnalysisPredicate)).add(issue);
}
}
return globalStatistics.hasIssues();
}
- public boolean hasIssuesOnLeak() {
- return globalStatistics.hasIssuesOnLeak();
+ public boolean hasIssuesOnCurrentAnalysis() {
+ return globalStatistics.hasIssuesOnCurrentAnalysis();
}
public enum Metric {
}
public static class Stats {
- private final Predicate<DefaultIssue> onLeakPredicate;
+ private final Predicate<DefaultIssue> onCurrentAnalysisPredicate;
private final Map<Metric, DistributedMetricStatsInt> distributions = new EnumMap<>(Metric.class);
private MetricStatsLong effortStats = new MetricStatsLong();
- public Stats(Predicate<DefaultIssue> onLeakPredicate) {
- this.onLeakPredicate = onLeakPredicate;
+ public Stats(Predicate<DefaultIssue> onCurrentAnalysisPredicate) {
+ this.onCurrentAnalysisPredicate = onCurrentAnalysisPredicate;
for (Metric metric : Metric.values()) {
if (metric.isComputedByDistribution()) {
distributions.put(metric, new DistributedMetricStatsInt());
}
public void add(DefaultIssue issue) {
- boolean isOnLeak = onLeakPredicate.test(issue);
- distributions.get(RULE_TYPE).increment(issue.type().name(), isOnLeak);
+ boolean onCurrentAnalysis = onCurrentAnalysisPredicate.test(issue);
+ distributions.get(RULE_TYPE).increment(issue.type().name(), onCurrentAnalysis);
String componentUuid = issue.componentUuid();
if (componentUuid != null) {
- distributions.get(COMPONENT).increment(componentUuid, isOnLeak);
+ distributions.get(COMPONENT).increment(componentUuid, onCurrentAnalysis);
}
RuleKey ruleKey = issue.ruleKey();
if (ruleKey != null) {
- distributions.get(RULE).increment(ruleKey.toString(), isOnLeak);
+ distributions.get(RULE).increment(ruleKey.toString(), onCurrentAnalysis);
}
String assigneeUuid = issue.assignee();
if (assigneeUuid != null) {
- distributions.get(ASSIGNEE).increment(assigneeUuid, isOnLeak);
+ distributions.get(ASSIGNEE).increment(assigneeUuid, onCurrentAnalysis);
}
for (String tag : issue.tags()) {
- distributions.get(TAG).increment(tag, isOnLeak);
+ distributions.get(TAG).increment(tag, onCurrentAnalysis);
}
Duration effort = issue.effort();
if (effort != null) {
- effortStats.add(effort.toMinutes(), isOnLeak);
+ effortStats.add(effort.toMinutes(), onCurrentAnalysis);
}
}
return getDistributedMetricStats(RULE_TYPE).getTotal() > 0;
}
- public boolean hasIssuesOnLeak() {
- return getDistributedMetricStats(RULE_TYPE).getOnLeak() > 0;
+ public boolean hasIssuesOnCurrentAnalysis() {
+ return getDistributedMetricStats(RULE_TYPE).getOnCurrentAnalysis() > 0;
}
@Override
}
@Test
- public void add_counts_issue_per_RuleType_on_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_RuleType_on_current_analysis_globally_and_per_assignee() {
String assignee = randomAlphanumeric(10);
Arrays.stream(RuleType.values())
.map(ruleType -> new DefaultIssue().setType(ruleType).setAssigneeUuid(assignee).setNew(true))
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.RULE_TYPE);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.RULE_TYPE);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> Arrays.stream(RuleType.values()).forEach(ruleType -> assertStats(distribution, ruleType.name(), 1, 0, 1)));
+ .forEach(distribution -> Arrays.stream(RuleType.values()).forEach(ruleType -> assertStats(distribution, ruleType.name(), 1, 1)));
}
@Test
- public void add_counts_issue_per_RuleType_off_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_RuleType_off_current_analysis_globally_and_per_assignee() {
String assignee = randomAlphanumeric(10);
Arrays.stream(RuleType.values())
.map(ruleType -> new DefaultIssue().setType(ruleType).setAssigneeUuid(assignee).setNew(false))
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.RULE_TYPE);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.RULE_TYPE);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> Arrays.stream(RuleType.values()).forEach(ruleType -> assertStats(distribution, ruleType.name(), 0, 1, 1)));
+ .forEach(distribution -> Arrays.stream(RuleType.values()).forEach(ruleType -> assertStats(distribution, ruleType.name(), 0, 1)));
}
@Test
- public void add_counts_issue_per_component_on_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_component_on_current_analysis_globally_and_per_assignee() {
List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
componentUuids.stream()
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.COMPONENT);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.COMPONENT);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> componentUuids.forEach(componentUuid -> assertStats(distribution, componentUuid, 1, 0, 1)));
+ .forEach(distribution -> componentUuids.forEach(componentUuid -> assertStats(distribution, componentUuid, 1, 1)));
}
@Test
- public void add_counts_issue_per_component_off_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_component_off_current_analysis_globally_and_per_assignee() {
List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
componentUuids.stream()
NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee);
DistributedMetricStatsInt assigneeDistribution = stats.getDistributedMetricStats(Metric.COMPONENT);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> componentUuids.forEach(componentUuid -> assertStats(distribution, componentUuid, 0, 1, 1)));
+ .forEach(distribution -> componentUuids.forEach(componentUuid -> assertStats(distribution, componentUuid, 0, 1)));
}
@Test
}
@Test
- public void add_counts_issue_per_ruleKey_on_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_ruleKey_on_current_analysis_globally_and_per_assignee() {
String repository = randomAlphanumeric(3);
List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee);
DistributedMetricStatsInt assigneeDistribution = stats.getDistributedMetricStats(Metric.RULE);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> ruleKeys.forEach(ruleKey -> assertStats(distribution, RuleKey.of(repository, ruleKey).toString(), 1, 0, 1)));
+ .forEach(distribution -> ruleKeys.forEach(ruleKey -> assertStats(distribution, RuleKey.of(repository, ruleKey).toString(), 1, 1)));
}
@Test
- public void add_counts_issue_per_ruleKey_off_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_ruleKey_off_current_analysis_globally_and_per_assignee() {
String repository = randomAlphanumeric(3);
List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.RULE);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.RULE);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> ruleKeys.forEach(ruleKey -> assertStats(distribution, RuleKey.of(repository, ruleKey).toString(), 0, 1, 1)));
+ .forEach(distribution -> ruleKeys.forEach(ruleKey -> assertStats(distribution, RuleKey.of(repository, ruleKey).toString(), 0, 1)));
}
@Test
}
@Test
- public void add_counts_issue_per_assignee_on_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_assignee_on_current_analysis_globally_and_per_assignee() {
List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
assignees.stream()
.map(assignee -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(assignee).setNew(true))
.forEach(underTest::add);
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.ASSIGNEE);
- assignees.forEach(assignee -> assertStats(globalDistribution, assignee, 1, 0, 1));
+ assignees.forEach(assignee -> assertStats(globalDistribution, assignee, 1, 1));
assignees.forEach(assignee -> {
NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee);
DistributedMetricStatsInt assigneeStats = stats.getDistributedMetricStats(Metric.ASSIGNEE);
- assertThat(assigneeStats.getOnLeak()).isEqualTo(1);
+ assertThat(assigneeStats.getOnCurrentAnalysis()).isEqualTo(1);
assertThat(assigneeStats.getTotal()).isEqualTo(1);
assignees.forEach(s -> {
Optional<MetricStatsInt> forLabelOpts = assigneeStats.getForLabel(s);
if (s.equals(assignee)) {
assertThat(forLabelOpts.isPresent()).isTrue();
MetricStatsInt forLabel = forLabelOpts.get();
- assertThat(forLabel.getOnLeak()).isEqualTo(1);
+ assertThat(forLabel.getOnCurrentAnalysis()).isEqualTo(1);
assertThat(forLabel.getTotal()).isEqualTo(1);
} else {
assertThat(forLabelOpts.isPresent()).isFalse();
}
@Test
- public void add_counts_issue_per_assignee_off_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_assignee_off_current_analysis_globally_and_per_assignee() {
List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
assignees.stream()
.map(assignee -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(assignee).setNew(false))
.forEach(underTest::add);
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.ASSIGNEE);
- assignees.forEach(assignee -> assertStats(globalDistribution, assignee, 0, 1, 1));
+ assignees.forEach(assignee -> assertStats(globalDistribution, assignee, 0, 1));
assignees.forEach(assignee -> {
NewIssuesStatistics.Stats stats = underTest.getAssigneesStatistics().get(assignee);
DistributedMetricStatsInt assigneeStats = stats.getDistributedMetricStats(Metric.ASSIGNEE);
- assertThat(assigneeStats.getOnLeak()).isEqualTo(0);
+ assertThat(assigneeStats.getOnCurrentAnalysis()).isEqualTo(0);
assertThat(assigneeStats.getTotal()).isEqualTo(1);
assignees.forEach(s -> {
Optional<MetricStatsInt> forLabelOpts = assigneeStats.getForLabel(s);
if (s.equals(assignee)) {
assertThat(forLabelOpts.isPresent()).isTrue();
MetricStatsInt forLabel = forLabelOpts.get();
- assertThat(forLabel.getOnLeak()).isEqualTo(0);
+ assertThat(forLabel.getOnCurrentAnalysis()).isEqualTo(0);
assertThat(forLabel.getTotal()).isEqualTo(1);
} else {
assertThat(forLabelOpts.isPresent()).isFalse();
}
@Test
- public void add_counts_issue_per_tags_on_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_tags_on_current_analysis_globally_and_per_assignee() {
List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setTags(tags).setAssigneeUuid(assignee).setNew(true));
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.TAG);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.TAG);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> tags.forEach(tag -> assertStats(distribution, tag, 1, 0, 1)));
+ .forEach(distribution -> tags.forEach(tag -> assertStats(distribution, tag, 1, 1)));
}
@Test
- public void add_counts_issue_per_tags_off_leak_globally_and_per_assignee() {
+ public void add_counts_issue_per_tags_off_current_analysis_globally_and_per_assignee() {
List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
String assignee = randomAlphanumeric(10);
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setTags(tags).setAssigneeUuid(assignee).setNew(false));
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.TAG);
DistributedMetricStatsInt assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).getDistributedMetricStats(Metric.TAG);
Stream.of(globalDistribution, assigneeDistribution)
- .forEach(distribution -> tags.forEach(tag -> assertStats(distribution, tag, 0, 1, 1)));
+ .forEach(distribution -> tags.forEach(tag -> assertStats(distribution, tag, 0, 1)));
}
@Test
}
@Test
- public void add_sums_effort_on_leak_globally_and_per_assignee() {
+ public void add_sums_effort_on_current_analysis_globally_and_per_assignee() {
Random random = new Random();
List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).collect(Collectors.toList());
int expected = efforts.stream().mapToInt(s -> s).sum();
MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort();
Stream.of(globalDistribution, assigneeDistribution)
.forEach(distribution -> {
- assertThat(distribution.getOnLeak()).isEqualTo(expected);
- assertThat(distribution.getOffLeak()).isEqualTo(0);
+ assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(expected);
+ assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(0);
assertThat(distribution.getTotal()).isEqualTo(expected);
});
}
@Test
- public void add_sums_effort_off_leak_globally_and_per_assignee() {
+ public void add_sums_effort_off_current_analysis_globally_and_per_assignee() {
Random random = new Random();
List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).collect(Collectors.toList());
int expected = efforts.stream().mapToInt(s -> s).sum();
MetricStatsLong assigneeDistribution = underTest.getAssigneesStatistics().get(assignee).effort();
Stream.of(globalDistribution, assigneeDistribution)
.forEach(distribution -> {
- assertThat(distribution.getOnLeak()).isEqualTo(0);
- assertThat(distribution.getOffLeak()).isEqualTo(expected);
+ assertThat(distribution.getOnCurrentAnalysis()).isEqualTo(0);
+ assertThat(distribution.getOffCurrentAnalysis()).isEqualTo(expected);
assertThat(distribution.getTotal()).isEqualTo(expected);
});
}
.isEqualTo("NewIssuesStatistics{" +
"assigneesStatistics={" + assignee + "=" +
"Stats{distributions={" +
- "RULE_TYPE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + randomRuleTypeExceptHotspot.name() + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "TAG=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + tag + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "COMPONENT=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + componentUuid + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "ASSIGNEE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + assignee + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "RULE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + ruleKey.toString() + "=MetricStatsInt{onLeak=1, offLeak=0}}}}, " +
- "effortStats=MetricStatsLong{onLeak=" + effort + ", offLeak=0}}}, " +
+ "RULE_TYPE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + randomRuleTypeExceptHotspot.name() + "=MetricStatsInt{on=1, off=0}}}, " +
+ "TAG=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + tag + "=MetricStatsInt{on=1, off=0}}}, " +
+ "COMPONENT=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + componentUuid + "=MetricStatsInt{on=1, off=0}}}, " +
+ "ASSIGNEE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + assignee + "=MetricStatsInt{on=1, off=0}}}, " +
+ "RULE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + ruleKey.toString() + "=MetricStatsInt{on=1, off=0}}}}, " +
+ "effortStats=MetricStatsLong{on=" + effort + ", off=0}}}, " +
"globalStatistics=Stats{distributions={" +
- "RULE_TYPE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + randomRuleTypeExceptHotspot.name() + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "TAG=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + tag + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "COMPONENT=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + componentUuid + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "ASSIGNEE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + assignee + "=MetricStatsInt{onLeak=1, offLeak=0}}}, " +
- "RULE=DistributedMetricStatsInt{globalStats=MetricStatsInt{onLeak=1, offLeak=0}, " +
- "statsPerLabel={" + ruleKey.toString() + "=MetricStatsInt{onLeak=1, offLeak=0}}}}, " +
- "effortStats=MetricStatsLong{onLeak=" + effort + ", offLeak=0}}}");
+ "RULE_TYPE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + randomRuleTypeExceptHotspot.name() + "=MetricStatsInt{on=1, off=0}}}, " +
+ "TAG=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + tag + "=MetricStatsInt{on=1, off=0}}}, " +
+ "COMPONENT=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + componentUuid + "=MetricStatsInt{on=1, off=0}}}, " +
+ "ASSIGNEE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + assignee + "=MetricStatsInt{on=1, off=0}}}, " +
+ "RULE=DistributedMetricStatsInt{globalStats=MetricStatsInt{on=1, off=0}, " +
+ "statsPerLabel={" + ruleKey.toString() + "=MetricStatsInt{on=1, off=0}}}}, " +
+ "effortStats=MetricStatsLong{on=" + effort + ", off=0}}}");
}
@CheckForNull
.orElse(null);
}
- private void assertStats(DistributedMetricStatsInt distribution, String label, int onLeak, int offLeak, int total) {
+ private void assertStats(DistributedMetricStatsInt distribution, String label, int onCurrentAnalysis, int total) {
Optional<MetricStatsInt> statsOption = distribution.getForLabel(label);
assertThat(statsOption.isPresent()).describedAs("distribution for label %s not found", label).isTrue();
MetricStatsInt stats = statsOption.get();
- assertThat(stats.getOnLeak()).isEqualTo(onLeak);
+ assertThat(stats.getOnCurrentAnalysis()).isEqualTo(onCurrentAnalysis);
assertThat(stats.getTotal()).isEqualTo(total);
}