use of com.navercorp.pinpoint.web.service.FilteredMapServiceOption 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.service.FilteredMapServiceOption in project pinpoint by naver.
the class BusinessTransactionController method transactionInfo.
/**
* info lookup for a selected transaction
*
* @param traceId
* @param focusTimestamp
* @return
*/
@GetMapping(value = "/transactionInfo")
public TransactionInfoViewModel transactionInfo(@RequestParam("traceId") String traceId, @RequestParam(value = "focusTimestamp", required = false, defaultValue = DEFAULT_FOCUS_TIMESTAMP) long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = DEFAULT_SPANID) long spanId, @RequestParam(value = "v", required = false, defaultValue = "0") int viewVersion, @RequestParam(value = "useStatisticsAgentState", required = false, defaultValue = "false") boolean useStatisticsAgentState, @RequestParam(value = "useLoadHistogramFormat", required = false, defaultValue = "false") boolean useLoadHistogramFormat) {
logger.debug("GET /transactionInfo params {traceId={}, focusTimestamp={}, agentId={}, spanId={}, v={}}", traceId, focusTimestamp, agentId, spanId, viewVersion);
final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceId);
final ColumnGetCount columnGetCount = ColumnGetCountFactory.create(callstackSelectSpansLimit);
Predicate<SpanBo> spanMatchFilter = SpanFilters.spanFilter(spanId, agentId, focusTimestamp);
// select spans
final SpanResult spanResult = this.spanService.selectSpan(transactionId, spanMatchFilter, columnGetCount);
final CallTreeIterator callTreeIterator = spanResult.getCallTree();
// application map
FilteredMapServiceOption.Builder optionBuilder = new FilteredMapServiceOption.Builder(transactionId, viewVersion, columnGetCount);
final FilteredMapServiceOption option = optionBuilder.setUseStatisticsAgentState(useStatisticsAgentState).build();
ApplicationMap map = filteredMapService.selectApplicationMap(option);
RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, spanMatchFilter);
TransactionInfoViewModel result = new TransactionInfoViewModel(transactionId, spanId, map.getNodes(), map.getLinks(), recordSet, spanResult.getTraceState(), logConfiguration);
if (useLoadHistogramFormat) {
result.setTimeHistogramFormat(TimeHistogramFormat.V2);
}
return result;
}
Aggregations