Exemplo n.º 1
0
  private int processLongCache(
      Machine machine, Transaction transaction, MessageTree tree, int count) {
    long duration = ((Transaction) transaction).getDurationInMillis();

    if (duration > m_defaultCacheThreshold) {
      String type = ProblemType.LONG_CACHE.getName();
      String status = transaction.getName();

      Entry entry = findOrCreateEntry(machine, type, status);
      updateEntry(tree, entry, 0);
      count++;
    }
    return count;
  }
Exemplo n.º 2
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;
  }
Exemplo n.º 3
0
  protected int encodeTransactionLine(
      MessageTree tree, Transaction t, ChannelBuffer buf, Locator locator, Ruler ruler) {
    BufferHelper helper = m_bufferHelper;
    XmlBuilder b = new XmlBuilder();
    int width = 6;
    int height = 18;
    int x = 0;
    int y = locator.getLine() * height + ruler.getOffsetY();
    String tid = "t" + locator.getLine();
    long t0 = tree.getMessage().getTimestamp();
    long t1 = t.getTimestamp();
    int rx = ruler.calcX((t1 - t0) * 1000);
    int rw = ruler.calcWidth(t.getDurationInMicros() * 1000);
    int[] segments = getTransactionDurationSegments(t);

    b.branch(locator, x, y, width, height);
    x += locator.getLevel() * width;

    if (t.getStatus().equals("0")) {
      b.tag1("text", "x", x, "y", y - 5, "font-weight", "bold", "stroke-width", "0");
    } else {
      b.tag1("text", "x", x, "y", y - 5, "font-weight", "bold", "stroke-width", "0", "fill", "red");
    }

    b.add(t.getType()).newLine();
    b.tag(
        "set",
        "attributeName",
        "fill",
        "to",
        "red",
        "begin",
        tid + ".mouseover",
        "end",
        tid + ".mouseout");
    b.tag2("text");

    if (segments == null) {
      String durationInMillis =
          String.format("%.2f %s", t.getDurationInMicros() / 1000.0, t.getName());

      b.tag(
          "rect",
          "x",
          rx + 1,
          "y",
          y - 15,
          "width",
          rw,
          "height",
          height - 2,
          "fill",
          "#0066ff",
          "opacity",
          "0.5");
      b.tagWithText(
          "text",
          durationInMillis,
          "x",
          rx + 5,
          "y",
          y - 3,
          "font-size",
          "11",
          "stroke-width",
          "0");
    } else {
      int index = 0;

      for (int segment : segments) {
        int w = ruler.calcWidth(segment);
        String durationInMillis =
            String.format("%.2f %s", segment / 1000.0 / 1000.0, index == 0 ? t.getName() : "");
        String color = m_colors[index % m_colors.length];

        b.tag(
            "rect",
            "x",
            rx + 1,
            "y",
            y - 15,
            "width",
            w,
            "height",
            height - 2,
            "fill",
            color,
            "opacity",
            "0.5");
        b.tagWithText(
            "text",
            durationInMillis,
            "x",
            rx + 5,
            "y",
            y - 3,
            "font-size",
            "11",
            "stroke-width",
            "0");

        index++;
        rx += w;
      }
    }

    b.tag(
        "rect",
        "id",
        tid,
        "x",
        ruler.getOffsetX() + 1,
        "y",
        y - 15,
        "width",
        ruler.getWidth(),
        "height",
        height,
        "fill",
        "#ffffff",
        "stroke-width",
        "0",
        "opacity",
        "0.01");

    return helper.write(buf, b.getResult().toString());
  }