Package com.dianping.cat.home.dependency.graph.entity

Examples of com.dianping.cat.home.dependency.graph.entity.TopologyGraph


    Map<Long, TopologyGraph> graphs = m_graphBuilder.getGraphs();
    for (Entry<Long, TopologyGraph> entry : graphs.entrySet()) {
      try {
        Date date = new Date(entry.getKey());
        TopologyGraph graph = entry.getValue();

        com.dianping.cat.home.dal.report.TopologyGraph proto = m_topologyGraphDao.createLocal();
        String ip = NetworkInterfaceManager.INSTANCE.getLocalHostAddress();

        proto.setType(3);
View Full Code Here


    return m_itemBuilder.createNode(domain);
  }

  private TopologyGraph findOrCreateGraph() {
    long time = m_date.getTime() + m_minute * TimeHelper.ONE_MINUTE;
    TopologyGraph graph = m_graphs.get(time);

    if (graph == null) {
      graph = new TopologyGraph();
      m_graphs.put(time, graph);
    }

    return graph;
  }
View Full Code Here

  public void visitDependency(Dependency dependency) {
    String type = dependency.getType();
   
    if (!m_pigeonServices.contains(type)) {
      TopologyEdge edge = m_itemBuilder.buildEdge(m_domain, dependency);
      TopologyGraph graph = findOrCreateGraph();
      TopologyEdge old = graph.findTopologyEdge(edge.getKey());

      graph.getEdges().put(edge.getKey(), mergeEdge(old, edge));
      if ("Database".equals(type)) {
        String target = dependency.getTarget();
        TopologyNode nodeOld = graph.findTopologyNode(target);

        graph.getNodes().put(target, mergeNode(nodeOld, m_itemBuilder.createDatabaseNode(target)));
      } else if ("Cache".equals(type)) {
        String target = dependency.getTarget();
        TopologyNode nodeOld = graph.findTopologyNode(target);

        graph.getNodes().put(target, mergeNode(nodeOld, m_itemBuilder.createCacheNode(target)));
      }
    }
  }
View Full Code Here

    super.visitDependencyReport(dependencyReport);
  }

  @Override
  public void visitIndex(Index index) {
    TopologyGraph graph = findOrCreateGraph();
    TopologyNode node = m_itemBuilder.buildNode(m_domain, index);
    TopologyNode old = graph.findTopologyNode(node.getId());

    graph.getNodes().put(node.getId(), mergeNode(old, node));
  }
