Search in sources :

Example 96 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping 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)

Example 97 with RequestMapping

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

the class MapController method getResponseTimeHistogramData.

@RequestMapping(value = "/getResponseTimeHistogramData", method = RequestMethod.GET, params = "serviceTypeName")
@ResponseBody
public ApplicationTimeHistogramViewModel getResponseTimeHistogramData(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeName") String serviceTypeName, @RequestParam("from") long from, @RequestParam("to") long to) {
    final Range range = new Range(from, to);
    dateLimit.limit(range);
    Application application = applicationFactory.createApplicationByTypeName(applicationName, serviceTypeName);
    ApplicationTimeHistogramViewModel applicationTimeHistogramViewModel = mapService.selectResponseTimeHistogramData(application, range);
    return applicationTimeHistogramViewModel;
}
Also used : ApplicationTimeHistogramViewModel(com.navercorp.pinpoint.web.view.ApplicationTimeHistogramViewModel) 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)

Example 98 with RequestMapping

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

the class AgentCommandController method getActiveThreadDump.

@RequestMapping(value = "/activeThreadDump", method = RequestMethod.GET)
public ModelAndView getActiveThreadDump(@RequestParam(value = "applicationName") String applicationName, @RequestParam(value = "agentId") String agentId, @RequestParam(value = "limit", required = false, defaultValue = "-1") int limit, @RequestParam(value = "threadName", required = false) String[] threadNameList, @RequestParam(value = "localTraceId", required = false) Long[] localTraceIdList) throws TException {
    if (!webProperties.isEnableActiveThreadDump()) {
        return createResponse(false, "Disable activeThreadDump option. 'config.enable.activeThreadDump=false'");
    }
    AgentInfo agentInfo = agentService.getAgentInfo(applicationName, agentId);
    if (agentInfo == null) {
        return createResponse(false, String.format("Can't find suitable Agent(%s/%s)", applicationName, agentId));
    }
    TCmdActiveThreadDump threadDump = new TCmdActiveThreadDump();
    if (limit > 0) {
        threadDump.setLimit(limit);
    }
    if (threadNameList != null) {
        threadDump.setThreadNameList(Arrays.asList(threadNameList));
    }
    if (localTraceIdList != null) {
        threadDump.setLocalTraceIdList(Arrays.asList(localTraceIdList));
    }
    try {
        PinpointRouteResponse pinpointRouteResponse = agentService.invoke(agentInfo, threadDump);
        if (isSuccessResponse(pinpointRouteResponse)) {
            TBase<?, ?> result = pinpointRouteResponse.getResponse();
            if (result instanceof TCmdActiveThreadDumpRes) {
                TCmdActiveThreadDumpRes activeThreadDumpResponse = (TCmdActiveThreadDumpRes) result;
                List<TActiveThreadDump> activeThreadDumps = activeThreadDumpResponse.getThreadDumps();
                AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
                AgentActiveThreadDumpList activeThreadDumpList = factory.create1(activeThreadDumps);
                Map<String, Object> responseData = createResponseData(activeThreadDumpList, activeThreadDumpResponse.getType(), activeThreadDumpResponse.getSubType(), activeThreadDumpResponse.getVersion());
                return createResponse(true, responseData);
            }
        }
        return handleFailedResponse(pinpointRouteResponse);
    } catch (TException e) {
        return createResponse(false, e.getMessage());
    }
}
Also used : AgentActiveThreadDumpList(com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList) TException(org.apache.thrift.TException) TCmdActiveThreadDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes) AgentActiveThreadDumpFactory(com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) TCmdActiveThreadDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump) PinpointRouteResponse(com.navercorp.pinpoint.web.cluster.PinpointRouteResponse) TActiveThreadDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 99 with RequestMapping

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

the class AgentCommandController method getActiveThreadLightDump.

