use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo in project pinpoint by naver.
the class JoinDataSourceSampler method getJoinDataSourceBoList.
public List<JoinDataSourceBo> getJoinDataSourceBoList(long timestamp, List<JoinDataSourceBo> joinDataSourceBoList) {
List<JoinDataSourceBo> aggreJoinDataSourceBoList = new ArrayList<>(joinDataSourceBoList.size());
for (JoinDataSourceBo ds : joinDataSourceBoList) {
AggreJoinDataSourceBo dataSourceBo = new AggreJoinDataSourceBo(ds.getServiceTypeCode(), ds.getUrl(), ds.getActiveConnectionSizeJoinValue(), timestamp);
aggreJoinDataSourceBoList.add(dataSourceBo);
}
return aggreJoinDataSourceBoList;
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo 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.AggreJoinDataSourceBo 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.AggreJoinDataSourceBo in project pinpoint by naver.
the class ApplicationDataSourceServiceTest method createJoinDataSourceBoList.
private List<JoinDataSourceBo> createJoinDataSourceBoList(int plus, long timestamp) {
List<JoinDataSourceBo> joinDataSourceBoList = new ArrayList<>();
AggreJoinDataSourceBo joinDataSourceBo1 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 30 + plus, 25 + plus, "agent_id_1_" + plus, 60 + plus, "agent_id_6_" + plus, timestamp);
AggreJoinDataSourceBo joinDataSourceBo2 = new AggreJoinDataSourceBo((short) 2000, "jdbc:mssql", 20 + plus, 5 + plus, "agent_id_2_" + plus, 30 + plus, "agent_id_7_" + plus, timestamp);
AggreJoinDataSourceBo joinDataSourceBo3 = new AggreJoinDataSourceBo((short) 3000, "jdbc:postgre", 10 + plus, 25 + plus, "agent_id_3_" + plus, 50 + plus, "agent_id_8_" + plus, timestamp);
AggreJoinDataSourceBo joinDataSourceBo4 = new AggreJoinDataSourceBo((short) 4000, "jdbc:oracle", 40 + plus, 10 + plus, "agent_id_4_" + plus, 70 + plus, "agent_id_9_" + plus, timestamp);
AggreJoinDataSourceBo joinDataSourceBo5 = new AggreJoinDataSourceBo((short) 5000, "jdbc:cubrid", 50 + plus, 25 + plus, "agent_id_5_" + plus, 80 + plus, "agent_id_10_" + plus, timestamp);
joinDataSourceBoList.add(joinDataSourceBo1);
joinDataSourceBoList.add(joinDataSourceBo2);
joinDataSourceBoList.add(joinDataSourceBo3);
joinDataSourceBoList.add(joinDataSourceBo4);
joinDataSourceBoList.add(joinDataSourceBo5);
return joinDataSourceBoList;
}
use of com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo in project pinpoint by naver.
the class ApplicationDataSourceChartGroupTest method createApplicationDataSourceChartGroup.
@Test
public void createApplicationDataSourceChartGroup() {
long time = 1495418083250L;
Range range = Range.newRange(time - 240000, time);
TimeWindow timeWindow = new TimeWindow(range);
List<AggreJoinDataSourceBo> aggreJoinDataSourceBoList = new ArrayList<>();
AggreJoinDataSourceBo aggreJoinDataSourceBo1 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 30, 25, "agent_id_1", 60, "agent_id_6", time);
AggreJoinDataSourceBo aggreJoinDataSourceBo2 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 20, 5, "agent_id_2", 30, "agent_id_7", time - 60000);
AggreJoinDataSourceBo aggreJoinDataSourceBo3 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 10, 25, "agent_id_3", 50, "agent_id_8", time - 120000);
AggreJoinDataSourceBo aggreJoinDataSourceBo4 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 40, 4, "agent_id_4", 70, "agent_id_9", time - 180000);
AggreJoinDataSourceBo aggreJoinDataSourceBo5 = new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 50, 25, "agent_id_5", 80, "agent_id_10", time - 240000);
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo1);
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo2);
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo3);
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo4);
aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo5);
StatChartGroup applicationDataSourceChartGroup = new ApplicationDataSourceChart.ApplicationDataSourceChartGroup(timeWindow, "jdbc:mysql", "dbcp2", aggreJoinDataSourceBoList);
Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = applicationDataSourceChartGroup.getCharts();
assertEquals(1, charts.size());
Chart dataSourceChart = charts.get(ApplicationDataSourceChart.ApplicationDataSourceChartGroup.DataSourceChartType.ACTIVE_CONNECTION_SIZE);
List<Point> dataSourcePoints = dataSourceChart.getPoints();
assertEquals(5, dataSourcePoints.size());
int index = dataSourcePoints.size();
for (Point point : dataSourcePoints) {
testDataSource((IntApplicationStatPoint) point, aggreJoinDataSourceBoList.get(--index));
}
}
Aggregations