View Full Code Here

  private Logger m_logger;

  private static final String DEPENDENCY = "Dependency";

  public ProductLinesDashboard buildDependencyDashboard(long time) {
    TopologyGraph topologyGraph = queryTopologyGraph(time);
    ProductLinesDashboard dashboardGraph = new ProductLinesDashboard();
    Set<String> allDomains = new HashSet<String>();

    if (topologyGraph != null) {
      Map<String, ProductLine> groups = m_productLineConfigManger.queryAllProductLines();

      for (Entry<String, ProductLine> entry : groups.entrySet()) {
        String realName = entry.getValue().getTitle();
        boolean isDashboard = entry.getValue().getDashboard();

        if (isDashboard) {
          Map<String, Domain> domains = entry.getValue().getDomains();
          for (Domain domain : domains.values()) {
            String nodeName = domain.getId();
            TopologyNode node = topologyGraph.findTopologyNode(nodeName);

            allDomains.add(nodeName);
            if (node != null) {
              dashboardGraph.addNode(realName, m_graphBuilder.cloneNode(node));
            }
          }
        }
      }
      Map<String, TopologyEdge> edges = topologyGraph.getEdges();

      for (TopologyEdge edge : edges.values()) {
        String self = edge.getSelf();
        String to = edge.getTarget();
View Full Code Here

    }
    return dashboardGraph;
  }

  public TopologyGraph buildTopologyGraph(String domain, long time) {
    TopologyGraph all = queryTopologyGraph(time);
    TopologyGraph topylogyGraph = new TopologyGraph();

    topylogyGraph.setId(domain);
    topylogyGraph.setType(GraphConstrant.PROJECT);
    topylogyGraph.setStatus(GraphConstrant.OK);

    if (all != null) {
      TopologyNode node = all.findTopologyNode(domain);

      if (node != null) {
        topylogyGraph.setDes(node.getDes());
        topylogyGraph.setStatus(node.getStatus());
        topylogyGraph.setType(node.getType());
      }
      Collection<TopologyEdge> edges = all.getEdges().values();

      for (TopologyEdge edge : edges) {
        String self = edge.getSelf();
        String target = edge.getTarget();
        TopologyEdge cloneEdge = m_graphBuilder.cloneEdge(edge);

        if (self.equals(domain)) {
          TopologyNode other = all.findTopologyNode(target);

          if (other != null) {
            topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
          } else {
            topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
          }
          edge.setOpposite(false);
          topylogyGraph.addTopologyEdge(cloneEdge);
        } else if (target.equals(domain)) {
          TopologyNode other = all.findTopologyNode(self);

          if (other != null) {
            topylogyGraph.addTopologyNode(m_graphBuilder.cloneNode(other));
          } else {
            topylogyGraph.addTopologyNode(m_graphBuilder.createNode(target));
          }
          cloneEdge.setTarget(edge.getSelf());
          cloneEdge.setSelf(edge.getTarget());
          cloneEdge.setOpposite(true);
          topylogyGraph.addTopologyEdge(cloneEdge);
        }
      }
    }
    return topylogyGraph;
  }
View Full Code Here

    }
    return null;
  }

  private TopologyGraph queryGraphFromMemory(long time) {
    TopologyGraph graph = m_topologyGraphs.get(time);
    long current = System.currentTimeMillis();
    long minute = current - current % TimeHelper.ONE_MINUTE;

    if ((minute - time) <= 3 * TimeHelper.ONE_MINUTE && graph == null) {
      graph = m_topologyGraphs.get(time - TimeHelper.ONE_MINUTE);
View Full Code Here

  public void build(String date) throws Exception {
    TopologyGraphManager manager = lookup(TopologyGraphManager.class);
    SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    try {
        TopologyGraph graph = manager.queryGraphFromDB(formate.parse(date).getTime());

        if (graph != null) {
          File file = new File("/tmp/" + date + ".txt");

          if (!file.exists()) {
            file.createNewFile();
          }
          Files.forIO().writeTo(file, graph.toString());
        }else{
          System.err.println(date+" is null1");
        }
      } catch (Exception e) {
        System.err.println(date+" is null1");
View Full Code Here

    alertSummary.addCategory(generateCategoryByTimeCategory(date, AlertType.Network.getName()));
    alertSummary.addCategory(generateCategoryByTimeCateDomain(date, AlertType.Business.getName(), domain));
    alertSummary.addCategory(generateCategoryByTimeCateDomain(date, AlertType.Exception.getName(), domain));
    alertSummary.addCategory(generateCategoryByTimeCateDomain(date, AlertType.System.getName(), domain));

    TopologyGraph topology = m_topologyManager.buildTopologyGraph(domain, date.getTime());
    int statusThreshold = 2;

    alertSummary.addCategory(generateLongCallCategory(date, topology, statusThreshold));

    List<String> dependencyDomains = queryDependencyDomains(topology, date, domain);
View Full Code Here

    }
    return result;
  }

  private void buildProjectTopology(Model model, Payload payload, Date reportTime) {
    TopologyGraph topologyGraph = m_graphManager.buildTopologyGraph(model.getDomain(), reportTime.getTime());
    Map<String, List<String>> graphDependency = parseDependencies(topologyGraph);
    Map<String, List<Event>> externalErrors = m_externalInfoBuilder.queryDependencyEvent(graphDependency,
          model.getDomain(), reportTime);

    DependencyReport report = queryDependencyReport(payload);
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.dependency.graph.entity.TopologyGraph

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.