Skip to content

Commit

Permalink
filter invalid event in object store trace (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
guykhazma authored Nov 8, 2022
1 parent 75e9f52 commit a29ac99
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Stream<AccessEvent> events() {
return lines()
.map(line -> line.split(" "))
.filter(array -> array[1].equals("REST.GET.OBJECT"))
.map(array -> {
.flatMap(array -> {
long key = new BigInteger(array[2], 16).longValue();
int weight;
if (array.length == 3) {
Expand All @@ -58,7 +58,10 @@ public Stream<AccessEvent> events() {
long end = Long.parseLong(array[5]);
weight = Ints.saturatedCast(end - start);
}
return AccessEvent.forKeyAndWeight(key, weight);
if (weight < 0) {
return Stream.empty();
}
return Stream.of(AccessEvent.forKeyAndWeight(key, weight));
});
}
}

0 comments on commit a29ac99

Please sign in to comment.