@RequestMapping(value = "/activeThreadLightDump", method = RequestMethod.GET)
public ModelAndView getActiveThreadLightDump(@RequestParam(value = "applicationName") String applicationName, @RequestParam(value = "agentId") String agentId, @RequestParam(value = "limit", required = false, defaultValue = "-1") int limit, @RequestParam(value = "threadName", required = false) String[] threadNameList, @RequestParam(value = "localTraceId", required = false) Long[] localTraceIdList) throws TException {
    if (!webProperties.isEnableActiveThreadDump()) {
        return createResponse(false, "Disable activeThreadDump option. 'config.enable.activeThreadDump=false'");
    }
    AgentInfo agentInfo = agentService.getAgentInfo(applicationName, agentId);
    if (agentInfo == null) {
        return createResponse(false, String.format("Can't find suitable Agent(%s/%s)", applicationName, agentId));
    }
    TCmdActiveThreadLightDump threadDump = new TCmdActiveThreadLightDump();
    if (limit > 0) {
        threadDump.setLimit(limit);
    }
    if (threadNameList != null) {
        threadDump.setThreadNameList(Arrays.asList(threadNameList));
    }
    if (localTraceIdList != null) {
        threadDump.setLocalTraceIdList(Arrays.asList(localTraceIdList));
    }
    try {
        PinpointRouteResponse pinpointRouteResponse = agentService.invoke(agentInfo, threadDump);
        if (isSuccessResponse(pinpointRouteResponse)) {
            TBase<?, ?> result = pinpointRouteResponse.getResponse();
            if (result instanceof TCmdActiveThreadLightDumpRes) {
                TCmdActiveThreadLightDumpRes activeThreadDumpResponse = (TCmdActiveThreadLightDumpRes) result;
                List<TActiveThreadLightDump> activeThreadDumps = activeThreadDumpResponse.getThreadDumps();
                AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
                AgentActiveThreadDumpList activeThreadDumpList = factory.create2(activeThreadDumps);
                Map<String, Object> responseData = createResponseData(activeThreadDumpList, activeThreadDumpResponse.getType(), activeThreadDumpResponse.getSubType(), activeThreadDumpResponse.getVersion());
                return createResponse(true, responseData);
            }
        }
        return handleFailedResponse(pinpointRouteResponse);
    } catch (TException e) {
        return createResponse(false, e.getMessage());
    }
}
Also used : AgentActiveThreadDumpList(com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList) TException(org.apache.thrift.TException) TCmdActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump) AgentActiveThreadDumpFactory(com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory) TCmdActiveThreadLightDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) PinpointRouteResponse(com.navercorp.pinpoint.web.cluster.PinpointRouteResponse) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 100 with RequestMapping

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

the class AgentStatController method getAgentStatChartList.

@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/chartList", method = RequestMethod.GET)
@ResponseBody
public List<AgentStatChartGroup> getAgentStatChartList(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to) {
    TimeWindowSampler sampler = new TimeWindowSlotCentricSampler();
    TimeWindow timeWindow = new TimeWindow(new Range(from, to), sampler);
    return this.agentStatChartService.selectAgentChartList(agentId, timeWindow);
}
Also used : TimeWindowSampler(com.navercorp.pinpoint.web.util.TimeWindowSampler) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) 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)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1622 ModelAndView (org.springframework.web.servlet.ModelAndView)401 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)375 ArrayList (java.util.ArrayList)177 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)175 HashMap (java.util.HashMap)147 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)124 IOException (java.io.IOException)83 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)75 Date (java.util.Date)73 ApiOperation (io.swagger.annotations.ApiOperation)68 User (org.hisp.dhis.user.User)59 HttpServletResponse (javax.servlet.http.HttpServletResponse)56 ResponseEntity (org.springframework.http.ResponseEntity)56 InputStream (java.io.InputStream)53 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)51 Locale (java.util.Locale)50 CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)47 DBObject (com.mongodb.DBObject)46 Aggregation (org.springframework.data.mongodb.core.aggregation.Aggregation)45