Skip to content

Commit e4e5956

Browse files
committed
Include validator name in pass message for
RecordCountPercentChangeValidator and RecordCountVarianceValidator This is useful when debugging producer cycles, to view which validators have run successfully.
1 parent da9ef6c commit e4e5956

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

hollow/src/main/java/com/netflix/hollow/api/producer/validation/RecordCountPercentChangeValidator.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public RecordCountPercentChangeValidator(String typeName,
3030

3131
@Override
3232
public String getName() {
33-
return NAME;
33+
return NAME + "_" + typeName;
3434
}
3535

3636
@Override
@@ -79,7 +79,10 @@ private ValidationResult validateChanges(HollowTypeReadState typeState) {
7979
(removedPercentageThreshold < 0 || removedPercent < removedPercentageThreshold) &&
8080
(updatedPercentageThreshold < 0 || updatedPercent < updatedPercentageThreshold);
8181
if (pass) {
82-
return builder.passed();
82+
return builder.passed(String.format(
83+
"%s added=%.2f%% (<%.2f%%), removed=%.2f%% (<%.2f%%), updated=%.2f%% (<%.2f%%)",
84+
getName(), addedPercent * 100, addedPercentageThreshold * 100, removedPercent * 100,
85+
removedPercentageThreshold * 100, updatedPercent * 100, updatedPercentageThreshold * 100));
8386
}
8487
return builder.failed("record count change is more than threshold");
8588
}

hollow/src/main/java/com/netflix/hollow/api/producer/validation/RecordCountVarianceValidator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public ValidationResult onValidate(ReadState readState) {
123123
return vrb.failed(message);
124124
}
125125

126-
return vrb.passed();
126+
return vrb.passed(String.format("%s percentChange=%.2f%%, threshold=%.2f%%",
127+
getName(), actualChangePercent, allowableVariancePercent));
127128
}
128129

129130
// protected for tests

0 commit comments

Comments
 (0)