Search in sources :

Example 16 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class ServerInstanceListTest method createAgentInfo.

public static AgentInfo createAgentInfo(String agentId, String hostName) {
    AgentInfoBo.Builder agentInfoBuilder = new AgentInfoBo.Builder();
    agentInfoBuilder.setAgentId(agentId);
    ServiceType serviceType = ServiceType.TEST_STAND_ALONE;
    agentInfoBuilder.setServiceTypeCode(serviceType.getCode());
    agentInfoBuilder.setHostName(hostName);
    return new AgentInfo(agentInfoBuilder.build());
}
Also used : AgentInfoBo(com.navercorp.pinpoint.common.server.bo.AgentInfoBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 17 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class HbaseAgentLifeCycleDaoTest method agentInfo_should_be_populated_appropriately_if_status_is_known.

@Test
public void agentInfo_should_be_populated_appropriately_if_status_is_known() {
    // Given
    final String expectedAgentId = "test-agent";
    final long expectedTimestamp = 1000L;
    final AgentLifeCycleState expectedAgentLifeCycleState = AgentLifeCycleState.RUNNING;
    final AgentLifeCycleBo scannedLifeCycleBo = createAgentLifeCycleBo(expectedAgentId, expectedTimestamp, expectedAgentLifeCycleState);
    when(this.hbaseOperations2.find(any(TableName.class), any(Scan.class), any(ResultsExtractor.class))).thenReturn(scannedLifeCycleBo);
    // When
    AgentInfo givenAgentInfo = new AgentInfo();
    givenAgentInfo.setAgentId(expectedAgentId);
    givenAgentInfo.setStartTimestamp(expectedTimestamp);
    this.agentLifeCycleDao.populateAgentStatus(givenAgentInfo, expectedTimestamp);
    // Then
    AgentStatus actualAgentStatus = givenAgentInfo.getStatus();
    Assert.assertEquals(expectedAgentId, actualAgentStatus.getAgentId());
    Assert.assertEquals(expectedTimestamp, actualAgentStatus.getEventTimestamp());
    Assert.assertEquals(expectedAgentLifeCycleState, actualAgentStatus.getState());
}
Also used : ResultsExtractor(com.navercorp.pinpoint.common.hbase.ResultsExtractor) TableName(org.apache.hadoop.hbase.TableName) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Scan(org.apache.hadoop.hbase.client.Scan) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) AgentLifeCycleBo(com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo) AgentLifeCycleState(com.navercorp.pinpoint.common.server.util.AgentLifeCycleState) Test(org.junit.Test)

Example 18 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class HbaseAgentLifeCycleDaoTest method agentInfos_should_be_populated_accordingly_even_with_nulls.

@Test
public void agentInfos_should_be_populated_accordingly_even_with_nulls() {
    // Given
    final String expectedAgentId = "test-agent";
    final long expectedTimestamp = 1000L;
    final AgentLifeCycleState expectedAgentLifeCycleState = AgentLifeCycleState.RUNNING;
    final AgentLifeCycleBo scannedLifeCycleBo = createAgentLifeCycleBo(expectedAgentId, expectedTimestamp, expectedAgentLifeCycleState);
    when(this.hbaseOperations2.findParallel(any(TableName.class), anyListOf(Scan.class), any(ResultsExtractor.class))).thenReturn(Arrays.asList(scannedLifeCycleBo, scannedLifeCycleBo));
    AgentInfo nonNullAgentInfo = new AgentInfo();
    nonNullAgentInfo.setAgentId(expectedAgentId);
    nonNullAgentInfo.setStartTimestamp(expectedTimestamp);
    AgentInfo nullAgentInfo = null;
    List<AgentInfo> givenAgentInfos = Arrays.asList(nonNullAgentInfo, nullAgentInfo, nonNullAgentInfo, nullAgentInfo);
    // When
    this.agentLifeCycleDao.populateAgentStatuses(givenAgentInfos, expectedTimestamp);
    // Then
    Assert.assertEquals(nonNullAgentInfo, givenAgentInfos.get(0));
    Assert.assertEquals(nullAgentInfo, givenAgentInfos.get(1));
    Assert.assertEquals(nonNullAgentInfo, givenAgentInfos.get(2));
    Assert.assertEquals(nullAgentInfo, givenAgentInfos.get(3));
    AgentStatus nonNullAgentInfoStatus = nonNullAgentInfo.getStatus();
    Assert.assertEquals(expectedAgentId, nonNullAgentInfoStatus.getAgentId());
    Assert.assertEquals(expectedTimestamp, nonNullAgentInfoStatus.getEventTimestamp());
    Assert.assertEquals(expectedAgentLifeCycleState, nonNullAgentInfoStatus.getState());
}
Also used : ResultsExtractor(com.navercorp.pinpoint.common.hbase.ResultsExtractor) TableName(org.apache.hadoop.hbase.TableName) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Scan(org.apache.hadoop.hbase.client.Scan) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) AgentLifeCycleBo(com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo) AgentLifeCycleState(com.navercorp.pinpoint.common.server.util.AgentLifeCycleState) Test(org.junit.Test)

