Search in sources :

Example 31 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class TimeWindowTest method testGetNextWindow.

@Test
public void testGetNextWindow() throws Exception {
    Range range = new Range(0L, TimeUnit.MINUTES.toMillis(1));
    TimeWindow window = new TimeWindow(range);
    int i = 0;
    for (Long aLong : window) {
        i++;
    }
    Assert.assertEquals(i, 2);
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 32 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class TimeWindowTest method testGetWindowRangeLength.

@Test
public void testGetWindowRangeLength() throws Exception {
    Range range = new Range(1L, 2L);
    TimeWindow window = new TimeWindow(range);
    long windowRangeLength = window.getWindowRangeCount();
    logger.debug("{}", windowRangeLength);
    Assert.assertEquals(1, windowRangeLength);
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 33 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class TimeWindowTest method testRefineIndex1.

@Test
public void testRefineIndex1() throws Exception {
    Range range = new Range(1L, 1000 * 60L);
    TimeWindow window = new TimeWindow(range);
    long index = window.getWindowIndex(2);
    logger.debug("{}", index);
    Assert.assertEquals(0, index);
}
Also used : Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 34 with Range

use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.

the class AgentStatusTimelineTest method multipleLifeCycles_overlap4.

@Test
public void multipleLifeCycles_overlap4() {
    // Given
    Range timelineRange = new Range(100, 200);
    List<AgentStatusTimelineSegment> expectedTimelineSegments = Collections.singletonList(createSegment(100, 200, AgentState.RUNNING));
    // When
    long agentA = 90;
    long agentB = 130;
    long agentC = 160;
    long agentD = 180;
    AgentStatus initialStatus = createAgentStatus(90, AgentLifeCycleState.RUNNING);
    AgentStatusTimeline timeline = new AgentStatusTimelineBuilder(timelineRange, initialStatus).from(Arrays.asList(createAgentEvent(agentA, 120, AgentEventType.AGENT_PING), createAgentEvent(agentB, 130, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentA, 150, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentC, 160, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentB, 170, AgentEventType.AGENT_SHUTDOWN), createAgentEvent(agentD, 180, AgentEventType.AGENT_CONNECTED), createAgentEvent(agentC, 190, AgentEventType.AGENT_SHUTDOWN))).build();
    // Then
    Assert.assertEquals(expectedTimelineSegments, timeline.getTimelineSegments());
    Assert.assertTrue(timeline.isIncludeWarning());
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Example 35 with Range

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

Aggregations

Range (com.navercorp.pinpoint.web.vo.Range)101 Test (org.junit.Test)62 TimeWindow (com.navercorp.pinpoint.web.util.TimeWindow)23 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)16 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)15 Application (com.navercorp.pinpoint.web.vo.Application)12 SampledAgentStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor)9 List (java.util.List)8 AgentEvent (com.navercorp.pinpoint.web.vo.AgentEvent)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)6 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)6 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)5 TimeWindowSlotCentricSampler (com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler)5 LegacyAgentStatChartGroup (com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup)5 ArrayList (java.util.ArrayList)5 TimeWindowSampler (com.navercorp.pinpoint.web.util.TimeWindowSampler)4 StopWatch (org.springframework.util.StopWatch)4 ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)3