Search in sources :

Example 1 with SlowLogResponses

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses in project hbase by apache.

the class HBaseRpcServicesBase method getLogEntries.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public HBaseProtos.LogEntry getLogEntries(RpcController controller, HBaseProtos.LogRequest request) throws ServiceException {
    try {
        final String logClassName = request.getLogClassName();
        Class<?> logClass = Class.forName(logClassName).asSubclass(Message.class);
        Method method = logClass.getMethod("parseFrom", ByteString.class);
        if (logClassName.contains("SlowLogResponseRequest")) {
            SlowLogResponseRequest slowLogResponseRequest = (SlowLogResponseRequest) method.invoke(null, request.getLogMessage());
            final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
            final List<SlowLogPayload> slowLogPayloads = getSlowLogPayloads(slowLogResponseRequest, namedQueueRecorder);
            SlowLogResponses slowLogResponses = SlowLogResponses.newBuilder().addAllSlowLogPayloads(slowLogPayloads).build();
            return HBaseProtos.LogEntry.newBuilder().setLogClassName(slowLogResponses.getClass().getName()).setLogMessage(slowLogResponses.toByteString()).build();
        }
    } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        LOG.error("Error while retrieving log entries.", e);
        throw new ServiceException(e);
    }
    throw new ServiceException("Invalid request params");
}
Also used : SlowLogPayload(org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) SlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponseRequest) ClearSlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponseRequest) ClearSlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses) SlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)1 NamedQueueRecorder (org.apache.hadoop.hbase.namequeues.NamedQueueRecorder)1 ClearSlowLogResponseRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponseRequest)1 ClearSlowLogResponses (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses)1 SlowLogResponseRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponseRequest)1 SlowLogResponses (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses)1 SlowLogPayload (org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1