Search in sources :

Example 1 with FilterMapWrap

use of com.navercorp.pinpoint.web.applicationmap.FilterMapWrap 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;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) Filter(com.navercorp.pinpoint.web.filter.Filter) List(java.util.List) Range(com.navercorp.pinpoint.web.vo.Range) FilterMapWrap(com.navercorp.pinpoint.web.applicationmap.FilterMapWrap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with FilterMapWrap

use of com.navercorp.pinpoint.web.applicationmap.FilterMapWrap 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 3 with FilterMapWrap

use of com.navercorp.pinpoint.web.applicationmap.FilterMapWrap in project pinpoint by naver.

the class FilteredMapController method getFilteredServerMapDataMadeOfDotGroup.

@RequestMapping(value = "/getFilteredServerMapDataMadeOfDotGroup", method = RequestMethod.GET, params = "serviceTypeName")
@ResponseBody
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) {
    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 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.selectApplicationMapWithScatterData(limitedScanResult.getScanData(), originalRange, scannerRange, xGroupUnit, yGroupUnit, 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;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) Filter(com.navercorp.pinpoint.web.filter.Filter) List(java.util.List) Range(com.navercorp.pinpoint.web.vo.Range) FilterMapWrap(com.navercorp.pinpoint.web.applicationmap.FilterMapWrap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ApplicationMap (com.navercorp.pinpoint.web.applicationmap.ApplicationMap)3 FilterMapWrap (com.navercorp.pinpoint.web.applicationmap.FilterMapWrap)3 Range (com.navercorp.pinpoint.web.vo.Range)3 List (java.util.List)3 Filter (com.navercorp.pinpoint.web.filter.Filter)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 FilterBuilder (com.navercorp.pinpoint.web.filter.FilterBuilder)1 FilteredMapServiceOption (com.navercorp.pinpoint.web.service.FilteredMapServiceOption)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1