Search in sources :

Example 36 with TimeWindow

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

the class ResponseTimeChartGroupTest method basicFunctionTest1.

@Test
public void basicFunctionTest1() throws Exception {
    long currentTimeMillis = System.currentTimeMillis();
    TimeWindow timeWindow = new TimeWindow(Range.newRange(currentTimeMillis - 300000, currentTimeMillis));
    List<SampledResponseTime> sampledResponseTimeList = createSampledResponseTimeList(timeWindow);
    StatChartGroup responseTimeChartGroup = new ResponseTimeChart.ResponseTimeChartGroup(timeWindow, sampledResponseTimeList);
    assertEquals(sampledResponseTimeList, responseTimeChartGroup);
}
Also used : StatChartGroup(com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup) SampledResponseTime(com.navercorp.pinpoint.web.vo.stat.SampledResponseTime) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 37 with TimeWindow

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

the class TimeSeriesChartBuilderTest method empty.

@Test
public void empty() {
    // Given
    int numSlots = 10;
    TimeWindow timeWindow = new TimeWindow(Range.newRange(0, TIME_WINDOW_SIZE * numSlots), TIME_WINDOW_SAMPLER);
    TimeSeriesChartBuilder<TestPoint> builder = new TimeSeriesChartBuilder<>(timeWindow, TestPoint.UNCOLLECTED_POINT_CREATOR);
    List<TestPoint> points = Collections.emptyList();
    // When
    Chart<TestPoint> chart = builder.build(points);
    // Then
    List<TestPoint> sampledPoints = chart.getPoints();
    Assert.assertTrue(sampledPoints.isEmpty());
}
Also used : TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

Example 38 with TimeWindow

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

the class HbaseMapStatisticsCallerDao method selectCaller.

@Override
public LinkDataMap selectCaller(Application callerApplication, Range range) {
    Objects.requireNonNull(callerApplication, "callerApplication");
    Objects.requireNonNull(range, "range");
    final TimeWindow timeWindow = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
    // find distributed key.
    final Scan scan = createScan(callerApplication, range, DESCRIPTOR.getName());
    ResultsExtractor<LinkDataMap> resultExtractor = new RowMapReduceResultExtractor<>(mapStatisticsCallerMapper, new MapStatisticsTimeWindowReducer(timeWindow));
    TableName mapStatisticsCalleeTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    LinkDataMap linkDataMap = this.hbaseTemplate.findParallel(mapStatisticsCalleeTableName, scan, rowKeyDistributorByHashPrefix, resultExtractor, MAP_STATISTICS_CALLEE_VER2_NUM_PARTITIONS);
    logger.debug("tableInfo({}). Caller data. {}, {} : ", mapStatisticsCalleeTableName.getNameAsString(), linkDataMap, range);
    if (linkDataMap != null && linkDataMap.size() > 0) {
        return linkDataMap;
    }
    return new LinkDataMap();
}
Also used : TableName(org.apache.hadoop.hbase.TableName) MapStatisticsTimeWindowReducer(com.navercorp.pinpoint.web.mapper.MapStatisticsTimeWindowReducer) Scan(org.apache.hadoop.hbase.client.Scan) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) RowMapReduceResultExtractor(com.navercorp.pinpoint.web.mapper.RowMapReduceResultExtractor) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 39 with TimeWindow

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

the class AgentStatController method getAgentStatChart.

@GetMapping(value = "/chart")
public StatChart getAgentStatChart(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to) {
    TimeWindowSampler sampler = new TimeWindowSlotCentricSampler();
    TimeWindow timeWindow = new TimeWindow(Range.newRange(from, to), sampler);
    return this.agentStatChartService.selectAgentChart(agentId, timeWindow);
}
Also used : TimeWindowSampler(com.navercorp.pinpoint.web.util.TimeWindowSampler) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) TimeWindowSlotCentricSampler(com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 40 with TimeWindow

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

the class AgentStatController method getAgentStatChartList.

@GetMapping(value = "/chartList")
public List<StatChart> getAgentStatChartList(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to) {
    TimeWindowSampler sampler = new TimeWindowSlotCentricSampler();
    TimeWindow timeWindow = new TimeWindow(Range.newRange(from, to), sampler);
    return this.agentStatChartService.selectAgentChartList(agentId, timeWindow);
}
Also used : TimeWindowSampler(com.navercorp.pinpoint.web.util.TimeWindowSampler) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) TimeWindowSlotCentricSampler(com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler) GetMapping(org.springframework.web.bind.annotation.GetMapping)

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