public Map<String, Long> getCallQueueCountsSummary() { HashMap<String, Long> callQueueMethodTotalCount = new HashMap<>(); for(BlockingQueue<CallRunner> queue: queues) { for (CallRunner cr:queue) { RpcCall rpcCall = cr.getRpcCall(); String method; if (null==rpcCall.getMethod() || StringUtil.isNullOrEmpty(method = rpcCall.getMethod().getName())) { method = "Unknown"; } callQueueMethodTotalCount.put(method, 1+callQueueMethodTotalCount.getOrDefault(method, 0L)); } } return callQueueMethodTotalCount; }
public Map<String, Long> getCallQueueSizeSummary() { HashMap<String, Long> callQueueMethodTotalSize = new HashMap<>(); for(BlockingQueue<CallRunner> queue: queues) { for (CallRunner cr:queue) { RpcCall rpcCall = cr.getRpcCall(); String method; if (null==rpcCall.getMethod() || StringUtil.isNullOrEmpty(method = rpcCall.getMethod().getName())) { method = "Unknown"; } long size = rpcCall.getSize(); callQueueMethodTotalSize.put(method, size+callQueueMethodTotalSize.getOrDefault(method, 0L)); } } return callQueueMethodTotalSize; }
String methodName = (call.getMethod() != null) ? call.getMethod().getName() : ""; String traceString = serviceName + "." + methodName; TraceUtil.createTrace(traceString);
@Override public Message callBlockingMethod(MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, Message param) throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException { com.google.protobuf.Descriptors.MethodDescriptor methodDescriptor = service.getDescriptorForType().findMethodByName(md.getName()); com.google.protobuf.Message request = service.getRequestPrototype(methodDescriptor); // TODO: Convert rpcController com.google.protobuf.Message response = null; try { response = service.callBlockingMethod(methodDescriptor, null, request); } catch (ServiceException e) { throw new org.apache.hbase.thirdparty.com.google.protobuf.ServiceException(e); } return null;// Convert 'response'. }
/** Update call stats for non-critical-path methods */ private void updateRpcGeneric(MethodDescriptor method, CallStats stats) { final String methodName = method.getService().getName() + "_" + method.getName(); getMetric(DRTN_BASE + methodName, rpcTimers, timerFactory) .update(stats.getCallTimeMs(), TimeUnit.MILLISECONDS); getMetric(REQ_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getRequestSizeBytes()); getMetric(RESP_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getResponseSizeBytes()); }
@Override public String toString() { return "callId: " + this.id + " methodName: " + this.md.getName() + " param {" + (this.param != null ? ProtobufUtil.getShortTextFormat(this.param) : "") + "}"; }
switch(method.getIndex()) { case 0: assert "Get".equals(method.getName()); getTracker.updateRpc(stats); return; case 1: assert "Mutate".equals(method.getName()); final MutationType mutationType = ((MutateRequest) param).getMutation().getMutateType(); switch(mutationType) { assert "Scan".equals(method.getName()); scanTracker.updateRpc(stats); return; case 3: assert "BulkLoadHFile".equals(method.getName()); assert "PrepareBulkLoad".equals(method.getName()); assert "CleanupBulkLoad".equals(method.getName()); assert "ExecService".equals(method.getName()); assert "ExecRegionServerService".equals(method.getName()); assert "Multi".equals(method.getName()); multiTracker.updateRpc(stats); return;
static RequestHeader buildRequestHeader(Call call, CellBlockMeta cellBlockMeta) { RequestHeader.Builder builder = RequestHeader.newBuilder(); builder.setCallId(call.id); //TODO handle htrace API change, see HBASE-18895 /*if (call.span != null) { builder.setTraceInfo(RPCTInfo.newBuilder().setParentId(call.span.getSpanId()) .setTraceId(call.span.getTracerId())); }*/ builder.setMethodName(call.md.getName()); builder.setRequestParam(call.param != null); if (cellBlockMeta != null) { builder.setCellBlockMeta(cellBlockMeta); } // Only pass priority if there is one set. if (call.priority != HConstants.PRIORITY_UNSET) { builder.setPriority(call.priority); } builder.setTimeout(call.timeout); return builder.build(); }
private void onCallFinished(Call call, HBaseRpcController hrc, InetSocketAddress addr, RpcCallback<Message> callback) { call.callStats.setCallTimeMs(EnvironmentEdgeManager.currentTime() - call.getStartTime()); if (metrics != null) { metrics.updateRpc(call.md, call.param, call.callStats); } if (LOG.isTraceEnabled()) { LOG.trace( "Call: " + call.md.getName() + ", callTime: " + call.callStats.getCallTimeMs() + "ms"); } if (call.error != null) { if (call.error instanceof RemoteException) { call.error.fillInStackTrace(); hrc.setFailed(call.error); } else { hrc.setFailed(wrapException(addr, call.error)); } callback.run(null); } else { hrc.setDone(call.cells); callback.run(call.response); } }
@Override public String toString() { return "callId: " + this.id + " methodName: " + this.md.getName() + " param {" + (this.param != null ? ProtobufUtil.getShortTextFormat(this.param) : "") + "}"; }
/** Update call stats for non-critical-path methods */ private void updateRpcGeneric(MethodDescriptor method, CallStats stats) { final String methodName = method.getService().getName() + "_" + method.getName(); getMetric(DRTN_BASE + methodName, rpcTimers, timerFactory) .update(stats.getCallTimeMs(), TimeUnit.MILLISECONDS); getMetric(REQ_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getRequestSizeBytes()); getMetric(RESP_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getResponseSizeBytes()); }
MethodDescriptor md = call.getMethod(); Message param = call.getParam(); status.setRPC(md.getName(), new Object[]{param}, call.getReceiveTime()); md.getName(), md.getName() + "(" + param.getClass().getName() + ")", (tooLarge ? "TooLarge" : "TooSlow"), status.getClient(), startTime, processingTime, qTime,
switch(method.getIndex()) { case 0: assert "Get".equals(method.getName()); getTracker.updateRpc(stats); return; case 1: assert "Mutate".equals(method.getName()); final MutationType mutationType = ((MutateRequest) param).getMutation().getMutateType(); switch(mutationType) { assert "Scan".equals(method.getName()); scanTracker.updateRpc(stats); return; case 3: assert "BulkLoadHFile".equals(method.getName()); assert "PrepareBulkLoad".equals(method.getName()); assert "CleanupBulkLoad".equals(method.getName()); assert "ExecService".equals(method.getName()); assert "ExecRegionServerService".equals(method.getName()); assert "Multi".equals(method.getName()); numActionsPerServerHist.update(stats.getNumActionsPerServer()); multiTracker.updateRpc(stats);
private void onCallFinished(Call call, HBaseRpcController hrc, InetSocketAddress addr, RpcCallback<Message> callback) { call.callStats.setCallTimeMs(EnvironmentEdgeManager.currentTime() - call.getStartTime()); if (metrics != null) { metrics.updateRpc(call.md, call.param, call.callStats); } if (LOG.isTraceEnabled()) { LOG.trace( "Call: " + call.md.getName() + ", callTime: " + call.callStats.getCallTimeMs() + "ms"); } if (call.error != null) { if (call.error instanceof RemoteException) { call.error.fillInStackTrace(); hrc.setFailed(call.error); } else { hrc.setFailed(wrapException(addr, call.error)); } callback.run(null); } else { hrc.setDone(call.cells); callback.run(call.response); } }
@Override public Message callBlockingMethod(MethodDescriptor md, org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, Message param) throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException { com.google.protobuf.Descriptors.MethodDescriptor methodDescriptor = service.getDescriptorForType().findMethodByName(md.getName()); com.google.protobuf.Message request = service.getRequestPrototype(methodDescriptor); // TODO: Convert rpcController com.google.protobuf.Message response = null; try { response = service.callBlockingMethod(methodDescriptor, null, request); } catch (ServiceException e) { throw new org.apache.hbase.thirdparty.com.google.protobuf.ServiceException(e); } return null;// Convert 'response'. }
static RequestHeader buildRequestHeader(Call call, CellBlockMeta cellBlockMeta) { RequestHeader.Builder builder = RequestHeader.newBuilder(); builder.setCallId(call.id); //TODO handle htrace API change, see HBASE-18895 /*if (call.span != null) { builder.setTraceInfo(RPCTInfo.newBuilder().setParentId(call.span.getSpanId()) .setTraceId(call.span.getTracerId())); }*/ builder.setMethodName(call.md.getName()); builder.setRequestParam(call.param != null); if (cellBlockMeta != null) { builder.setCellBlockMeta(cellBlockMeta); } // Only pass priority if there is one set. if (call.priority != HConstants.PRIORITY_UNSET) { builder.setPriority(call.priority); } builder.setTimeout(call.timeout); return builder.build(); }
@Override public String toString() { return "callId: " + this.id + " methodName: " + this.md.getName() + " param {" + (this.param != null ? ProtobufUtil.getShortTextFormat(this.param) : "") + "}"; }
@Override public String toShortString() { String serviceName = this.connection.service != null ? this.connection.service.getDescriptorForType().getName() : "null"; return "callId: " + this.id + " service: " + serviceName + " methodName: " + ((this.md != null) ? this.md.getName() : "n/a") + " size: " + StringUtils.TraditionalBinaryPrefix.long2String(this.size, "", 1) + " connection: " + connection.toString() + " deadline: " + deadline; }
/** Update call stats for non-critical-path methods */ private void updateRpcGeneric(MethodDescriptor method, CallStats stats) { final String methodName = method.getService().getName() + "_" + method.getName(); getMetric(DRTN_BASE + methodName, rpcTimers, timerFactory) .update(stats.getCallTimeMs(), TimeUnit.MILLISECONDS); getMetric(REQ_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getRequestSizeBytes()); getMetric(RESP_BASE + methodName, rpcHistograms, histogramFactory) .update(stats.getResponseSizeBytes()); }
protected String getCallMethod(final CallRunner task) { RpcCall call = task.getRpcCall(); if (call != null && call.getMethod() != null) { return call.getMethod().getName(); } return null; } }