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

Examples of com.dianping.cat.consumer.event.model.entity.EventName


        long[] typeCounts = new long[60];
        long[] typeFails = new long[60];

        Map<String, EventName> names = eventType.getNames();
        for (Entry<String, EventName> nameEntry : names.entrySet()) {
          EventName eventName = nameEntry.getValue();
          List<Range> ranges = new ArrayList<Range>(eventName.getRanges().values());
          detailBuilder.append(eventType.getId());
          detailBuilder.append('\t');
          detailBuilder.append(eventName.getId());
          detailBuilder.append('\t');

          long[] totalCount = getTotalCount(ranges);
          detailBuilder.append(arrayToString(totalCount));
          detailBuilder.append('\t');
          long[] failCount = getFailsCount(ranges);
          detailBuilder.append(arrayToString(failCount));
          detailBuilder.append('\n');

          String key = eventType.getId() + "\t" + eventName.getId();
          GraphLine detailLine = allDetailCache.get(key);
          if (detailLine == null) {
            detailLine = new GraphLine();
            allDetailCache.put(key, detailLine);
          }
View Full Code Here


  }

  private void processEvent(EventReport report, MessageTree tree, Event event) {
    String ip = tree.getIpAddress();
    EventType type = report.findOrCreateMachine(ip).findOrCreateType(event.getType());
    EventName name = type.findOrCreateName(event.getName());
    String messageId = tree.getMessageId();

    report.addIp(tree.getIpAddress());
    type.incTotalCount();
    name.incTotalCount();

    if (event.isSuccess()) {
      if (type.getSuccessMessageUrl() == null) {
        type.setSuccessMessageUrl(messageId);
      }

      if (name.getSuccessMessageUrl() == null) {
        name.setSuccessMessageUrl(messageId);
      }
    } else {
      type.incFailCount();
      name.incFailCount();

      if (type.getFailMessageUrl() == null) {
        type.setFailMessageUrl(messageId);
      }

      if (name.getFailMessageUrl() == null) {
        name.setFailMessageUrl(messageId);
      }
    }
    type.setFailPercent(type.getFailCount() * 100.0 / type.getTotalCount());
    name.setFailPercent(name.getFailCount() * 100.0 / name.getTotalCount());

    processEventGrpah(name, event);
  }
View Full Code Here

      for (int i = 0; i < m_maxItems; i++) {
        type.addName(all.get(i));
      }

      EventName other = type.findOrCreateName("OTHERS");

      for (int i = m_maxItems; i < size; i++) {
        mergeName(other, all.get(i));
      }

      List<String> toRemove = new ArrayList<String>();

      eventNames = type.getNames();
      for (Entry<String, EventName> entry : type.getNames().entrySet()) {
        EventName tansactionName = entry.getValue();

        if (tansactionName.getTotalCount() == 1) {
          toRemove.add(entry.getKey());
          mergeName(other, tansactionName);
        }
      }
View Full Code Here

        }
      } else if (!StringUtils.isEmpty(name) && !StringUtils.isEmpty(type)) {
        EventType eventType = eventMachine.findType(type);

        if (eventType != null) {
          EventName eventName = eventType.findName(name);

          if (eventName != null) {
            data.put(COUNT, String.valueOf(eventName.getTotalCount()));
            data.put(FAILURE_COUNT, String.valueOf(eventName.getFailCount()));
          }
        }
      }
    }
  }
View Full Code Here

  private List<EventNameModel> m_results = new ArrayList<EventNameModel>();

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

      if (names != null) {
        for (Entry<String, EventName> entry : names.getNames().entrySet()) {
          m_results.add(new EventNameModel(entry.getKey(), entry.getValue()));
          mergeName(all, entry.getValue());
        }
      }
    }
    if (sorted == null) {
      sorted = "avg";
    }
    Collections.sort(m_results, new EventComparator(sorted));

    long total = all.getTotalCount();
    for (EventNameModel nameModel : m_results) {
      EventName eventName = nameModel.getDetail();
      eventName.setTotalPercent(eventName.getTotalCount() / (double) total);
    }
    m_results.add(0, new EventNameModel("TOTAL", all));
    return this;
  }
View Full Code Here

    }
  }

  private void buildEventNameGraph(Model model, EventReport report, String type, String name, String ip) {
    EventType t = report.findOrCreateMachine(ip).findOrCreateType(type);
    EventName eventName = t.findOrCreateName(name);
    transformTo60MinuteData(eventName);

    if (eventName != null) {
      String graph1 = m_builder.build(new HitPayload("Hits Over Time", "Time (min)", "Count", eventName));
      String graph2 = m_builder.build(new FailurePayload("Failures Over Time", "Time (min)", "Count", eventName));
View Full Code Here

    List<Item> items = new ArrayList<Item>();

    for (int i = 1; i < names.size(); i++) {
      EventNameModel name = names.get(i);
      Item item = new Item();
      EventName event = name.getDetail();
      item.setNumber(event.getTotalCount()).setTitle(event.getId());
      items.add(item);
    }

    chart.addItems(items);
    model.setPieChart(new JsonBuilder().toJson(chart));
View Full Code Here

        String method = "";

        if (arrays.length > 1) {
          method = arrays[1];
        }
        EventName eventName = new EventName();
        if (method.equals("get")) {
          eventName = eventType.findOrCreateName(categroy + ":missed");
        }
        m_cacheReport.addNewNameItem(transactionName, eventName);
      }
View Full Code Here

  }

  @Override
  public void visitName(EventName name) {
    m_currentName = name.getId();
    EventName temp = m_report.findOrCreateMachine(m_currentIp).findOrCreateType(m_currentType)
          .findOrCreateName(m_currentName);

    m_merger.mergeName(temp, name);

    EventName all = m_report.findOrCreateMachine(m_currentIp).findOrCreateType(m_currentType)
          .findOrCreateName(Constants.ALL);
    m_merger.mergeName(all, name);

    m_merger.mergeName(temp, name);
    super.visitName(name);
View Full Code Here

  }

  @Override
  public void visitName(EventName name) {
    m_currentName = name.getId();
    EventName temp = m_report.findOrCreateMachine(Constants.ALL).findOrCreateType(m_currentType)
          .findOrCreateName(m_currentName);

    m_merger.mergeName(temp, name);
    super.visitName(name);
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.event.model.entity.EventName

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.