-
Notifications
You must be signed in to change notification settings - Fork 5
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
Malformed lines bug #47
Conversation
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
@@ -86,8 +87,10 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques | |||
logger.debug("got log: {} ", line); | |||
}); | |||
logger.debug("Total number of logRequests {} ({})", logRequests.size(), logRequests); | |||
|
|||
// Tell Jetty we are ok, and it should return 200 | |||
} catch (IllegalArgumentException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a Jackson exception here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I'm catching exceptions from LogRequest
function
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
logzio-sender/src/main/java/io/logz/sender/HttpsSyncSender.java
Outdated
Show resolved
Hide resolved
@@ -110,6 +110,31 @@ public void simpleAppending() throws Exception { | |||
mockListener.assertLogReceivedIs(message2, token, type, loggerName, LOGLEVEL); | |||
} | |||
|
|||
@Test | |||
public void malformedBulk() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failed before the change and now it passes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a new test
@asafm |
} | ||
else if (responseCode == HttpURLConnection.HTTP_OK) { | ||
reporter.info("Successfully sent bulk to logz.io, size: " + payload.length); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps retry only if response code == 5xx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legit
Fixing bug:
When we receive a bad request from the listener we try to send the bulk again. This creates duplicate logs in case we have valid JSON objects in that bulk that the listener processed properly(resend of valid json too).