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

Examples of com.dianping.cat.consumer.dependency.model.entity.Dependency


  private void updateDependencyInfo(DependencyReport report, Transaction t, String target, String type) {
    long current = t.getTimestamp() / 1000 / 60;
    int min = (int) (current % (60));
    Segment segment = report.findOrCreateSegment(min);
    Dependency dependency = segment.findOrCreateDependency(type + ":" + target);

    dependency.setType(type);
    dependency.setTarget(target);

    if (!t.getStatus().equals(Transaction.SUCCESS)) {
      dependency.incErrorCount();
    }
    dependency.incTotalCount();
    dependency.setSum(dependency.getSum() + t.getDurationInMillis());
    dependency.setAvg(dependency.getSum() / dependency.getTotalCount());
  }
View Full Code Here


    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
  }
 
  @Test
  public void testBuildEdgeStateByDefault(){
    Dependency index = new Dependency();
    String service = "TuanGouService";
    index.setType("PigeonCall");
    String domain = "cat";
    index.setTarget(service);
    index.setAvg(40.0);
    index.setErrorCount(50);
    index.setSum(1000.0);
    index.setTotalCount(100);
   
    Pair<Integer, String> state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.OK, (int)state.getKey());
   
    index.setErrorCount(100);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.WARN, (int)state.getKey());

    index.setErrorCount(200);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
  }
View Full Code Here

  }
 

  @Test
  public void testBuildEdgeStateByConfig(){
    Dependency index = new Dependency();
    String domain = "cat";
    String service = "UserService";
    index.setType("PigeonCall");
    index.setTarget(service);
    index.setAvg(9.0);
    index.setErrorCount(9);
    index.setSum(1000.0);
    index.setTotalCount(100);
   
    Pair<Integer, String> state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.OK, (int)state.getKey());
   
    index.setAvg(10.0);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.WARN, (int)state.getKey());

    index.setAvg(100.0);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
  }
View Full Code Here

    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
  }
 
  @Test
  public void testBuildEdgeStateByProjectConfig(){
    Dependency index = new Dependency();
    String domain = "UserWeb";
    String service = "UserService";
    index.setType("PigeonCall");
    index.setTarget(service);
    index.setAvg(9.0);
    index.setErrorCount(9);
    index.setSum(1000.0);
    index.setTotalCount(100);
   
    Pair<Integer, String> state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.OK, (int)state.getKey());
   
    index.setAvg(10.0);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.WARN, (int)state.getKey());

    index.setAvg(20.0);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
   
    index.setAvg(9.0);
   
   
    index.setErrorCount(10);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.WARN, (int)state.getKey());

    index.setErrorCount(20);
    state = m_manager.buildEdgeState(domain, index);
    Assert.assertEquals(GraphConstrant.ERROR, (int)state.getKey());
  }
View Full Code Here

      for (Index index : indexs.values()) {
        Index temp = result.findOrCreateIndex(index.getName());
        merger.mergeIndex(temp, index);
      }
      for (Dependency dependency : dependencies.values()) {
        Dependency temp = result.findOrCreateDependency(dependency.getKey());

        merger.mergeDependency(temp, dependency);
      }
    }
    return result;
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.dependency.model.entity.Dependency

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.