Search in sources :

Example 1 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class DataSourceChartGroupTest method basicFunctionTest2.

@Test
public void basicFunctionTest2() throws Exception {
    long currentTimeMillis = System.currentTimeMillis();
    TimeWindow timeWindow = new TimeWindow(new Range(currentTimeMillis - 300000, currentTimeMillis));
    List<SampledDataSource> sampledDataSourceList = Collections.emptyList();
    DataSourceChartGroup dataSourceChartGroup = new DataSourceChartGroup(timeWindow, sampledDataSourceList, serviceTypeRegistryService);
    Assert.assertEquals(-1, dataSourceChartGroup.getId());
    Assert.assertEquals(null, dataSourceChartGroup.getJdbcUrl());
    Assert.assertEquals(null, dataSourceChartGroup.getDatabaseName());
    Assert.assertEquals(null, dataSourceChartGroup.getServiceTypeName());
}
Also used : SampledDataSource(com.navercorp.pinpoint.web.vo.stat.SampledDataSource) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 2 with TimeWindow

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

use of com.navercorp.pinpoint.web.util.TimeWindow 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 4 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow 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)

Example 5 with TimeWindow

use of com.navercorp.pinpoint.web.util.TimeWindow in project pinpoint by naver.

the class FilteredMapServiceImpl method createMap.

private ApplicationMap createMap(Range range, Range scanRange, List<List<SpanBo>> filterList) {
    // TODO inject TimeWindow from elsewhere 
    final TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
    final LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
    final ResponseHistogramBuilder mapHistogramSummary = new ResponseHistogramBuilder(range);
    /*
         * Convert to statistical data
         */
    for (List<SpanBo> transaction : filterList) {
        final Map<Long, SpanBo> transactionSpanMap = checkDuplicatedSpanId(transaction);
        for (SpanBo span : transaction) {
            final Application parentApplication = createParentApplication(span, transactionSpanMap);
            final Application spanApplication = this.applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
            // records the Span's response time statistics
            recordSpanResponseTime(spanApplication, span, mapHistogramSummary, span.getCollectorAcceptTime());
            if (!spanApplication.getServiceType().isRecordStatistics() || spanApplication.getServiceType().isRpcClient()) {
                // span's serviceType is probably not set correctly
                logger.warn("invalid span application:{}", spanApplication);
                continue;
            }
            final short slotTime = getHistogramSlotTime(span, spanApplication.getServiceType());
            // might need to reconsider using collector's accept time for link statistics.
            // we need to convert to time window's timestamp. If not, it may lead to OOM due to mismatch in timeslots. 
            long timestamp = window.refineTimestamp(span.getCollectorAcceptTime());
            if (parentApplication.getServiceType() == ServiceType.USER) {
                // Outbound data
                if (logger.isTraceEnabled()) {
                    logger.trace("span user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                final LinkDataMap sourceLinkData = linkDataDuplexMap.getSourceLinkDataMap();
                sourceLinkData.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
                if (logger.isTraceEnabled()) {
                    logger.trace("span target user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                // Inbound data
                final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
                targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
            } else {
                // Inbound data
                if (logger.isTraceEnabled()) {
                    logger.trace("span target parent:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
                targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
            }
            if (serverMapDataFilter != null && serverMapDataFilter.filter(spanApplication)) {
                continue;
            }
            addNodeFromSpanEvent(span, window, linkDataDuplexMap, transactionSpanMap);
        }
    }
    ApplicationMapBuilder applicationMapBuilder = new ApplicationMapBuilder(range);
    mapHistogramSummary.build();
    ApplicationMap map = applicationMapBuilder.build(linkDataDuplexMap, agentInfoService, mapHistogramSummary);
    if (serverMapDataFilter != null) {
        map = serverMapDataFilter.dataFiltering(map);
    }
    return map;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) ApplicationMapBuilder(com.navercorp.pinpoint.web.applicationmap.ApplicationMapBuilder) ResponseHistogramBuilder(com.navercorp.pinpoint.web.vo.ResponseHistogramBuilder) Application(com.navercorp.pinpoint.web.vo.Application) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Aggregations

TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)42 Test (org.junit.Test)26 Range (com.navercorp.pinpoint.web.vo.Range)25 ArrayList (java.util.ArrayList)14 StatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup)13 Chart (com.navercorp.pinpoint.web.vo.chart.Chart)12 Point (com.navercorp.pinpoint.web.vo.chart.Point)12 TimeWindowSampler (com.navercorp.pinpoint.web.util.TimeWindowSampler)8 TimeWindowSlotCentricSampler (com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler)8 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 SampledDataSource (com.navercorp.pinpoint.web.vo.stat.SampledDataSource)6 GetMapping (org.springframework.web.bind.annotation.GetMapping)5 List (java.util.List)4 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)3 SampledAgentStatDataPoint (com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint)3 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)3 StopWatch (org.springframework.util.StopWatch)3