Search in sources :

Example 1 with LogRequest

use of com.facebook.buck.distributed.thrift.LogRequest in project buck by facebook.

the class ThriftScribeLogger method sendViaThrift.

private void sendViaThrift(String category, Iterable<String> lines) throws IOException {
    //Prepare log request.
    ScribeData scribeData = new ScribeData();
    scribeData.setCategory(category);
    copyLinesWithoutNulls(lines, scribeData);
    LogRequest logRequest = new LogRequest();
    logRequest.setType(LogRequestType.SCRIBE_DATA);
    logRequest.setScribeData(scribeData);
    // Wrap in high-level request & response.
    FrontendRequest request = new FrontendRequest();
    request.setType(FrontendRequestType.LOG);
    request.setLogRequest(logRequest);
    FrontendResponse response = new FrontendResponse();
    thriftService.makeRequest(request, response);
    if (!response.isWasSuccessful()) {
        throw new IOException(String.format("Log request failed. Error from response: %s", response.getErrorMessage()));
    }
}
Also used : ScribeData(com.facebook.buck.distributed.thrift.ScribeData) LogRequest(com.facebook.buck.distributed.thrift.LogRequest) FrontendResponse(com.facebook.buck.distributed.thrift.FrontendResponse) FrontendRequest(com.facebook.buck.distributed.thrift.FrontendRequest) IOException(java.io.IOException)

Aggregations

FrontendRequest (com.facebook.buck.distributed.thrift.FrontendRequest)1 FrontendResponse (com.facebook.buck.distributed.thrift.FrontendResponse)1 LogRequest (com.facebook.buck.distributed.thrift.LogRequest)1 ScribeData (com.facebook.buck.distributed.thrift.ScribeData)1 IOException (java.io.IOException)1