Package com.dianping.cat.consumer.transaction.model.entity

Examples of com.dianping.cat.consumer.transaction.model.entity.TransactionType


      Machine machine = report.findOrCreateMachine(ip);
      Map<String, TransactionType> types = machine.getTypes();
      StringBuilder detailBuilder = new StringBuilder();
      StringBuilder summaryBuilder = new StringBuilder();
      for (Entry<String, TransactionType> transactionEntry : types.entrySet()) {
        TransactionType transactionType = transactionEntry.getValue();
        long[] typeCounts = new long[60];
        long[] typeFails = new long[60];
        double[] typeSums = new double[60];

        Map<String, TransactionName> names = transactionType.getNames();
        for (Entry<String, TransactionName> nameEntry : names.entrySet()) {
          TransactionName transactionName = nameEntry.getValue();
          List<Range> ranges = new ArrayList<Range>(transactionName.getRanges().values());

          detailBuilder.append(transactionType.getId());
          detailBuilder.append('\t');
          detailBuilder.append(transactionName.getId());
          detailBuilder.append('\t');
          long[] totalCount = getTotalCount(ranges);
          detailBuilder.append(arrayToString(totalCount));
          detailBuilder.append('\t');
          long[] failsCount = getFailsCount(ranges);
          detailBuilder.append(arrayToString(failsCount));
          detailBuilder.append('\t');
          detailBuilder.append(transactionName.getMin());
          detailBuilder.append('\t');
          detailBuilder.append(transactionName.getMax());
          detailBuilder.append('\t');
          double[] sumCount = getSumCount(ranges);
          detailBuilder.append(arrayToString(sumCount));
          detailBuilder.append('\t');
          detailBuilder.append(transactionName.getSum2());
          detailBuilder.append('\n');

          String key = transactionType.getId() + "\t" + transactionName.getId();
          GraphLine detailLine = allDetailCache.get(key);
          if (detailLine == null) {
            detailLine = new GraphLine();
            allDetailCache.put(key, detailLine);
          }

          detailLine.totalCounts = arrayAdd(detailLine.totalCounts, totalCount);
          detailLine.failCounts = arrayAdd(detailLine.failCounts, failsCount);
          detailLine.min += transactionName.getMin();
          detailLine.max += transactionName.getMax();
          detailLine.sums = arrayAdd(detailLine.sums, sumCount);
          detailLine.sum2 += transactionName.getSum2();

          typeCounts = arrayAdd(typeCounts, totalCount);
          typeFails = arrayAdd(typeFails, failsCount);
          typeSums = arrayAdd(typeSums, sumCount);
        }
        summaryBuilder.append(transactionType.getId());
        summaryBuilder.append('\t');
        summaryBuilder.append(arrayToString(typeCounts));
        summaryBuilder.append('\t');
        summaryBuilder.append(arrayToString(typeFails));
        summaryBuilder.append('\t');
        summaryBuilder.append(transactionType.getMin());
        summaryBuilder.append('\t');
        summaryBuilder.append(transactionType.getMax());
        summaryBuilder.append('\t');
        summaryBuilder.append(arrayToString(typeSums));
        summaryBuilder.append('\t');
        summaryBuilder.append(transactionType.getSum2());
        summaryBuilder.append('\n');

        String summaryKey = transactionType.getId();
        GraphLine summaryLine = allSummaryCache.get(summaryKey);
        if (summaryLine == null) {
          summaryLine = new GraphLine();
          allSummaryCache.put(summaryKey, summaryLine);
        }

        summaryLine.totalCounts = arrayAdd(summaryLine.totalCounts, typeCounts);
        summaryLine.failCounts = arrayAdd(summaryLine.failCounts, typeFails);
        summaryLine.min += transactionType.getMin();
        summaryLine.max += transactionType.getMax();
        summaryLine.sums = arrayAdd(summaryLine.sums, typeSums);
        summaryLine.sum2 += transactionType.getSum2();
      }
      graph.setDetailContent(detailBuilder.toString());
      graph.setSummaryContent(summaryBuilder.toString());
      graphs.add(graph);
    }
View Full Code Here


  }

  @Override
  public void visitName(TransactionName name) {
    Machine machine = m_report.findOrCreateMachine(m_currentDomain);
    TransactionType curentType = machine.findOrCreateType(m_currentType);
    TransactionName currentName = curentType.findOrCreateName(name.getId());
   
    mergeName(currentName, name);
  }
