use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class AgentStatController method getAgentStatChart.
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/chart", method = RequestMethod.GET)
@ResponseBody
public AgentStatChartGroup getAgentStatChart(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to) {
TimeWindowSampler sampler = new TimeWindowSlotCentricSampler();
TimeWindow timeWindow = new TimeWindow(new Range(from, to), sampler);
return this.agentStatChartService.selectAgentChart(agentId, timeWindow);
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class AgentStatController method getAgentStatChartList.
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/chartList", method = RequestMethod.GET, params = { "interval" })
@ResponseBody
public List<AgentStatChartGroup> getAgentStatChartList(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam("interval") Integer interval) {
final int minSamplingInterval = 5;
final long intervalMs = interval < minSamplingInterval ? minSamplingInterval * 1000L : interval * 1000L;
TimeWindowSampler sampler = new TimeWindowSampler() {
@Override
public long getWindowSize(Range range) {
return intervalMs;
}
};
TimeWindow timeWindow = new TimeWindow(new Range(from, to), sampler);
return this.agentStatChartService.selectAgentChartList(agentId, timeWindow);
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class LegacyAgentStatController method getAgentStatV2.
@Deprecated
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/getAgentStat/v2", method = RequestMethod.GET)
@ResponseBody
public LegacyAgentStatChartGroup getAgentStatV2(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam(value = "sampleRate", required = false) Integer sampleRate) throws Exception {
StopWatch watch = new StopWatch();
watch.start("agentStatService.selectAgentStatList");
TimeWindow timeWindow = new TimeWindow(new Range(from, to), new TimeWindowSlotCentricSampler());
LegacyAgentStatChartGroup chartGroup = this.v2Service.selectAgentStatList(agentId, timeWindow);
watch.stop();
if (logger.isInfoEnabled()) {
logger.info("getAgentStatV2(agentId={}, from={}, to={}) : {}ms", agentId, from, to, watch.getLastTaskTimeMillis());
}
return chartGroup;
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class DataSourceChartGroupTest method basicFunctionTest1.
@Test
public void basicFunctionTest1() {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = createSampledDataSourceList(timeWindow);
StatChartGroup dataSourceChartGroup = DataSourceChart.newDataSourceChartGroup(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
assertEquals(sampledDataSourceList, dataSourceChartGroup);
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class DataSourceChartGroupTest method basicFunctionTest2.
@Test
public void basicFunctionTest2() {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = Collections.emptyList();
DataSourceChart dataSourceChartGroup = new DataSourceChart(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
Assert.assertEquals(-1, dataSourceChartGroup.getId());
Assert.assertEquals(null, dataSourceChartGroup.getJdbcUrl());
Assert.assertEquals(null, dataSourceChartGroup.getDatabaseName());
Assert.assertEquals(null, dataSourceChartGroup.getServiceType());
Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = dataSourceChartGroup.getCharts().getCharts();
Assert.assertEquals(2, charts.size());
for (Chart<? extends Point> chart : charts.values()) {
Assert.assertTrue(CollectionUtils.isEmpty(chart.getPoints()));
}
}
Aggregations