Search in sources :

Example 6 with TimeWindow

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

the class AgentStatController method getAgentStatChart.

@GetMapping(value = "/chart", params = { "interval" })
public StatChart getAgentStatChart(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam("interval") Integer interval) {
    final int minSamplingInterval = 5;
    final long intervalMs = interval < minSamplingInterval ? minSamplingInterval * 1000L : interval * 1000L;
    TimeWindowSampler sampler = new TimeWindowSampler() {

        @Override
        public long getWindowSize(Range range) {
            return intervalMs;
        }
    };
    TimeWindow timeWindow = new TimeWindow(Range.newRange(from, to), sampler);
    return this.agentStatChartService.selectAgentChart(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) AgentStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 7 with TimeWindow

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

the class AgentStatController method getAgentStatChartList.

@GetMapping(value = "/chartList", params = { "interval" })
public List<StatChart> getAgentStatChartList(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam("interval") Integer interval) {
    final int minSamplingInterval = 5;
    final long intervalMs = interval < minSamplingInterval ? minSamplingInterval * 1000L : interval * 1000L;
    TimeWindowSampler sampler = new TimeWindowSampler() {

        @Override
        public long getWindowSize(Range range) {
            return intervalMs;
        }
    };
    TimeWindow timeWindow = new TimeWindow(Range.newRange(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) AgentStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 8 with TimeWindow

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

the class HbaseMapStatisticsCalleeDao method selectCallee.

@Override
public LinkDataMap selectCallee(Application calleeApplication, Range range) {
    Objects.requireNonNull(calleeApplication, "calleeApplication");
    Objects.requireNonNull(range, "range");
    final TimeWindow timeWindow = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
    // find distributed key - ver2.
    final Scan scan = createScan(calleeApplication, range, DESCRIPTOR.getName());
    ResultsExtractor<LinkDataMap> resultExtractor = new RowMapReduceResultExtractor<>(mapStatisticsCalleeMapper, new MapStatisticsTimeWindowReducer(timeWindow));
    TableName mapStatisticsCallerTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    LinkDataMap linkDataMap = hbaseTemplate.findParallel(mapStatisticsCallerTableName, scan, rowKeyDistributorByHashPrefix, resultExtractor, MAP_STATISTICS_CALLER_VER2_NUM_PARTITIONS);
    logger.debug("Callee data. {}, {}", 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 9 with TimeWindow

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

the class StatChartGroupSerializer method serialize.

@Override
public void serialize(StatChartGroup statChartGroup, JsonGenerator jgen, SerializerProvider serializers) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    Map<StatChartGroup.ChartType, Chart<? extends Point>> charts = statChartGroup.getCharts();
    writeSchema(jgen, charts.keySet());
    TimeWindow timeWindow = statChartGroup.getTimeWindow();
    writeTimestamp(jgen, timeWindow);
    writeCharts(jgen, charts);
    jgen.writeEndObject();
}
Also used : Point(com.navercorp.pinpoint.web.vo.chart.Point) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Chart(com.navercorp.pinpoint.web.vo.chart.Chart)

Example 10 with TimeWindow

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

the class LinkCallDataTest method addCallData.

@Test
public void addCallData() {
    LinkKey key = new LinkKey("fromApplication", ServiceType.STAND_ALONE, "toApplication", ServiceType.STAND_ALONE);
    long currentTime = System.currentTimeMillis();
    LinkCallData data1 = new LinkCallData(key);
    data1.addCallData(currentTime, (short) 100, 1L);
    data1.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
    data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    logger.debug("{}", data1.getTimeHistogram().size());
    Range range = Range.newRange(currentTime, currentTime + SIX_HOURS);
    TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
    LinkCallData data2 = new LinkCallData(key, window);
    data2.addCallData(currentTime, (short) 100, 1L);
    data2.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
    data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
    logger.debug("{}", data2.getTimeHistogram().size());
}
Also used : LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) Range(com.navercorp.pinpoint.web.vo.Range) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) Test(org.junit.Test)

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