use of com.navercorp.pinpoint.grpc.StatusError in project pinpoint by naver.
the class ResponseStreamObserver method onError.
@Override
public void onError(Throwable t) {
final StatusError statusError = StatusErrors.throwable(t);
if (statusError.isSimpleError()) {
logger.info("Failed to stream, name={}, cause={}", listener, statusError.getMessage());
} else {
logger.info("Failed to stream, name={}, cause={}", listener, statusError.getMessage(), statusError.getThrowable());
}
listener.onError(t);
}
use of com.navercorp.pinpoint.grpc.StatusError in project pinpoint by naver.
the class GrpcCommandService method handleOnError.
private void handleOnError(Throwable t, PinpointGrpcServer pinpointGrpcServer, AgentInfo agentInfo) {
Objects.requireNonNull(pinpointGrpcServer, "pinpointGrpcServer");
Objects.requireNonNull(agentInfo, "agentInfo");
final StatusError statusError = StatusErrors.throwable(t);
if (statusError.isSimpleError()) {
logger.info("Failed to command stream, {} => local, cause={}", agentInfo.getAgentKey(), statusError.getMessage());
} else {
logger.warn("Failed to command stream, {} => local, cause={}", agentInfo.getAgentKey(), statusError.getMessage(), statusError.getThrowable());
}
pinpointGrpcServer.disconnected();
}
use of com.navercorp.pinpoint.grpc.StatusError in project pinpoint by naver.
the class StatService method sendAgentStat.
@Override
public StreamObserver<PStatMessage> sendAgentStat(StreamObserver<Empty> responseObserver) {
StreamObserver<PStatMessage> observer = new StreamObserver<PStatMessage>() {
@Override
public void onNext(PStatMessage statMessage) {
if (isDebug) {
logger.debug("Send PAgentStat={}", MessageFormatUtils.debugLog(statMessage));
}
if (statMessage.hasAgentStat()) {
final Message<PAgentStat> message = newMessage(statMessage.getAgentStat(), DefaultTBaseLocator.AGENT_STAT);
send(message, responseObserver);
} else if (statMessage.hasAgentStatBatch()) {
final Message<PAgentStatBatch> message = newMessage(statMessage.getAgentStatBatch(), DefaultTBaseLocator.AGENT_STAT_BATCH);
send(message, responseObserver);
} else if (statMessage.hasAgentUriStat()) {
final Message<PAgentUriStat> message = newMessage(statMessage.getAgentUriStat(), DefaultTBaseLocator.AGENT_URI_STAT);
send(message, responseObserver);
} else {
if (isDebug) {
logger.debug("Found empty stat message {}", MessageFormatUtils.debugLog(statMessage));
}
}
}
@Override
public void onError(Throwable throwable) {
final StatusError statusError = StatusErrors.throwable(throwable);
if (statusError.isSimpleError()) {
logger.info("Failed to stat stream, cause={}", statusError.getMessage());
} else {
logger.warn("Failed to stat stream, cause={}", statusError.getMessage(), statusError.getThrowable());
}
}
@Override
public void onCompleted() {
com.navercorp.pinpoint.grpc.Header header = ServerContext.getAgentInfo();
logger.info("onCompleted {}", header);
responseObserver.onNext(Empty.newBuilder().build());
responseObserver.onCompleted();
}
};
return observer;
}
use of com.navercorp.pinpoint.grpc.StatusError in project pinpoint by naver.
the class RetryResponseStreamObserver method onError.
@Override
public void onError(Throwable throwable) {
final StatusError statusError = StatusErrors.throwable(throwable);
if (statusError.isSimpleError()) {
logger.info("Error. request={}, cause={}", logString(message), statusError.getMessage());
} else {
logger.info("Error. request={}, cause={}", logString(message), statusError.getMessage(), statusError.getThrowable());
}
// Retry
final int remainingRetryCount = nextRetryCount();
retryScheduler.scheduleNextRetry(message, remainingRetryCount);
}
use of com.navercorp.pinpoint.grpc.StatusError in project pinpoint by naver.
the class SpanService method sendSpan.
@Override
public StreamObserver<PSpanMessage> sendSpan(final StreamObserver<Empty> responseObserver) {
StreamObserver<PSpanMessage> observer = new StreamObserver<PSpanMessage>() {
@Override
public void onNext(PSpanMessage spanMessage) {
if (isDebug) {
logger.debug("Send PSpan={}", MessageFormatUtils.debugLog(spanMessage));
}
if (spanMessage.hasSpan()) {
final Message<PSpan> message = newMessage(spanMessage.getSpan(), DefaultTBaseLocator.SPAN);
send(message, responseObserver);
} else if (spanMessage.hasSpanChunk()) {
final Message<PSpanChunk> message = newMessage(spanMessage.getSpanChunk(), DefaultTBaseLocator.SPANCHUNK);
send(message, responseObserver);
} else {
if (isDebug) {
logger.debug("Found empty span message {}", MessageFormatUtils.debugLog(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={}", header, statusError.getMessage(), statusError.getThrowable());
} else {
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();
}
};
return observer;
}
Aggregations