Example 19 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class HbaseAgentLifeCycleDaoTest method agentInfo_should_be_populated_as_unknown_if_status_cannot_be_found.

@Test
public void agentInfo_should_be_populated_as_unknown_if_status_cannot_be_found() {
    // Given
    final String expectedAgentId = "test-agent";
    final long expectedTimestamp = 0L;
    final AgentLifeCycleState expectedAgentLifeCycleState = AgentLifeCycleState.UNKNOWN;
    final AgentLifeCycleBo scannedLifeCycleBo = null;
    when(this.hbaseOperations2.find(any(TableName.class), any(Scan.class), any(ResultsExtractor.class))).thenReturn(scannedLifeCycleBo);
    AgentInfo givenAgentInfo = new AgentInfo();
    givenAgentInfo.setAgentId(expectedAgentId);
    givenAgentInfo.setStartTimestamp(expectedTimestamp);
    // When
    this.agentLifeCycleDao.populateAgentStatus(givenAgentInfo, expectedTimestamp);
    // Then
    AgentStatus actualAgentStatus = givenAgentInfo.getStatus();
    Assert.assertEquals(expectedAgentId, actualAgentStatus.getAgentId());
    Assert.assertEquals(expectedTimestamp, actualAgentStatus.getEventTimestamp());
    Assert.assertEquals(expectedAgentLifeCycleState, actualAgentStatus.getState());
}
Also used : ResultsExtractor(com.navercorp.pinpoint.common.hbase.ResultsExtractor) TableName(org.apache.hadoop.hbase.TableName) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Scan(org.apache.hadoop.hbase.client.Scan) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) AgentLifeCycleBo(com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo) AgentLifeCycleState(com.navercorp.pinpoint.common.server.util.AgentLifeCycleState) Test(org.junit.Test)

Example 20 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class ServerInstanceListSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    ObjectMapper mapper = createMapper();
    AgentInfo agentInfo = ServerInstanceListTest.createAgentInfo("agentId1", "testHost");
    Set<AgentInfo> agentInfoSet = new HashSet<>();
    agentInfoSet.add(agentInfo);
    ServerBuilder builder = new ServerBuilder();
    builder.addAgentInfo(agentInfoSet);
    ServerInstanceList serverInstanceList = builder.build();
    ObjectWriter objectWriter = mapper.writerWithDefaultPrettyPrinter();
    String json = objectWriter.writeValueAsString(serverInstanceList);
    logger.debug(json);
}
Also used : ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.ServerInstanceList) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) ServerBuilder(com.navercorp.pinpoint.web.applicationmap.ServerBuilder) HashSet(java.util.HashSet) Test(org.junit.Test) ServerInstanceListTest(com.navercorp.pinpoint.web.applicationmap.ServerInstanceListTest)

Aggregations

AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)25 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)7 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)5 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 AgentLifeCycleBo (com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo)4 Scan (org.apache.hadoop.hbase.client.Scan)4 ResultsExtractor (com.navercorp.pinpoint.common.hbase.ResultsExtractor)3 AgentLifeCycleState (com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)3 ArrayList (java.util.ArrayList)3 TableName (org.apache.hadoop.hbase.TableName)3 TException (org.apache.thrift.TException)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 DefaultPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse)2 FailedPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse)2 AgentActiveThreadDumpFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory)2 AgentActiveThreadDumpList (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList)2 ApplicationAgentHostList (com.navercorp.pinpoint.web.vo.ApplicationAgentHostList)2