Skip to content

Commit

Permalink
[#7375] Add header log
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Nov 16, 2020
1 parent 4561ee5 commit 127e828
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.grpc.MessageFormatUtils;
import com.navercorp.pinpoint.grpc.StatusError;
import com.navercorp.pinpoint.grpc.StatusErrors;
import com.navercorp.pinpoint.grpc.server.ServerContext;
import com.navercorp.pinpoint.grpc.trace.PSpan;
import com.navercorp.pinpoint.grpc.trace.PSpanChunk;
import com.navercorp.pinpoint.grpc.trace.PSpanMessage;
Expand Down Expand Up @@ -82,16 +83,21 @@ public void onNext(PSpanMessage spanMessage) {

@Override
public void onError(Throwable throwable) {
com.navercorp.pinpoint.grpc.Header header = ServerContext.getAgentInfo();

final StatusError statusError = StatusErrors.throwable(throwable);
if (statusError.isSimpleError()) {
logger.info("Failed to span stream, cause={}", statusError.getMessage());
logger.info("Failed to span stream, {} cause={}", header, statusError.getMessage(), statusError.getThrowable());
} else {
logger.warn("Failed to span stream, cause={}", statusError.getMessage(), statusError.getThrowable());
logger.warn("Failed to span stream, {} cause={}", header, statusError.getMessage(), statusError.getThrowable());
}
}

@Override
public void onCompleted() {
com.navercorp.pinpoint.grpc.Header header = ServerContext.getAgentInfo();
logger.info("onCompleted {}", header);

Empty empty = Empty.newBuilder().build();
responseObserver.onNext(empty);
responseObserver.onCompleted();
Expand Down

0 comments on commit 127e828

Please sign in to comment.