Skip to content

Commit

Permalink
Add convenience method for retrieving stats for given code
Browse files Browse the repository at this point in the history
Also add trailing new line to `BenchmarkingClusterTest`
  • Loading branch information
bjorncs committed Jan 27, 2025
1 parent 6a359ca commit 0a5dadf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package ai.vespa.feed.client;

import java.util.Map;
import java.util.Optional;

/**
* Statistics for feed operations over HTTP against a Vespa cluster.
Expand Down Expand Up @@ -57,6 +58,9 @@ public long successes() {
/** Statistics per response code. */
public Map<Integer, Response> statsByCode() { return statsByCode; }

/** Statistics for the given code. */
public Optional<Response> response(int code) { return Optional.ofNullable(statsByCode.get(code)); }

/** Number of exceptions (instead of responses). */
public long exceptions() {
return exceptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ private static Void processRequest(AtomicLong nanoClock, InvocationOnMock invoca
vessel.complete(HttpResponse.of(statusCode, "body".getBytes(StandardCharsets.UTF_8)));
return null;
}
}
}

0 comments on commit 0a5dadf

Please sign in to comment.