use of com.navercorp.pinpoint.grpc.trace.PStatMessage in project pinpoint by naver.
the class StatClientMock method agentStatBatch.
public void agentStatBatch(final int count) {
StreamObserver<Empty> responseObserver = getResponseObserver();
StreamObserver<PStatMessage> requestObserver = statStub.sendAgentStat(responseObserver);
for (int i = 0; i < count; i++) {
final PAgentStatBatch agentStatBatch = PAgentStatBatch.newBuilder().build();
final PStatMessage statMessage = PStatMessage.newBuilder().setAgentStatBatch(agentStatBatch).build();
requestObserver.onNext(statMessage);
}
requestObserver.onCompleted();
}
use of com.navercorp.pinpoint.grpc.trace.PStatMessage in project pinpoint by naver.
the class StatClientMock method agentStat.
public void agentStat(final int count) {
StreamObserver<Empty> responseObserver = getResponseObserver();
StreamObserver<PStatMessage> requestObserver = statStub.sendAgentStat(responseObserver);
for (int i = 0; i < count; i++) {
final PAgentStat agentStat = PAgentStat.newBuilder().build();
final PStatMessage statMessage = PStatMessage.newBuilder().setAgentStat(agentStat).build();
requestObserver.onNext(statMessage);
}
requestObserver.onCompleted();
}
use of com.navercorp.pinpoint.grpc.trace.PStatMessage 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;
}
Aggregations