Skip to content

Commit

Permalink
[CHECKER] fix RpcGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Jan 3, 2025
1 parent 7fed812 commit 8a93db5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/astraea/app/checker/Checker.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

public class Checker {

private static final List<Guard> GUARDS = List.of(new RpcGuard());
private static final List<Guard> GUARDS = List.of(new RpcGuard(), new ConfigGuard());

public static void main(String[] args) throws Exception {
execute(Argument.parse(new Argument(), args));
Expand Down
11 changes: 2 additions & 9 deletions app/src/main/java/org/astraea/app/checker/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import org.apache.kafka.common.Node;

public record Report(Node node, String why) {
static Report noMetrics(Node node) {
return new Report(node, "failed to get metrics from");
}

static Report of(Node node, String why) {
return new Report(node, why);
}
Expand All @@ -41,7 +37,7 @@ static Report of(Node node, Protocol protocol, Set<Integer> versions) {
return new Report(
node,
String.format(
"there are unsupported %s versions: %s due to new baseline: %s",
"there are unsupported %s versions: %s and new baseline: [%s]",
protocol.name(), unsupportedVersions, protocol.base()));
}

Expand All @@ -52,9 +48,6 @@ Stream<Report> stream() {

@Override
public String toString() {
if (node == null) {
return "Report[pass]";
}
return "Report[" + node + "] why = " + why;
return "[" + node + "] has issue to 4.0 because \"" + why + "\"";
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/org/astraea/app/checker/RpcGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ private Collection<Report> checkNode(
Node node, Map<String, Protocol> protocols, Function<Node, MBeanClient> clients) {
return Arrays.stream(NetworkMetrics.Request.values())
.filter(request -> protocols.containsKey(request.metricName().toLowerCase()))
.map(
.flatMap(
request -> {
var protocol = protocols.get(request.metricName().toLowerCase());
var versions = NetworkMetrics.Request.PRODUCE.versions(clients.apply(node));
return Report.of(node, protocol, versions);
var versions = request.versions(clients.apply(node));
return Report.of(node, protocol, versions).stream();
})
.toList();
}
Expand Down

0 comments on commit 8a93db5

Please sign in to comment.