Search in sources :

Example 1 with TFResponseTime

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

the class JoinAgentStatBoMapperTest method map5Test.

@Test
public void map5Test() {
    final String agentId = "testAgent";
    final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
    final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
    tFAgentStatBatch.setStartTimestamp(1491274138454L);
    tFAgentStatBatch.setAgentId(agentId);
    final TFResponseTime tFResponseTime = new TFResponseTime();
    tFResponseTime.setAvg(100);
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId(agentId);
    tFAgentStat.setTimestamp(1491274148454L);
    tFAgentStat.setResponseTime(tFResponseTime);
    final TFResponseTime tFResponseTime2 = new TFResponseTime();
    tFResponseTime2.setAvg(120);
    final TFAgentStat tFAgentStat2 = new TFAgentStat();
    tFAgentStat2.setAgentId(agentId);
    tFAgentStat2.setTimestamp(1491275148454L);
    tFAgentStat2.setResponseTime(tFResponseTime2);
    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<JoinResponseTimeBo> joinResponseTimeBoList = joinAgentStatBo.getJoinResponseTimeBoList();
    assertEquals(joinResponseTimeBoList.size(), 2);
    JoinResponseTimeBo joinResponseTimeBo = joinResponseTimeBoList.get(0);
    assertEquals(joinResponseTimeBo.getId(), agentId);
    assertEquals(joinResponseTimeBo.getTimestamp(), 1491274148454L);
    assertEquals(joinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId));
    JoinResponseTimeBo joinResponseTimeBo2 = joinResponseTimeBoList.get(1);
    assertEquals(joinResponseTimeBo2.getId(), agentId);
    assertEquals(joinResponseTimeBo2.getTimestamp(), 1491275148454L);
    assertEquals(joinResponseTimeBo2.getResponseTimeJoinValue(), new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId));
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) JoinResponseTimeBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) TFResponseTime(com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) Test(org.junit.Test)

Example 2 with TFResponseTime

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

the class JoinResponseTimeBoMapper method map.

public JoinResponseTimeBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetResponseTime()) {
        return JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO;
    }
    final String agentId = tFAgentStat.getAgentId();
    final TFResponseTime tFResponseTime = tFAgentStat.getResponseTime();
    final long avg = tFResponseTime.getAvg();
    JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo();
    joinResponseTimeBo.setId(agentId);
    joinResponseTimeBo.setTimestamp(tFAgentStat.getTimestamp());
    joinResponseTimeBo.setResponseTimeJoinValue(new JoinLongFieldBo(avg, avg, agentId, avg, agentId));
    return joinResponseTimeBo;
}
Also used : JoinResponseTimeBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) TFResponseTime(com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime)

Example 3 with TFResponseTime

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

the class TFResponseTimeMapper method map.

public TFResponseTime map(ResponseTimeBo responseTimeBo) {
    TFResponseTime tFResponseTime = new TFResponseTime();
    tFResponseTime.setAvg(responseTimeBo.getAvg());
    return tFResponseTime;
}
Also used : TFResponseTime(com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime)

Example 4 with TFResponseTime

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

the class TFAgentStatMapperTest method map5Test.

@Test
public void map5Test() {
    AgentStatBo agentStatBo = createResponseTimeBoList();
    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);
    TFResponseTime responseTime1 = tFAgentStat1.getResponseTime();
    assertEquals(responseTime1.getAvg(), 1000);
    TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
    assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT);
    assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp);
    assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd);
    TFResponseTime responseTime2 = tFAgentStat2.getResponseTime();
    assertEquals(responseTime2.getAvg(), 2000);
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFResponseTime(com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime) Test(org.junit.Test)

Example 5 with TFResponseTime

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

the class TFResponseTimeMapperTest method mapTest.

@Test
public void mapTest() {
    TFResponseTimeMapper mapper = new TFResponseTimeMapper();
    ResponseTimeBo responseTimeBo = new ResponseTimeBo();
    responseTimeBo.setAvg(50);
    TFResponseTime tFResponseTime = mapper.map(responseTimeBo);
    assertEquals(tFResponseTime.getAvg(), 50);
}
Also used : ResponseTimeBo(com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo) TFResponseTime(com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime) Test(org.junit.Test)

Aggregations

TFResponseTime (com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime)7 Test (org.junit.Test)5 JoinResponseTimeBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo)4 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)4 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)3 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)1 ResponseTimeBo (com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo)1 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1 ArrayList (java.util.ArrayList)1