Search in sources :

Example 1 with TFActiveTraceHistogram

use of com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram in project pinpoint by naver.

the class TFActiveTraceMapper method map.

public TFActiveTrace map(ActiveTraceBo activeTraceBo) {
    TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
    tFActiveTraceHistogram.setVersion(activeTraceBo.getVersion());
    tFActiveTraceHistogram.setHistogramSchemaType(activeTraceBo.getHistogramSchemaType());
    tFActiveTraceHistogram.setActiveTraceCount(createActiveTraceCount(activeTraceBo.getActiveTraceHistogram()));
    TFActiveTrace tFActiveTrace = new TFActiveTrace();
    tFActiveTrace.setHistogram(tFActiveTraceHistogram);
    return tFActiveTrace;
}
Also used : TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace)

Example 2 with TFActiveTraceHistogram

use of com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram in project pinpoint by naver.

the class TFAgentStatMapperTest method map4Test.

@Test
public void map4Test() {
    AgentStatBo agentStatBo = createActiveTraceBoList();
    List<TFAgentStat> tFAgentStatList = newAgentStatMapper().map(agentStatBo);
    assertEquals(2, tFAgentStatList.size());
    TFAgentStat tFAgentStat1 = tFAgentStatList.get(0);
    assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT);
    assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp);
    assertEquals(tFAgentStat1.getTimestamp(), collectTime1st);
    TFActiveTrace activeTrace1 = tFAgentStat1.getActiveTrace();
    TFActiveTraceHistogram histogram1 = activeTrace1.getHistogram();
    List<Integer> activeTraceCount1 = histogram1.getActiveTraceCount();
    assertEquals((int) activeTraceCount1.get(0), 30);
    assertEquals((int) activeTraceCount1.get(1), 40);
    assertEquals((int) activeTraceCount1.get(2), 10);
    assertEquals((int) activeTraceCount1.get(3), 50);
    TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
    assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT);
    assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp);
    assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd);
    TFActiveTrace activeTrace2 = tFAgentStat2.getActiveTrace();
    TFActiveTraceHistogram histogram2 = activeTrace2.getHistogram();
    List<Integer> activeTraceCount2 = histogram2.getActiveTraceCount();
    assertEquals((int) activeTraceCount2.get(0), 31);
    assertEquals((int) activeTraceCount2.get(1), 41);
    assertEquals((int) activeTraceCount2.get(2), 11);
    assertEquals((int) activeTraceCount2.get(3), 51);
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 3 with TFActiveTraceHistogram

use of com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram in project pinpoint by naver.

the class TFActiveTraceMapperTest method mapTest.

@Test
public void mapTest() {
    ActiveTraceBo activeTraceBo = new ActiveTraceBo();
    activeTraceBo.setAgentId(TEST_AGENT);
    activeTraceBo.setVersion((short) 1);
    activeTraceBo.setStartTimestamp(startTimestamp);
    activeTraceBo.setTimestamp(timestamp);
    activeTraceBo.setHistogramSchemaType(1);
    ActiveTraceHistogram activeTraceHistogram = new ActiveTraceHistogram(30, 40, 10, 50);
    activeTraceBo.setActiveTraceHistogram(activeTraceHistogram);
    TFActiveTraceMapper mapper = new TFActiveTraceMapper();
    TFActiveTrace tFActiveTrace = mapper.map(activeTraceBo);
    TFActiveTraceHistogram histogram = tFActiveTrace.getHistogram();
    assertEquals(1, histogram.getVersion());
    assertEquals(1, histogram.getHistogramSchemaType());
    List<Integer> activeTraceCountList = histogram.getActiveTraceCount();
    assertEquals(4, activeTraceCountList.size());
    assertEquals(30, (int) activeTraceCountList.get(0));
    assertEquals(40, (int) activeTraceCountList.get(1));
    assertEquals(10, (int) activeTraceCountList.get(2));
    assertEquals(50, (int) activeTraceCountList.get(3));
}
Also used : TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) ActiveTraceHistogram(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo) Test(org.junit.Test)

Example 4 with TFActiveTraceHistogram

use of com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram in project pinpoint by naver.

the class JoinAgentStatBoMapperTest method map4Test.

