Search in sources :

Example 26 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project pinpoint by naver.

the class StressController method consumeCpu.

@RequestMapping("/consumeCpu")
@ResponseBody
@Description("Call that consumes a lot of cpu time.")
public Map<String, Object> consumeCpu() throws InterruptedException {
    int cpuCount = Runtime.getRuntime().availableProcessors();
    int threadSize = Math.max(1, cpuCount - 1);
    long limitTime = 10000;
    CountDownLatch latch = new CountDownLatch(threadSize);
    for (int i = 0; i < threadSize; i++) {
        Thread thread = new Thread(new ConsumeCpu(latch, limitTime));
        thread.setDaemon(true);
        thread.start();
    }
    latch.await();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("message", "ok");
    return map;
}
Also used : HashMap(java.util.HashMap) CountDownLatch(java.util.concurrent.CountDownLatch) Description(com.navercorp.pinpoint.testapp.util.Description) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 27 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody 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 28 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody 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;
}
Also used : LegacyAgentStatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) StopWatch(org.springframework.util.StopWatch) TimeWindowSlotCentricSampler(com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 29 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody 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;
}
Also used : LegacyAgentStatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) StopWatch(org.springframework.util.StopWatch) TimeWindowSlotCentricSampler(com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 30 with ResponseBody

use of org.springframework.web.bind.annotation.ResponseBody in project pinpoint by naver.

the class MapController method getServerMapData.

/**
     * Server map data query within from ~ to timeframe
     *
     * @param applicationName
     * @param serviceTypeCode
     * @param from
     * @param to
     * @return
     */
@RequestMapping(value = "/getServerMapData", method = RequestMethod.GET, params = "serviceTypeCode")
@ResponseBody
public MapWrap getServerMapData(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeCode") short serviceTypeCode, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam(value = "callerRange", defaultValue = DEFAULT_SEARCH_DEPTH) int callerRange, @RequestParam(value = "calleeRange", defaultValue = DEFAULT_SEARCH_DEPTH) int calleeRange) {
    final Range range = new Range(from, to);
    this.dateLimit.limit(range);
    SearchOption searchOption = new SearchOption(callerRange, calleeRange);
    assertSearchOption(searchOption);
    Application application = applicationFactory.createApplication(applicationName, serviceTypeCode);
    return selectApplicationMap(application, range, searchOption);
}
Also used : SearchOption(com.navercorp.pinpoint.web.vo.SearchOption) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ResponseBody (org.springframework.web.bind.annotation.ResponseBody)491 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)454 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)84 ApiOperation (io.swagger.annotations.ApiOperation)64 ArrayList (java.util.ArrayList)55 HashMap (java.util.HashMap)50 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)47 ResponseEntity (org.springframework.http.ResponseEntity)39 CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)37 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)36 RootNode (org.hisp.dhis.node.types.RootNode)33 IOException (java.io.IOException)22 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)22 CollectionNode (org.hisp.dhis.node.types.CollectionNode)19 GetMapping (org.springframework.web.bind.annotation.GetMapping)19 Date (java.util.Date)18 User (org.hisp.dhis.user.User)17 Range (com.navercorp.pinpoint.web.vo.Range)15 Text (org.orcid.pojo.ajaxForm.Text)15 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)14