use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class AgentStatController method getAgentStatChart.
@GetMapping(value = "/chart", params = { "interval" })
public StatChart getAgentStatChart(@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(Range.newRange(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.
@GetMapping(value = "/chartList", params = { "interval" })
public List<StatChart> 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(Range.newRange(from, to), sampler);
return this.agentStatChartService.selectAgentChartList(agentId, timeWindow);
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class HbaseMapStatisticsCalleeDao method selectCallee.
@Override
public LinkDataMap selectCallee(Application calleeApplication, Range range) {
Objects.requireNonNull(calleeApplication, "calleeApplication");
Objects.requireNonNull(range, "range");
final TimeWindow timeWindow = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
// find distributed key - ver2.
final Scan scan = createScan(calleeApplication, range, DESCRIPTOR.getName());
ResultsExtractor<LinkDataMap> resultExtractor = new RowMapReduceResultExtractor<>(mapStatisticsCalleeMapper, new MapStatisticsTimeWindowReducer(timeWindow));
TableName mapStatisticsCallerTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
LinkDataMap linkDataMap = hbaseTemplate.findParallel(mapStatisticsCallerTableName, scan, rowKeyDistributorByHashPrefix, resultExtractor, MAP_STATISTICS_CALLER_VER2_NUM_PARTITIONS);
logger.debug("Callee data. {}, {}", linkDataMap, range);
if (linkDataMap != null && linkDataMap.size() > 0) {
return linkDataMap;
}
return new LinkDataMap();
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class StatChartGroupSerializer method serialize.
@Override
public void serialize(StatChartGroup statChartGroup, JsonGenerator jgen, SerializerProvider serializers) throws IOException, JsonProcessingException {
jgen.writeStartObject();
Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = statChartGroup.getCharts();
writeSchema(jgen, charts.keySet());
TimeWindow timeWindow = statChartGroup.getTimeWindow();
writeTimestamp(jgen, timeWindow);
writeCharts(jgen, charts);
jgen.writeEndObject();
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class LinkCallDataTest method addCallData.
@Test
public void addCallData() {
LinkKey key = new LinkKey("fromApplication", ServiceType.STAND_ALONE, "toApplication", ServiceType.STAND_ALONE);
long currentTime = System.currentTimeMillis();
LinkCallData data1 = new LinkCallData(key);
data1.addCallData(currentTime, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
logger.debug("{}", data1.getTimeHistogram().size());
Range range = Range.newRange(currentTime, currentTime + SIX_HOURS);
TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
LinkCallData data2 = new LinkCallData(key, window);
data2.addCallData(currentTime, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
logger.debug("{}", data2.getTimeHistogram().size());
}
Aggregations