@Test
public void map4Test() {
    final String agentId = "testAgent";
    final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
    final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
    tFAgentStatBatch.setStartTimestamp(1491274138454L);
    tFAgentStatBatch.setAgentId(agentId);
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId(agentId);
    tFAgentStat.setTimestamp(1491274148454L);
    final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount = new ArrayList<>(4);
    activeTraceCount.add(10);
    activeTraceCount.add(20);
    activeTraceCount.add(40);
    activeTraceCount.add(50);
    tFActiveTraceHistogram.setVersion((short) 2);
    tFActiveTraceHistogram.setHistogramSchemaType(1);
    tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount);
    final TFActiveTrace tfActiveTrace = new TFActiveTrace();
    tfActiveTrace.setHistogram(tFActiveTraceHistogram);
    tFAgentStat.setActiveTrace(tfActiveTrace);
    final TFAgentStat tFAgentStat2 = new TFAgentStat();
    tFAgentStat2.setAgentId(agentId);
    tFAgentStat2.setTimestamp(1491275148454L);
    tFAgentStat2.setCollectInterval(5000);
    final TFActiveTraceHistogram tFActiveTraceHistogram2 = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount2 = new ArrayList<>(4);
    activeTraceCount2.add(11);
    activeTraceCount2.add(21);
    activeTraceCount2.add(41);
    activeTraceCount2.add(51);
    tFActiveTraceHistogram2.setVersion((short) 2);
    tFActiveTraceHistogram2.setHistogramSchemaType(1);
    tFActiveTraceHistogram2.setActiveTraceCount(activeTraceCount2);
    final TFActiveTrace tfActiveTrace2 = new TFActiveTrace();
    tfActiveTrace2.setHistogram(tFActiveTraceHistogram2);
    tFAgentStat2.setActiveTrace(tfActiveTrace2);
    final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
    tFAgentStatList.add(tFAgentStat);
    tFAgentStatList.add(tFAgentStat2);
    tFAgentStatBatch.setAgentStats(tFAgentStatList);
    JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
    assertEquals(joinAgentStatBo.getId(), agentId);
    assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L);
    assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L);
    List<JoinActiveTraceBo> joinActiveTraceBoList = joinAgentStatBo.getJoinActiveTraceBoList();
    assertEquals(joinActiveTraceBoList.size(), 2);
    JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoList.get(0);
    assertEquals(joinActiveTraceBo.getId(), agentId);
    assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L);
    assertEquals(joinActiveTraceBo.getVersion(), 2);
    assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, agentId, 120, agentId));
    JoinActiveTraceBo joinActiveTraceBo2 = joinActiveTraceBoList.get(1);
    assertEquals(joinActiveTraceBo2.getId(), agentId);
    assertEquals(joinActiveTraceBo2.getTimestamp(), 1491275148454L);
    assertEquals(joinActiveTraceBo2.getVersion(), 2);
    assertEquals(joinActiveTraceBo2.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo2.getTotalCountJoinValue(), new JoinIntFieldBo(124, 124, agentId, 124, agentId));
}
Also used : ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) Test(org.junit.Test)

Example 5 with TFActiveTraceHistogram

use of com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram in project pinpoint by naver.

the class JoinThriftActiveTraceBoMapperTest method mapTest.

@Test
public void mapTest() throws Exception {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    final String id = "testAgent";
    tFAgentStat.setAgentId(id);
    tFAgentStat.setTimestamp(1491274148454L);
    final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount = new ArrayList<>(4);
    activeTraceCount.add(10);
    activeTraceCount.add(20);
    activeTraceCount.add(40);
    activeTraceCount.add(50);
    tFActiveTraceHistogram.setVersion((short) 2);
    tFActiveTraceHistogram.setHistogramSchemaType(1);
    tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount);
    final TFActiveTrace tFActiveTrace = new TFActiveTrace();
    tFActiveTrace.setHistogram(tFActiveTraceHistogram);
    tFAgentStat.setActiveTrace(tFActiveTrace);
    final JoinActiveTraceBoMapper joinActiveTraceBoMapper = new JoinActiveTraceBoMapper();
    final JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoMapper.map(tFAgentStat);
    assertNotNull(joinActiveTraceBo);
    assertEquals(joinActiveTraceBo.getId(), id);
    assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L);
    assertEquals(joinActiveTraceBo.getVersion(), 2);
    assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, id, 120, id));
}
Also used : JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) ArrayList(java.util.ArrayList) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Aggregations

TFActiveTrace (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace)6 TFActiveTraceHistogram (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram)6 Test (org.junit.Test)4 JoinActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo)3 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)3 ArrayList (java.util.ArrayList)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)1 ActiveTraceHistogram (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram)1 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)1 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1