@Override public void log(LogMessage request, StreamObserver<EmptyMessage> responseObserver) { try { // FIXME put these in Cassandra and render in central UI LogEvent logEvent = request.getLogEvent(); Proto.Throwable t = logEvent.getThrowable(); if (t == null) { logger.warn( "{} -- {} -- {} -- {}", request.getServerId(), logEvent.getLevel(), logEvent.getLoggerName(), logEvent.getFormattedMessage()); } else { logger.warn( "{} -- {} -- {} -- {}\n{}", request.getServerId(), logEvent.getLevel(), logEvent.getLoggerName(), logEvent.getFormattedMessage(), t); } } catch (Throwable t) { responseObserver.onError(t); return; } responseObserver.onNext(EmptyMessage.getDefaultInstance()); responseObserver.onCompleted(); }
@Override public void collectTrace(TraceMessage request, StreamObserver<EmptyMessage> responseObserver) { try { traceRepository.collect(request.getServerId(), request.getTrace()); } catch (Throwable t) { logger.error(t.getMessage(), t); responseObserver.onError(t); return; } responseObserver.onNext(EmptyMessage.getDefaultInstance()); responseObserver.onCompleted(); }
@Override public void collectInit(InitMessage request, StreamObserver<EmptyMessage> responseObserver) { // FIXME store request.getConfig() try { serverRepository.storeProcessInfo(request.getServerId(), request.getProcessInfo()); } catch (Throwable t) { logger.error(t.getMessage(), t); responseObserver.onError(t); return; } responseObserver.onNext(EmptyMessage.getDefaultInstance()); responseObserver.onCompleted(); }
@Override public void collectAggregates( AggregateMessage request, StreamObserver<EmptyMessage> responseObserver) { try { aggregateRepository.store( request.getServerId(), request.getCaptureTime(), request.getAggregatesByTypeList()); } catch (Throwable t) { logger.error(t.getMessage(), t); responseObserver.onError(t); return; } responseObserver.onNext(EmptyMessage.getDefaultInstance()); responseObserver.onCompleted(); }