use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo in project pinpoint by naver.
the class ApplicationDataSourceService method classifyByDataSourceUrl.
protected Map<DataSourceKey, List<AggreJoinDataSourceBo>> classifyByDataSourceUrl(List<AggreJoinDataSourceListBo> aggreJoinDataSourceListBoList) {
Map<DataSourceKey, List<AggreJoinDataSourceBo>> aggreJoinDataSourceBoMap = new HashMap<>();
for (AggreJoinDataSourceListBo aggreJoinDataSourceListBo : aggreJoinDataSourceListBoList) {
for (AggreJoinDataSourceBo aggreJoinDataSourceBo : aggreJoinDataSourceListBo.getAggreJoinDataSourceBoList()) {
DataSourceKey dataSourceKey = new DataSourceKey(aggreJoinDataSourceBo.getUrl(), aggreJoinDataSourceBo.getServiceTypeCode());
List<AggreJoinDataSourceBo> aggreJoinDataSourceBoList = aggreJoinDataSourceBoMap.computeIfAbsent(dataSourceKey, k -> new ArrayList<>());
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo);
}
}
for (List<AggreJoinDataSourceBo> aggreJoinDataSourceBoList : aggreJoinDataSourceBoMap.values()) {
aggreJoinDataSourceBoList.sort(comparator);
}
return aggreJoinDataSourceBoMap;
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo in project pinpoint by naver.
the class JoinDataSourceSamplerTest method sampleDataPointsTest.
@Test
public void sampleDataPointsTest() {
final String id = "test_app";
JoinDataSourceSampler sampler = new JoinDataSourceSampler();
long timestamp = new Date().getTime();
AggreJoinDataSourceListBo aggreJoinDataSourceListBo = sampler.sampleDataPoints(0, timestamp, createJoinDataSourceListBoList(id, timestamp), new JoinDataSourceListBo());
assertEquals(aggreJoinDataSourceListBo.getId(), id);
assertEquals(aggreJoinDataSourceListBo.getTimestamp(), timestamp);
List<AggreJoinDataSourceBo> joinDataSourceBoList = aggreJoinDataSourceListBo.getAggreJoinDataSourceBoList();
joinDataSourceBoList.sort(COMPARATOR);
assertEquals(joinDataSourceBoList.size(), 5);
AggreJoinDataSourceBo aggreJoinDataSourceBo1 = joinDataSourceBoList.get(0);
assertEquals(aggreJoinDataSourceBo1.getServiceTypeCode(), 1000);
assertEquals(aggreJoinDataSourceBo1.getUrl(), "jdbc:mysql");
assertEquals(aggreJoinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(60, 35, "agent_id_1_10", 110, "agent_id_6_50"));
AggreJoinDataSourceBo aggreJoinDataSourceBo2 = joinDataSourceBoList.get(1);
assertEquals(aggreJoinDataSourceBo2.getServiceTypeCode(), 2000);
assertEquals(aggreJoinDataSourceBo2.getUrl(), "jdbc:mssql");
assertEquals(aggreJoinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(50, 15, "agent_id_2_10", 80, "agent_id_7_50"));
AggreJoinDataSourceBo aggreJoinDataSourceBo3 = joinDataSourceBoList.get(2);
assertEquals(aggreJoinDataSourceBo3.getServiceTypeCode(), 3000);
assertEquals(aggreJoinDataSourceBo3.getUrl(), "jdbc:postgre");
assertEquals(aggreJoinDataSourceBo3.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(40, 35, "agent_id_3_10", 100, "agent_id_8_50"));
AggreJoinDataSourceBo aggreJoinDataSourceBo4 = joinDataSourceBoList.get(3);
assertEquals(aggreJoinDataSourceBo4.getServiceTypeCode(), 4000);
assertEquals(aggreJoinDataSourceBo4.getUrl(), "jdbc:oracle");
assertEquals(aggreJoinDataSourceBo4.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(70, 20, "agent_id_4_10", 120, "agent_id_9_50"));
AggreJoinDataSourceBo aggreJoinDataSourceBo5 = joinDataSourceBoList.get(4);
assertEquals(aggreJoinDataSourceBo5.getServiceTypeCode(), 5000);
assertEquals(aggreJoinDataSourceBo5.getUrl(), "jdbc:cubrid");
assertEquals(aggreJoinDataSourceBo5.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(80, 35, "agent_id_5_10", 130, "agent_id_10_50"));
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo in project pinpoint by naver.
the class ApplicationDataSourceServiceTest method createJoinDataSourceListBoList.
private List<AggreJoinDataSourceListBo> createJoinDataSourceListBoList(String id, long currentTime) {
List<AggreJoinDataSourceListBo> aggreJoinDataSourceListBoList = new ArrayList<>();
AggreJoinDataSourceListBo aggreJoinDataSourceListBo1 = new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(10, currentTime + 5000), currentTime + 5000);
AggreJoinDataSourceListBo aggreJoinDataSourceListBo2 = new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(20, currentTime + 10000), currentTime + 10000);
AggreJoinDataSourceListBo aggreJoinDataSourceListBo3 = new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(30, currentTime + 15000), currentTime + 15000);
AggreJoinDataSourceListBo aggreJoinDataSourceListBo4 = new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(40, currentTime + 20000), currentTime + 20000);
AggreJoinDataSourceListBo aggreJoinDataSourceListBo5 = new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(50, currentTime + 25000), currentTime + 25000);
aggreJoinDataSourceListBoList.add(aggreJoinDataSourceListBo1);
aggreJoinDataSourceListBoList.add(aggreJoinDataSourceListBo2);
aggreJoinDataSourceListBoList.add(aggreJoinDataSourceListBo3);
aggreJoinDataSourceListBoList.add(aggreJoinDataSourceListBo4);
aggreJoinDataSourceListBoList.add(aggreJoinDataSourceListBo5);
return aggreJoinDataSourceListBoList;
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo in project pinpoint by naver.
the class JoinDataSourceSampler method sampleDataPoints.
@Override
public AggreJoinDataSourceListBo sampleDataPoints(int index, long timestamp, List<JoinDataSourceListBo> joinDataSourceListBoList, JoinDataSourceListBo previousJoinDataSourceListBo) {
if (CollectionUtils.isEmpty(joinDataSourceListBoList)) {
return AggreJoinDataSourceListBo.createUncollectedObject(timestamp);
}
JoinDataSourceListBo joinDataSourceListBo = JoinDataSourceListBo.joinDataSourceListBoList(joinDataSourceListBoList, timestamp);
String id = joinDataSourceListBo.getId();
List<JoinDataSourceBo> joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList();
List<JoinDataSourceBo> aggreJoinDataSourceBoList = getJoinDataSourceBoList(timestamp, joinDataSourceBoList);
AggreJoinDataSourceListBo aggreJoinDataSourceListBo = new AggreJoinDataSourceListBo(id, aggreJoinDataSourceBoList, timestamp);
return aggreJoinDataSourceListBo;
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo in project pinpoint by naver.
the class ApplicationDataSourceService method selectApplicationChart.
public List<StatChart> selectApplicationChart(String applicationId, TimeWindow timeWindow) {
Objects.requireNonNull(applicationId, "applicationId");
Objects.requireNonNull(timeWindow, "timeWindow");
List<StatChart> result = new ArrayList<>();
List<AggreJoinDataSourceListBo> aggreJoinDataSourceListBoList = this.applicationDataSourceDao.getApplicationStatList(applicationId, timeWindow);
if (aggreJoinDataSourceListBoList.isEmpty()) {
result.add(new ApplicationDataSourceChart(timeWindow, "", "", Collections.emptyList()));
return result;
}
Map<DataSourceKey, List<AggreJoinDataSourceBo>> aggreJoinDataSourceBoMap = classifyByDataSourceUrl(aggreJoinDataSourceListBoList);
for (Map.Entry<DataSourceKey, List<AggreJoinDataSourceBo>> entry : aggreJoinDataSourceBoMap.entrySet()) {
DataSourceKey dataSourceKey = entry.getKey();
String serviceTypeName = serviceTypeRegistryService.findServiceType(dataSourceKey.getServiceTypeCode()).getName();
result.add(new ApplicationDataSourceChart(timeWindow, dataSourceKey.getUrl(), serviceTypeName, entry.getValue()));
}
return result;
}
Aggregations