コード例 #1
0
 @Override
 public GetMetricsTagsResponse doRequest() throws Exception {
   if (reqdata == null) {
     String uri = httpRequest.getUri();
     reqdata = CommonUtil.getParam(uri, "reqdata", "UTF-8");
     jsonpCallback = CommonUtil.getParam(uri, "callback", "UTF-8");
     isJsonp = true;
   }
   if (reqdata == null) {
     int resultCode = InterfaceConst.ResultCode.INVALID_COMMAND;
     String resultInfo = "Can parse reqdata from request.";
     return generateFailedResponse(resultCode, resultInfo);
   }
   request = GetMetricsTagsRequest.parse(new JSONTokener(reqdata));
   if (!InterfaceConst.commandIsSupported(InterfaceConst.Commands.GET_DATA_POINTS)) {
     int resultCode = InterfaceConst.ResultCode.INVALID_COMMAND;
     String resultInfo = "The command is not supported.";
     return generateFailedResponse(resultCode, resultInfo);
   } else if (!InterfaceConst.commandVersionIsSupported(
       InterfaceConst.Commands.GET_DATA_POINTS, request.getVersion())) {
     int resultCode = InterfaceConst.ResultCode.INVALID_COMMAND_VERSION;
     String resultInfo = "The command version " + request.getVersion() + " is not supported.";
     return generateFailedResponse(resultCode, resultInfo);
   }
   if (isLongTimeRequest()) {
     this.isLongTimeRequest = true;
     return null;
   } else {
     return doRun();
   }
 }
コード例 #2
0
 @Override
 public GetMetricsTagsResponse doRun() throws Exception {
   GetMetricsTagsResponse rt = new GetMetricsTagsResponse();
   MetricsTags.getInstance()
       .findMetricsTags(request.getMetricsQuery(), rt.getTimeSeriesTagsList());
   String remoteIp = CommonUtil.getRemoteIP(httpRequest);
   if (remoteIp == null || remoteIp.isEmpty()) {
     remoteIp = CommonUtil.getRemoteIP(channel);
   }
   rt.setResultCode(InterfaceConst.ResultCode.SUCCESS);
   rt.setResultInfo("success");
   return rt;
 }