Ejemplo n.º 1
0
  private int processLongSql(
      Machine machine, Transaction transaction, MessageTree tree, int count) {
    long duration = transaction.getDurationInMillis();
    String domain = tree.getDomain();

    long nomarizeDuration =
        computeLongDuration(duration, domain, m_defaultLongSqlDuration, m_longSqlThresholds);
    if (nomarizeDuration > 0) {
      String type = ProblemType.LONG_SQL.getName();
      String status = transaction.getName();

      Entry entry = findOrCreateEntry(machine, type, status);
      updateEntry(tree, entry, (int) nomarizeDuration);
      count++;
    }
    return count;
  }
Ejemplo n.º 2
0
  protected int encodeMessage(
      MessageTree tree, Message message, ChannelBuffer buf, int level, LineCounter counter) {
    if (message instanceof Transaction) {
      Transaction transaction = (Transaction) message;
      List<Message> children = transaction.getChildren();

      if (children.isEmpty()) {
        if (transaction.getDurationInMillis() < 0) {
          return encodeLine(tree, transaction, buf, 't', Policy.WITHOUT_STATUS, level, counter);
        } else {
          return encodeLine(tree, transaction, buf, 'A', Policy.WITH_DURATION, level, counter);
        }
      } else {
        int count = 0;

        count += encodeLine(tree, transaction, buf, 't', Policy.WITHOUT_STATUS, level, counter);

        for (Message child : children) {
          count += encodeMessage(tree, child, buf, level + 1, counter);
        }

        count += encodeLine(tree, transaction, buf, 'T', Policy.WITH_DURATION, level, counter);

        return count;
      }
    } else if (message instanceof Event) {
      String type = message.getType();

      if ("RemoteCall".equals(type)) {
        return encodeLogViewLink(tree, message, buf, level, counter);
      } else {
        return encodeLine(tree, message, buf, 'E', Policy.DEFAULT, level, counter);
      }
    } else if (message instanceof Metric) {
      return encodeLine(tree, message, buf, 'M', Policy.DEFAULT, level, counter);
    } else if (message instanceof Heartbeat) {
      return encodeLine(tree, message, buf, 'H', Policy.DEFAULT, level, counter);
    } else {
      throw new RuntimeException(
          String.format("Unsupported message type: %s.", message.getClass()));
    }
  }