Search in sources :

Example 1 with FilteredMapServiceOption

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;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) FilterBuilder(com.navercorp.pinpoint.web.filter.FilterBuilder) List(java.util.List) Range(com.navercorp.pinpoint.web.vo.Range) FilteredMapServiceOption(com.navercorp.pinpoint.web.service.FilteredMapServiceOption) FilterMapWrap(com.navercorp.pinpoint.web.applicationmap.FilterMapWrap) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with FilteredMapServiceOption

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;
}
Also used : ColumnGetCount(com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount) ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) ServletUriComponentsBuilder(org.springframework.web.servlet.support.ServletUriComponentsBuilder) TransactionInfoViewModel(com.navercorp.pinpoint.web.view.TransactionInfoViewModel) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) FilteredMapServiceOption(com.navercorp.pinpoint.web.service.FilteredMapServiceOption) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

ApplicationMap (com.navercorp.pinpoint.web.applicationmap.ApplicationMap)2 FilteredMapServiceOption (com.navercorp.pinpoint.web.service.FilteredMapServiceOption)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 ColumnGetCount (com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount)1 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 FilterMapWrap (com.navercorp.pinpoint.web.applicationmap.FilterMapWrap)1 CallTreeIterator (com.navercorp.pinpoint.web.calltree.span.CallTreeIterator)1 FilterBuilder (com.navercorp.pinpoint.web.filter.FilterBuilder)1 SpanResult (com.navercorp.pinpoint.web.service.SpanResult)1 TransactionInfoViewModel (com.navercorp.pinpoint.web.view.TransactionInfoViewModel)1 Range (com.navercorp.pinpoint.web.vo.Range)1 RecordSet (com.navercorp.pinpoint.web.vo.callstacks.RecordSet)1 List (java.util.List)1 ServletUriComponentsBuilder (org.springframework.web.servlet.support.ServletUriComponentsBuilder)1