Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #847 by adding BAD_REQUEST to the HystrixRequestLog #876

Merged
merged 1 commit into from
Aug 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ public Observable<R> call(Throwable t) {
*/
try {
metrics.markBadRequest(System.currentTimeMillis() - invocationStartTime);
executionResult = executionResult.addEvents(HystrixEventType.BAD_REQUEST);
Exception decorated = executionHook.onError(_self, FailureType.BAD_REQUEST_EXCEPTION, (Exception) t);

if (decorated instanceof HystrixBadRequestException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ public void onNext(Object t) {
}
}

protected void assertSaneHystrixRequestLog(final int numCommands) {
HystrixRequestLog currentRequestLog = HystrixRequestLog.getCurrentRequest();

try {
assertEquals(numCommands, currentRequestLog.getAllExecutedCommands().size());
assertFalse(currentRequestLog.getExecutedCommandsAsString().contains("Executed"));
assertTrue(currentRequestLog.getAllExecutedCommands().iterator().next().getExecutionEvents().size() >= 1);
//Most commands should have 1 execution event, but fallbacks / responses from cache can cause more than 1. They should never have 0
} catch (Throwable ex) {
System.out.println("Problematic Request log : " + currentRequestLog.getExecutedCommandsAsString() + " , expected : " + numCommands);
throw new RuntimeException(ex);
}
}

/**
* Threadpool with 1 thread, queue of size 1
*/
Expand Down
Loading