Skip to content

Commit

Permalink
[INLONG-9739][Sort] onParsingBodyFailure function in FailureHandler c…
Browse files Browse the repository at this point in the history
…lass need add 'head' paramete to generate failure metric (#9740)
  • Loading branch information
baomingyu authored Feb 28, 2024
1 parent 9a9a436 commit a94f0fa
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public interface FailureHandler extends Serializable {
* @param exception the thrown exception
* @throws Exception the exception
*/
void onParsingBodyFailure(byte[] body, Exception exception) throws Exception;
void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception;

/**
* This method is called when there is a failure occurred while converting head and body to row.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void onParsingHeadFailure(String attribute, Exception exception) {
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) {
LOG.warn("Cannot properly parse the body: {}.", new String(body), exception);
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) {
LOG.warn("Cannot properly parse the head: {}, body: {}.", head, new String(body), exception);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
LOG.error("Cannot properly parse the body: {}.", new String(body), exception);
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
LOG.error("Cannot properly parse the head: {}, the body: {}.", head, new String(body), exception);
throw exception;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void flatMap(
try {
bodyList = parseBodyList(bodyBytes);
} catch (Exception e) {
failureHandler.onParsingBodyFailure(bodyBytes, e);
failureHandler.onParsingBodyFailure(head, bodyBytes, e);
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public List<InLongMsgWrap> preParse(byte[] bytes) throws Exception {
bodyList = parseBodyList(bodyBytes);
} catch (Exception e) {
reportDeSerializeErrorMetrics();
failureHandler.onParsingBodyFailure(bodyBytes, e);
failureHandler.onParsingBodyFailure(head, bodyBytes, e);
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void onParsingHeadFailure(String attribute, Exception exception) throws E
}

@Override
public void onParsingBodyFailure(byte[] body, Exception exception) throws Exception {
public void onParsingBodyFailure(InLongMsgHead head, byte[] body, Exception exception) throws Exception {
bodyCount++;
}

Expand Down

0 comments on commit a94f0fa

Please sign in to comment.