View Full Code Here

  @Override
  public void visitType(TransactionType type) {
    Machine machine = m_report.findOrCreateMachine(m_currentDomain);
    String typeName = type.getId();
    TransactionType result = machine.findOrCreateType(typeName);

    m_currentType = typeName;
    mergeType(result, type);

    if (typeName.startsWith("Cache.")) {
View Full Code Here

          data.put(id + TIME, m_format.format(transactionType.getAvg()));
          data.put(id + COUNT, String.valueOf(transactionType.getTotalCount()));
          data.put(id + FAILURE_COUNT, String.valueOf(transactionType.getFailCount()));
        }
      } else if (StringUtils.isEmpty(name) && !StringUtils.isEmpty(type)) {
        TransactionType transactionType = transactionMachine.findType(type);

        if (transactionType != null) {
          data.put(TIME, m_format.format(transactionType.getAvg()));
          data.put(COUNT, String.valueOf(transactionType.getTotalCount()));
          data.put(FAILURE_COUNT, String.valueOf(transactionType.getFailCount()));

          for (TransactionName transactionName : transactionType.getNames().values()) {
            String id = transactionName.getId();
            data.put(id + TIME, m_format.format(transactionName.getAvg()));
            data.put(id + COUNT, String.valueOf(transactionName.getTotalCount()));
            data.put(id + FAILURE_COUNT, String.valueOf(transactionName.getFailCount()));
          }
        }
      } else if (!StringUtils.isEmpty(name) && !StringUtils.isEmpty(type)) {
        TransactionType transactionType = transactionMachine.findType(type);

        if (transactionType != null) {
          TransactionName transactionName = transactionType.findName(name);

          if (transactionName != null) {
            data.put(TIME, m_format.format(transactionName.getAvg()));
            data.put(COUNT, String.valueOf(transactionName.getTotalCount()));
            data.put(FAILURE_COUNT, String.valueOf(transactionName.getFailCount()));
View Full Code Here

    } else {
      Pair<Boolean, Long> pair = checkForTruncatedMessage(tree, t);

      if (pair.getKey().booleanValue()) {
        String ip = tree.getIpAddress();
        TransactionType type = report.findOrCreateMachine(ip).findOrCreateType(t.getType());
        TransactionName name = type.findOrCreateName(t.getName());
        String messageId = tree.getMessageId();
       
        processTypeAndName(t, type, name, messageId, pair.getValue().doubleValue() / 1000d);
      }
View Full Code Here

      model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, report));
    }
  }

  private void buildTransactionNameGraph(Model model, TransactionReport report, String type, String name, String ip) {
    TransactionType t = report.findOrCreateMachine(ip).findOrCreateType(type);
    TransactionName transactionName = t.findOrCreateName(name);
    transformTo60MinuteData(transactionName);

    if (transactionName != null) {
      String graph1 = m_builder.build(new DurationPayload("Duration Distribution", "Duration (ms)", "Count",
            transactionName));
View Full Code Here

  }

  @Override
  public void visitType(TransactionType type) {
    m_currentType = type.getId();
    TransactionType temp = m_report.findOrCreateMachine(m_currentIp).findOrCreateType(m_currentType);

    m_merger.mergeType(temp, type);
    super.visitType(type);
  }
View Full Code Here

  }

  @Override
  public void visitType(TransactionType type) {
    m_currentType = type.getId();
    TransactionType temp = m_report.findOrCreateMachine(Constants.ALL).findOrCreateType(m_currentType);

    m_merger.mergeType(temp, type);
    super.visitType(type);
  }
View Full Code Here

  public DisplayNames display(String sorted, String type, String ip, TransactionReport report, String queryName) {
    Map<String, TransactionType> types = report.findOrCreateMachine(ip).getTypes();
    TransactionName all = new TransactionName("TOTAL");
    all.setTotalPercent(1);
    if (types != null) {
      TransactionType names = types.get(type);

      if (names != null) {
        for (Entry<String, TransactionName> entry : names.getNames().entrySet()) {
          String transTypeName = entry.getValue().getId();
          boolean isAdd = (queryName == null || queryName.length() == 0 || isFit(queryName, transTypeName));
          if (isAdd) {
            m_results.add(new TransactionNameModel(entry.getKey(), entry.getValue()));
            mergeName(all, entry.getValue());
View Full Code Here

  @Test
  public void whether_url_has_max_names() throws Exception {
    String source = Files.forIO().readFrom(getClass().getResourceAsStream("transaction_report_filter.xml"), "utf-8");
    TransactionReport report = DefaultSaxParser.parse(source);

    TransactionType type = report.findMachine("10.1.77.193").findType("URL");

    for (int i = 0; i < 3500; i++) {
      type.addName(new TransactionName("Test" + i));
    }

    TransactionReportCountFilter f1 = new TransactionReportCountFilter();
    String filterReport = f1.buildXml(report);
    TransactionReport newReport = DefaultSaxParser.parse(filterReport);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.transaction.model.entity.TransactionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.