Example #1
0
 public void createdEvent(QueryInfo queryInfo) {
   eventClient.post(
       new QueryCreatedEvent(
           queryInfo.getQueryId(),
           queryInfo.getSession().getUser(),
           queryInfo.getSession().getSource(),
           environment,
           queryInfo.getSession().getCatalog(),
           queryInfo.getSession().getSchema(),
           queryInfo.getSession().getRemoteUserAddress(),
           queryInfo.getSession().getUserAgent(),
           queryInfo.getSelf(),
           queryInfo.getQuery(),
           queryInfo.getQueryStats().getCreateTime()));
 }
Example #2
0
  public void completionEvent(QueryInfo queryInfo) {
    try {
      QueryStats queryStats = queryInfo.getQueryStats();
      FailureInfo failureInfo = queryInfo.getFailureInfo();

      String failureType = failureInfo == null ? null : failureInfo.getType();
      String failureMessage = failureInfo == null ? null : failureInfo.getMessage();

      eventClient.post(
          new QueryCompletionEvent(
              queryInfo.getQueryId(),
              queryInfo.getSession().getUser(),
              queryInfo.getSession().getSource(),
              environment,
              queryInfo.getSession().getCatalog(),
              queryInfo.getSession().getSchema(),
              queryInfo.getSession().getRemoteUserAddress(),
              queryInfo.getSession().getUserAgent(),
              queryInfo.getState(),
              queryInfo.getSelf(),
              queryInfo.getFieldNames(),
              queryInfo.getQuery(),
              queryStats.getCreateTime(),
              queryStats.getExecutionStartTime(),
              queryStats.getEndTime(),
              queryStats.getQueuedTime(),
              queryStats.getAnalysisTime(),
              queryStats.getDistributedPlanningTime(),
              queryStats.getTotalScheduledTime(),
              queryStats.getTotalCpuTime(),
              queryStats.getRawInputDataSize(),
              queryStats.getRawInputPositions(),
              queryStats.getTotalDrivers(),
              queryInfo.getErrorCode(),
              failureType,
              failureMessage,
              objectMapper.writeValueAsString(queryInfo.getOutputStage()),
              objectMapper.writeValueAsString(queryInfo.getFailureInfo()),
              objectMapper.writeValueAsString(queryInfo.getInputs())));

      logQueryTimeline(queryInfo);
    } catch (JsonProcessingException e) {
      throw Throwables.propagate(e);
    }
  }