use of com.navercorp.pinpoint.web.applicationmap.ApplicationMap in project pinpoint by naver.
the class FilteredMapController method getFilteredServerMapData.
/**
* filtered server map data query within from ~ to timeframe
*
* @param applicationName
* @param serviceTypeName
* @param from
* @param to
* @param filterText
* @param limit
* @return
*/
@RequestMapping(value = "/getFilteredServerMapData", method = RequestMethod.GET, params = "serviceTypeName")
@ResponseBody
public FilterMapWrap getFilteredServerMapData(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeName") String serviceTypeName, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam("originTo") long originTo, @RequestParam(value = "filter", required = false) String filterText, @RequestParam(value = "hint", required = false) String filterHint, @RequestParam(value = "limit", required = false, defaultValue = "10000") int limit) {
limit = LimitUtils.checkRange(limit);
final Filter filter = filterBuilder.build(filterText, filterHint);
final Range range = new Range(from, to);
final LimitedScanResult<List<TransactionId>> limitedScanResult = filteredMapService.selectTraceIdsFromApplicationTraceIndex(applicationName, range, limit);
final long lastScanTime = limitedScanResult.getLimitedTime();
// original range: needed for visual chart data sampling
final Range originalRange = new Range(from, originTo);
// needed to figure out already scanned ranged
final Range scannerRange = new Range(lastScanTime, to);
logger.debug("originalRange:{} scannerRange:{} ", originalRange, scannerRange);
ApplicationMap map = filteredMapService.selectApplicationMap(limitedScanResult.getScanData(), originalRange, scannerRange, filter);
if (logger.isDebugEnabled()) {
logger.debug("getFilteredServerMapData range scan(limit:{}) range:{} lastFetchedTimestamp:{}", limit, range.prettyToString(), DateUtils.longToDateStr(lastScanTime));
}
FilterMapWrap mapWrap = new FilterMapWrap(map);
mapWrap.setLastFetchedTimestamp(lastScanTime);
return mapWrap;
}
use of com.navercorp.pinpoint.web.applicationmap.ApplicationMap 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;
}
use of com.navercorp.pinpoint.web.applicationmap.ApplicationMap in project pinpoint by naver.
the class FilteredMapServiceImpl method selectApplicationMapWithScatterData.
@Override
public ApplicationMap selectApplicationMapWithScatterData(List<TransactionId> transactionIdList, Range originalRange, Range scanRange, int xGroupUnit, int yGroupUnit, Filter filter) {
if (transactionIdList == null) {
throw new NullPointerException("transactionIdList must not be null");
}
if (filter == null) {
throw new NullPointerException("filter must not be null");
}
StopWatch watch = new StopWatch();
watch.start();
final List<List<SpanBo>> filterList = selectFilteredSpan(transactionIdList, filter);
DotExtractor dotExtractor = createDotExtractor(scanRange, filterList);
ApplicationMap map = createMap(originalRange, scanRange, filterList);
ApplicationMapWithScatterData applicationMapWithScatterData = new ApplicationMapWithScatterData(map, dotExtractor.getApplicationScatterData(originalRange.getFrom(), originalRange.getTo(), xGroupUnit, yGroupUnit));
watch.stop();
logger.debug("Select filtered application map elapsed. {}ms", watch.getTotalTimeMillis());
return applicationMapWithScatterData;
}
use of com.navercorp.pinpoint.web.applicationmap.ApplicationMap in project pinpoint by naver.
the class FilteredMapController method getFilteredServerMapDataMadeOfDotGroup.
@GetMapping(value = "/getFilteredServerMapDataMadeOfDotGroup", params = "serviceTypeName")
public FilterMapWrap getFilteredServerMapDataMadeOfDotGroup(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeName") String serviceTypeName, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam("originTo") long originTo, @RequestParam("xGroupUnit") int xGroupUnit, @RequestParam("yGroupUnit") int yGroupUnit, @RequestParam(value = "filter", required = false) String filterText, @RequestParam(value = "hint", required = false) String filterHint, @RequestParam(value = "limit", required = false, defaultValue = "10000") int limit, @RequestParam(value = "v", required = false, defaultValue = "0") int viewVersion, @RequestParam(value = "useStatisticsAgentState", defaultValue = "false", required = false) boolean useStatisticsAgentState, @RequestParam(value = "useLoadHistogramFormat", defaultValue = "false", required = false) boolean useLoadHistogramFormat) {
if (xGroupUnit <= 0) {
throw new IllegalArgumentException("xGroupUnit(" + xGroupUnit + ") must be positive number");
}
if (yGroupUnit <= 0) {
throw new IllegalArgumentException("yGroupUnit(" + yGroupUnit + ") must be positive number");
}
limit = LimitUtils.checkRange(limit);
final Filter<List<SpanBo>> filter = filterBuilder.build(filterText, filterHint);
final Range range = Range.newRange(from, to);
final LimitedScanResult<List<TransactionId>> limitedScanResult = filteredMapService.selectTraceIdsFromApplicationTraceIndex(applicationName, range, limit);
final long lastScanTime = limitedScanResult.getLimitedTime();
// original range: needed for visual chart data sampling
final Range originalRange = Range.newRange(from, originTo);
// needed to figure out already scanned ranged
final Range scannerRange = Range.newRange(lastScanTime, to);
logger.debug("originalRange:{} scannerRange:{} ", originalRange, scannerRange);
final FilteredMapServiceOption option = new FilteredMapServiceOption.Builder(limitedScanResult.getScanData(), originalRange, scannerRange, xGroupUnit, yGroupUnit, filter, viewVersion).setUseStatisticsAgentState(useStatisticsAgentState).build();
final ApplicationMap map = filteredMapService.selectApplicationMapWithScatterData(option);
if (logger.isDebugEnabled()) {
logger.debug("getFilteredServerMapData range scan(limit:{}) range:{} lastFetchedTimestamp:{}", limit, range.prettyToString(), DateTimeFormatUtils.format(lastScanTime));
}
FilterMapWrap mapWrap;
if (useLoadHistogramFormat) {
mapWrap = new FilterMapWrap(map, TimeHistogramFormat.V2);
} else {
mapWrap = new FilterMapWrap(map, TimeHistogramFormat.V1);
}
mapWrap.setLastFetchedTimestamp(lastScanTime);
return mapWrap;
}
use of com.navercorp.pinpoint.web.applicationmap.ApplicationMap in project pinpoint by naver.
the class MapController method selectApplicationMap.
private MapWrap selectApplicationMap(Application application, Range range, SearchOption searchOption, NodeType nodeType, LinkType linkType, boolean useStatisticsAgentState, boolean useLoadHistogramFormat) {
Objects.requireNonNull(application, "application");
Objects.requireNonNull(range, "range");
Objects.requireNonNull(searchOption, "searchOption");
final MapServiceOption mapServiceOption = new MapServiceOption.Builder(application, range, searchOption, nodeType, linkType).setUseStatisticsAgentState(useStatisticsAgentState).build();
logger.info("Select applicationMap. option={}", mapServiceOption);
final ApplicationMap map = mapService.selectApplicationMap(mapServiceOption);
if (useLoadHistogramFormat) {
return new MapWrap(map, TimeHistogramFormat.V2);
}
return new MapWrap(map, TimeHistogramFormat.V1);
}
Aggregations