use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class DataSourceChartGroupTest method basicFunctionTest2.
@Test
public void basicFunctionTest2() throws Exception {
long currentTimeMillis = System.currentTimeMillis();
TimeWindow timeWindow = new TimeWindow(new Range(currentTimeMillis - 300000, currentTimeMillis));
List<SampledDataSource> sampledDataSourceList = Collections.emptyList();
DataSourceChartGroup dataSourceChartGroup = new DataSourceChartGroup(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
Assert.assertEquals(-1, dataSourceChartGroup.getId());
Assert.assertEquals(null, dataSourceChartGroup.getJdbcUrl());
Assert.assertEquals(null, dataSourceChartGroup.getDatabaseName());
Assert.assertEquals(null, dataSourceChartGroup.getServiceTypeName());
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class LegacyAgentStatController method getAgentStatV1.
@Deprecated
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/getAgentStat/v1", method = RequestMethod.GET)
@ResponseBody
public LegacyAgentStatChartGroup getAgentStatV1(@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.v1Service.selectAgentStatList(agentId, timeWindow);
watch.stop();
if (logger.isInfoEnabled()) {
logger.info("getAgentStatV1(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 LegacyAgentStatController method getAgentStat.
@Deprecated
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/getAgentStat", method = RequestMethod.GET)
@ResponseBody
public LegacyAgentStatChartGroup getAgentStat(@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.agentStatService.selectAgentStatList(agentId, timeWindow);
watch.stop();
if (logger.isInfoEnabled()) {
logger.info("getAgentStat(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 AgentStatController method getAgentStatChartList.
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/chartList", method = RequestMethod.GET)
@ResponseBody
public List<AgentStatChartGroup> getAgentStatChartList(@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.selectAgentChartList(agentId, timeWindow);
}
use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.
the class FilteredMapServiceImpl method createMap.
private ApplicationMap createMap(Range range, Range scanRange, List<List<SpanBo>> filterList) {
// TODO inject TimeWindow from elsewhere
final TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
final LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
final ResponseHistogramBuilder mapHistogramSummary = new ResponseHistogramBuilder(range);
/*
* Convert to statistical data
*/
for (List<SpanBo> transaction : filterList) {
final Map<Long, SpanBo> transactionSpanMap = checkDuplicatedSpanId(transaction);
for (SpanBo span : transaction) {
final Application parentApplication = createParentApplication(span, transactionSpanMap);
final Application spanApplication = this.applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
// records the Span's response time statistics
recordSpanResponseTime(spanApplication, span, mapHistogramSummary, span.getCollectorAcceptTime());
if (!spanApplication.getServiceType().isRecordStatistics() || spanApplication.getServiceType().isRpcClient()) {
// span's serviceType is probably not set correctly
logger.warn("invalid span application:{}", spanApplication);
continue;
}
final short slotTime = getHistogramSlotTime(span, spanApplication.getServiceType());
// might need to reconsider using collector's accept time for link statistics.
// we need to convert to time window's timestamp. If not, it may lead to OOM due to mismatch in timeslots.
long timestamp = window.refineTimestamp(span.getCollectorAcceptTime());
if (parentApplication.getServiceType() == ServiceType.USER) {
// Outbound data
if (logger.isTraceEnabled()) {
logger.trace("span user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
}
final LinkDataMap sourceLinkData = linkDataDuplexMap.getSourceLinkDataMap();
sourceLinkData.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
if (logger.isTraceEnabled()) {
logger.trace("span target user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
}
// Inbound data
final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
} else {
// Inbound data
if (logger.isTraceEnabled()) {
logger.trace("span target parent:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
}
final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
}
if (serverMapDataFilter != null && serverMapDataFilter.filter(spanApplication)) {
continue;
}
addNodeFromSpanEvent(span, window, linkDataDuplexMap, transactionSpanMap);
}
}
ApplicationMapBuilder applicationMapBuilder = new ApplicationMapBuilder(range);
mapHistogramSummary.build();
ApplicationMap map = applicationMapBuilder.build(linkDataDuplexMap, agentInfoService, mapHistogramSummary);
if (serverMapDataFilter != null) {
map = serverMapDataFilter.dataFiltering(map);
}
return map;
}
Aggregations