mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-15 15:55:54 +10:00
#1533 Add web support for agent stat storage version 2
This commit is contained in:
@@ -16,14 +16,17 @@
|
||||
|
||||
package com.navercorp.pinpoint.web.alarm;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.AgentStatDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.navercorp.pinpoint.web.alarm.collector.AgentStatDataCollector;
|
||||
import com.navercorp.pinpoint.web.alarm.collector.DataCollector;
|
||||
import com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector;
|
||||
import com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.HbaseAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.HbaseApplicationIndexDao;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.HbaseMapResponseTimeDao;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.HbaseMapStatisticsCallerDao;
|
||||
@@ -43,7 +46,12 @@ public class DataCollectorFactory {
|
||||
private HbaseMapResponseTimeDao hbaseMapResponseTimeDao;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDao hbaseAgentStatDao;
|
||||
@Qualifier("jvmGcDaoFactory")
|
||||
private AgentStatDao<JvmGcBo> jvmGcDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("cpuLoadDaoFactory")
|
||||
private AgentStatDao<CpuLoadBo> cpuLoadDao;
|
||||
|
||||
@Autowired
|
||||
private HbaseApplicationIndexDao hbaseApplicationIndexDao;
|
||||
@@ -56,7 +64,7 @@ public class DataCollectorFactory {
|
||||
case RESPONSE_TIME:
|
||||
return new ResponseTimeDataCollector(DataCollectorCategory.RESPONSE_TIME, application, hbaseMapResponseTimeDao, timeSlotEndTime, SLOT_INTERVAL_FIVE_MIN);
|
||||
case AGENT_STAT:
|
||||
return new AgentStatDataCollector(DataCollectorCategory.AGENT_STAT, application, hbaseAgentStatDao, hbaseApplicationIndexDao, timeSlotEndTime, SLOT_INTERVAL_FIVE_MIN);
|
||||
return new AgentStatDataCollector(DataCollectorCategory.AGENT_STAT, application, jvmGcDao, cpuLoadDao, hbaseApplicationIndexDao, timeSlotEndTime, SLOT_INTERVAL_FIVE_MIN);
|
||||
case CALLER_STAT:
|
||||
return new MapStatisticsCallerDataCollector(DataCollectorCategory.CALLER_STAT, application, mapStatisticsCallerDao, timeSlotEndTime, SLOT_INTERVAL_FIVE_MIN);
|
||||
}
|
||||
|
||||
+24
-18
@@ -21,10 +21,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.alarm.DataCollectorFactory.DataCollectorCategory;
|
||||
import com.navercorp.pinpoint.web.dao.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.ApplicationIndexDao;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Application;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
|
||||
@@ -34,7 +35,8 @@ import com.navercorp.pinpoint.web.vo.Range;
|
||||
public class AgentStatDataCollector extends DataCollector {
|
||||
|
||||
private final Application application;
|
||||
private final AgentStatDao agentStatDao;
|
||||
private final AgentStatDao<JvmGcBo> jvmGcDao;
|
||||
private final AgentStatDao<CpuLoadBo> cpuLoadDao;
|
||||
private final ApplicationIndexDao applicationIndexDao;
|
||||
private final long timeSlotEndTime;
|
||||
private final long slotInterval;
|
||||
@@ -44,10 +46,11 @@ public class AgentStatDataCollector extends DataCollector {
|
||||
private final Map<String, Long> agentGcCount = new HashMap<>();
|
||||
private final Map<String, Long> agentJvmCpuUsageRate = new HashMap<>();
|
||||
|
||||
public AgentStatDataCollector(DataCollectorCategory category, Application application, AgentStatDao agentStatDao, ApplicationIndexDao applicationIndexDao, long timeSlotEndTime, long slotInterval) {
|
||||
public AgentStatDataCollector(DataCollectorCategory category, Application application, AgentStatDao<JvmGcBo> jvmGcDao, AgentStatDao<CpuLoadBo> cpuLoadDao, ApplicationIndexDao applicationIndexDao, long timeSlotEndTime, long slotInterval) {
|
||||
super(category);
|
||||
this.application = application;
|
||||
this.agentStatDao = agentStatDao;
|
||||
this.jvmGcDao = jvmGcDao;
|
||||
this.cpuLoadDao = cpuLoadDao;
|
||||
this.applicationIndexDao = applicationIndexDao;
|
||||
this.timeSlotEndTime = timeSlotEndTime;
|
||||
this.slotInterval = slotInterval;
|
||||
@@ -63,29 +66,32 @@ public class AgentStatDataCollector extends DataCollector {
|
||||
List<String> agentIds = applicationIndexDao.selectAgentIds(application.getName());
|
||||
|
||||
for(String agentId : agentIds) {
|
||||
List<AgentStat> scanAgentStatList = agentStatDao.getAgentStatList(agentId, range);
|
||||
int listSize = scanAgentStatList.size();
|
||||
List<JvmGcBo> jvmGcBos = jvmGcDao.getAgentStatList(agentId, range);
|
||||
List<CpuLoadBo> cpuLoadBos = cpuLoadDao.getAgentStatList(agentId, range);
|
||||
long totalHeapSize = 0;
|
||||
long usedHeapSize = 0;
|
||||
long jvmCpuUsaged = 0;
|
||||
|
||||
for (AgentStat agentStat : scanAgentStatList) {
|
||||
totalHeapSize += agentStat.getHeapMax();
|
||||
usedHeapSize += agentStat.getHeapUsed();
|
||||
|
||||
jvmCpuUsaged += agentStat.getJvmCpuUsage() * 100;
|
||||
for (JvmGcBo jvmGcBo : jvmGcBos) {
|
||||
totalHeapSize += jvmGcBo.getHeapMax();
|
||||
usedHeapSize += jvmGcBo.getHeapUsed();
|
||||
}
|
||||
|
||||
if(listSize > 0) {
|
||||
for (CpuLoadBo cpuLoadBo : cpuLoadBos) {
|
||||
jvmCpuUsaged += cpuLoadBo.getJvmCpuLoad() * 100;
|
||||
}
|
||||
|
||||
if (!jvmGcBos.isEmpty()) {
|
||||
long percent = calculatePercent(usedHeapSize, totalHeapSize);
|
||||
agentHeapUsageRate.put(agentId, percent);
|
||||
|
||||
percent = calculatePercent(jvmCpuUsaged, 100*scanAgentStatList.size());
|
||||
long accruedLastGcCount = jvmGcBos.get(0).getGcOldCount();
|
||||
long accruedFirstGcCount = jvmGcBos.get(jvmGcBos.size() - 1).getGcOldCount();
|
||||
agentGcCount.put(agentId, accruedLastGcCount - accruedFirstGcCount);
|
||||
}
|
||||
if (!cpuLoadBos.isEmpty()) {
|
||||
long percent = calculatePercent(jvmCpuUsaged, 100 * cpuLoadBos.size());
|
||||
agentJvmCpuUsageRate.put(agentId, percent);
|
||||
|
||||
long accruedLastGCcount = scanAgentStatList.get(0).getGcOldCount();
|
||||
long accruedFirstGCcount= scanAgentStatList.get(listSize - 1).getGcOldCount();
|
||||
agentGcCount.put(agentId, accruedLastGCcount - accruedFirstGCcount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.controller;
|
||||
|
||||
import com.navercorp.pinpoint.web.service.AgentEventService;
|
||||
import com.navercorp.pinpoint.web.service.AgentInfoService;
|
||||
import com.navercorp.pinpoint.web.vo.AgentEvent;
|
||||
import com.navercorp.pinpoint.web.vo.AgentInfo;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStatus;
|
||||
import com.navercorp.pinpoint.web.vo.ApplicationAgentList;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Controller
|
||||
public class AgentInfoController {
|
||||
|
||||
@Autowired
|
||||
private AgentInfoService agentInfoService;
|
||||
|
||||
@Autowired
|
||||
private AgentEventService agentEventService;
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList() {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application", "from", "to"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME, to);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(#applicationName, 'application', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application", "timestamp"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(#applicationName, 'application', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application", "from", "to"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName,
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName, to);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(#applicationName, 'application', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application", "timestamp"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentInfo", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentInfo getAgentInfo(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getAgentInfo(agentId, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentStatus", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentStatus getAgentStatus(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getAgentStatus(agentId, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentEvent", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentEvent getAgentEvent(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("eventTimestamp") long eventTimestamp,
|
||||
@RequestParam("eventTypeCode") int eventTypeCode) {
|
||||
return this.agentEventService.getAgentEvent(agentId, eventTimestamp, eventTypeCode);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentEvents", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public List<AgentEvent> getAgentEvents(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to,
|
||||
@RequestParam(value = "exclude", defaultValue = "") int[] excludeEventTypeCodes) {
|
||||
Range range = new Range(from, to);
|
||||
return this.agentEventService.getAgentEvents(agentId, range, excludeEventTypeCodes);
|
||||
}
|
||||
}
|
||||
@@ -18,178 +18,136 @@ package com.navercorp.pinpoint.web.controller;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.service.stat.ActiveTraceChartService;
|
||||
import com.navercorp.pinpoint.web.service.stat.AgentStatChartService;
|
||||
import com.navercorp.pinpoint.web.service.stat.CpuLoadChartService;
|
||||
import com.navercorp.pinpoint.web.service.stat.JvmGcChartService;
|
||||
import com.navercorp.pinpoint.web.service.stat.JvmGcDetailedChartService;
|
||||
import com.navercorp.pinpoint.web.service.stat.JvmGcService;
|
||||
import com.navercorp.pinpoint.web.service.stat.TransactionChartService;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindowSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.navercorp.pinpoint.web.service.AgentEventService;
|
||||
import com.navercorp.pinpoint.web.service.AgentInfoService;
|
||||
import com.navercorp.pinpoint.web.service.AgentStatService;
|
||||
import com.navercorp.pinpoint.web.service.stat.AgentStatService;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler;
|
||||
import com.navercorp.pinpoint.web.vo.AgentEvent;
|
||||
import com.navercorp.pinpoint.web.vo.AgentInfo;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStatus;
|
||||
import com.navercorp.pinpoint.web.vo.ApplicationAgentList;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.agentstat.AgentStatChartGroup;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
* @author minwoo.jung
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Controller
|
||||
public class AgentStatController {
|
||||
private static final long USE_AGGREGATED_THRESHOLD = TimeUnit.HOURS.toMillis(24);
|
||||
private static final int MAX_RESPONSE_SIZE = 200;
|
||||
public abstract class AgentStatController<T extends AgentStatDataPoint> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final AgentStatService<T> agentStatService;
|
||||
|
||||
@Autowired
|
||||
private AgentStatService agentStatService;
|
||||
private final AgentStatChartService agentStatChartService;
|
||||
|
||||
@Autowired
|
||||
private AgentInfoService agentInfoService;
|
||||
|
||||
@Autowired
|
||||
private AgentEventService agentEventService;
|
||||
public AgentStatController(AgentStatService<T> agentStatService, AgentStatChartService agentStatChartService) {
|
||||
this.agentStatService = agentStatService;
|
||||
this.agentStatChartService = agentStatChartService;
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentStat", method = RequestMethod.GET)
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentStatChartGroup getAgentStat(
|
||||
public List<T> 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");
|
||||
|
||||
Range requestRange = new Range(from, to);
|
||||
boolean useAggregated = requestRange.getRange() > USE_AGGREGATED_THRESHOLD;
|
||||
|
||||
long interval = useAggregated ? AgentStat.AGGR_SAMPLE_INTERVAL : AgentStat.RAW_SAMPLE_INTERVAL;
|
||||
TimeWindowSlotCentricSampler sampler = new TimeWindowSlotCentricSampler(interval, MAX_RESPONSE_SIZE);
|
||||
@RequestParam("to") long to) {
|
||||
Range rangeToScan = new Range(from, to);
|
||||
return this.agentStatService.selectAgentStatList(agentId, rangeToScan);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
|
||||
@RequestMapping(value = "/chart", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentStatChartGroup getAgentStatChart(
|
||||
@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);
|
||||
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range rangeToScan = new Range(scanFrom, scanTo);
|
||||
|
||||
|
||||
List<AgentStat> agentStatList;
|
||||
|
||||
if (useAggregated) {
|
||||
agentStatList = agentStatService.selectAggregatedAgentStatList(agentId, rangeToScan);
|
||||
} else {
|
||||
agentStatList = agentStatService.selectAgentStatList(agentId, rangeToScan);
|
||||
}
|
||||
watch.stop();
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("getAgentStat(agentId={}, from={}, to={}) : {}ms", agentId, from, to, watch.getLastTaskTimeMillis());
|
||||
}
|
||||
|
||||
AgentStatChartGroup chartGroup = new AgentStatChartGroup(timeWindow);
|
||||
chartGroup.addAgentStats(agentStatList);
|
||||
chartGroup.buildCharts();
|
||||
|
||||
return chartGroup;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList() {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application", "from", "to"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME, to);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"!application", "timestamp"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(#applicationName, 'application', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application", "from", "to"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName,
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName, to);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(#applicationName, 'application', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET, params = {"application", "timestamp"})
|
||||
@ResponseBody
|
||||
public ApplicationAgentList getAgentList(
|
||||
@RequestParam("application") String applicationName,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.HOST_NAME, applicationName, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentInfo", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentInfo getAgentInfo(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getAgentInfo(agentId, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentStatus", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentStatus getAgentStatus(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("timestamp") long timestamp) {
|
||||
return this.agentInfoService.getAgentStatus(agentId, timestamp);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getAgentEvent", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AgentEvent getAgentEvent(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("eventTimestamp") long eventTimestamp,
|
||||
@RequestParam("eventTypeCode") int eventTypeCode) {
|
||||
return this.agentEventService.getAgentEvent(agentId, eventTimestamp, eventTypeCode);
|
||||
return this.agentStatChartService.selectAgentChart(agentId, timeWindow);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentEvents", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/chart", method = RequestMethod.GET, params = {"interval"})
|
||||
@ResponseBody
|
||||
public List<AgentEvent> getAgentEvents(
|
||||
public AgentStatChartGroup getAgentStatChart(
|
||||
@RequestParam("agentId") String agentId,
|
||||
@RequestParam("from") long from,
|
||||
@RequestParam("to") long to,
|
||||
@RequestParam(value = "exclude", defaultValue = "") int[] excludeEventTypeCodes) {
|
||||
Range range = new Range(from, to);
|
||||
return this.agentEventService.getAgentEvents(agentId, range, excludeEventTypeCodes);
|
||||
@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(new Range(from, to), sampler);
|
||||
return this.agentStatChartService.selectAgentChart(agentId, timeWindow);
|
||||
}
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/getAgentStat/jvmGc")
|
||||
public static class JvmGcController extends AgentStatController<JvmGcBo> {
|
||||
@Autowired
|
||||
public JvmGcController(JvmGcService jvmGcService, JvmGcChartService jvmGcChartService) {
|
||||
super(jvmGcService, jvmGcChartService);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/getAgentStat/jvmGcDetailed")
|
||||
public static class JvmGcDetailedController extends AgentStatController<JvmGcDetailedBo> {
|
||||
@Autowired
|
||||
public JvmGcDetailedController(AgentStatService<JvmGcDetailedBo> jvmGcDetailedService, JvmGcDetailedChartService jvmGcDetailedChartService) {
|
||||
super(jvmGcDetailedService, jvmGcDetailedChartService);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/getAgentStat/cpuLoad")
|
||||
public static class CpuLoadController extends AgentStatController<CpuLoadBo> {
|
||||
@Autowired
|
||||
public CpuLoadController(AgentStatService<CpuLoadBo> cpuLoadService, CpuLoadChartService cpuLoadChartService) {
|
||||
super(cpuLoadService, cpuLoadChartService);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/getAgentStat/transaction")
|
||||
public static class TransactionController extends AgentStatController<TransactionBo> {
|
||||
@Autowired
|
||||
public TransactionController(AgentStatService<TransactionBo> transactionService, TransactionChartService transactionChartService) {
|
||||
super(transactionService, transactionChartService);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/getAgentStat/activeTrace")
|
||||
public static class ActiveTraceController extends AgentStatController<ActiveTraceBo> {
|
||||
@Autowired
|
||||
public ActiveTraceController(AgentStatService<ActiveTraceBo> activeTraceService, ActiveTraceChartService activeTraceChartService) {
|
||||
super(activeTraceService, activeTraceChartService);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
package com.navercorp.pinpoint.web.controller;
|
||||
|
||||
import com.navercorp.pinpoint.web.service.AgentEventService;
|
||||
import com.navercorp.pinpoint.web.service.AgentInfoService;
|
||||
import com.navercorp.pinpoint.web.service.AgentStatService;
|
||||
import com.navercorp.pinpoint.web.vo.ApplicationAgentHostList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -33,15 +31,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@Controller
|
||||
public class ApplicationController {
|
||||
|
||||
@Autowired
|
||||
private AgentStatService agentStatService;
|
||||
|
||||
@Autowired
|
||||
private AgentInfoService agentInfoService;
|
||||
|
||||
@Autowired
|
||||
private AgentEventService agentEventService;
|
||||
|
||||
@RequestMapping(value = "/getApplicationHostInfo", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ApplicationAgentHostList getApplicationHostInfo (
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.controller;
|
||||
|
||||
import com.navercorp.pinpoint.web.service.stat.LegacyAgentStatChartService;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindowSlotCentricSampler;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* Deprecated agent stat controller only to preserve backwards compatibility until
|
||||
* testing is done for agent stat v2, and the front-end API is changed.
|
||||
*
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Controller
|
||||
public class LegacyAgentStatController {
|
||||
|
||||
private static final int MAX_RESPONSE_SIZE = 200;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartServiceFactory")
|
||||
private LegacyAgentStatChartService agentStatService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartV1Service")
|
||||
private LegacyAgentStatChartService v1Service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartV2Service")
|
||||
private LegacyAgentStatChartService v2Service;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
|
||||
@RequestMapping(value = "/getAgentStat/v2", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public LegacyAgentStatChartGroup getAgentStatV2(
|
||||
@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.v2Service.selectAgentStatList(agentId, timeWindow);
|
||||
watch.stop();
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("getAgentStatV2(agentId={}, from={}, to={}) : {}ms", agentId, from, to, watch.getLastTaskTimeMillis());
|
||||
}
|
||||
return chartGroup;
|
||||
}
|
||||
}
|
||||
+31
-30
@@ -1,30 +1,31 @@
|
||||
/*
|
||||
* Copyright 2015 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledTimeSeriesIntegerChartBuilder extends SampledTimeSeriesChartBuilder<Integer> {
|
||||
|
||||
public SampledTimeSeriesIntegerChartBuilder(DownSampler<Integer> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler, timeWindow);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledAgentStatDao<S extends SampledAgentStatDataPoint> {
|
||||
|
||||
List<S> getSampledAgentStatList(String agentId, TimeWindow timeWindow);
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.stat.compatibility.HbaseAgentStatDualReadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.ActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.CpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.TransactionDao;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
abstract class AgentStatDaoFactory<T extends AgentStatDataPoint, D extends AgentStatDao<T>> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
protected D v1;
|
||||
protected D v2;
|
||||
|
||||
@Value("#{pinpointWebProps['web.experimental.stat.format.compatibility.version'] ?: 'v1'}")
|
||||
private String mode = "v1";
|
||||
|
||||
D getDao() throws Exception {
|
||||
logger.info("AgentStatDao Compatibility {}", mode);
|
||||
if (mode.equalsIgnoreCase("v1")) {
|
||||
return v1;
|
||||
} else if (mode.equalsIgnoreCase("v2")) {
|
||||
return v2;
|
||||
} else if (mode.equalsIgnoreCase("compatibilityMode")) {
|
||||
return getCompatibilityDao(this.v1, this.v2);
|
||||
}
|
||||
return v1;
|
||||
}
|
||||
|
||||
abstract D getCompatibilityDao(D v1, D v2);
|
||||
|
||||
@Repository("jvmGcDaoFactory")
|
||||
public static class JvmGcDaoFactory extends AgentStatDaoFactory<JvmGcBo, JvmGcDao> implements FactoryBean<JvmGcDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("jvmGcDaoV1") JvmGcDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("jvmGcDaoV2") JvmGcDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JvmGcDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return JvmGcDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
JvmGcDao getCompatibilityDao(JvmGcDao v1, JvmGcDao v2) {
|
||||
return new HbaseAgentStatDualReadDao.JvmGcDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("jvmGcDetailedDaoFactory")
|
||||
public static class JvmGcDetailedDaoFactory extends AgentStatDaoFactory<JvmGcDetailedBo, JvmGcDetailedDao> implements FactoryBean<JvmGcDetailedDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("jvmGcDetailedDaoV1") JvmGcDetailedDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("jvmGcDetailedDaoV2") JvmGcDetailedDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JvmGcDetailedDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return JvmGcDetailedDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
JvmGcDetailedDao getCompatibilityDao(JvmGcDetailedDao v1, JvmGcDetailedDao v2) {
|
||||
return new HbaseAgentStatDualReadDao.JvmGcDetailedDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("cpuLoadDaoFactory")
|
||||
public static class CpuLoadDaoFactory extends AgentStatDaoFactory<CpuLoadBo, CpuLoadDao> implements FactoryBean<CpuLoadDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("cpuLoadDaoV1") CpuLoadDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("cpuLoadDaoV2") CpuLoadDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CpuLoadDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return CpuLoadDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
CpuLoadDao getCompatibilityDao(CpuLoadDao v1, CpuLoadDao v2) {
|
||||
return new HbaseAgentStatDualReadDao.CpuLoadDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("transactionDaoFactory")
|
||||
public static class TransactionDaoFactory extends AgentStatDaoFactory<TransactionBo, TransactionDao> implements FactoryBean<TransactionDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("transactionDaoV1") TransactionDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("transactionDaoV2") TransactionDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return TransactionDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
TransactionDao getCompatibilityDao(TransactionDao v1, TransactionDao v2) {
|
||||
return new HbaseAgentStatDualReadDao.TransactionDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("activeTraceDaoFactory")
|
||||
public static class ActiveTraceDaoFactory extends AgentStatDaoFactory<ActiveTraceBo, ActiveTraceDao> implements FactoryBean<ActiveTraceDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("activeTraceDaoV1") ActiveTraceDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("activeTraceDaoV2") ActiveTraceDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActiveTraceDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return ActiveTraceDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
ActiveTraceDao getCompatibilityDao(ActiveTraceDao v1, ActiveTraceDao v2) {
|
||||
return new HbaseAgentStatDualReadDao.ActiveTraceDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat;
|
||||
|
||||
import static com.navercorp.pinpoint.common.hbase.HBaseTables.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.LegacyAgentStatDao;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.navercorp.pinpoint.common.hbase.HBaseTables;
|
||||
import com.navercorp.pinpoint.common.hbase.HbaseOperations2;
|
||||
import com.navercorp.pinpoint.common.hbase.RowMapper;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.server.util.RowKeyUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.sematext.hbase.wd.AbstractRowKeyDistributor;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Repository
|
||||
public class LegacyHbaseAgentStatDao implements LegacyAgentStatDao {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private HbaseOperations2 hbaseOperations2;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatMapper")
|
||||
private RowMapper<List<AgentStat>> agentStatMapper;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("agentStatRowKeyDistributor")
|
||||
private AbstractRowKeyDistributor rowKeyDistributor;
|
||||
|
||||
private int scanCacheSize = 256;
|
||||
|
||||
public void setScanCacheSize(int scanCacheSize) {
|
||||
this.scanCacheSize = scanCacheSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AgentStat> getAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("scanAgentStat : agentId={}, {}", agentId, range);
|
||||
}
|
||||
|
||||
return getAgentStatListFromRaw(agentId, range);
|
||||
}
|
||||
|
||||
private List<AgentStat> getAgentStatListFromRaw(String agentId, Range range) {
|
||||
Scan scan = createScan(agentId, range);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
|
||||
List<List<AgentStat>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, agentStatMapper);
|
||||
|
||||
int expectedSize = (int) (range.getRange() / 5000); // data for 5 seconds
|
||||
List<AgentStat> merged = new ArrayList<>(expectedSize);
|
||||
|
||||
for (List<AgentStat> each : intermediate) {
|
||||
merged.addAll(each);
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* make a row key based on timestamp
|
||||
* FIXME there is the same duplicate code at collector's dao module
|
||||
*/
|
||||
private byte[] getRowKey(String agentId, long timestamp) {
|
||||
if (agentId == null) {
|
||||
throw new IllegalArgumentException("agentId must not null");
|
||||
}
|
||||
byte[] bAgentId = BytesUtils.toBytes(agentId);
|
||||
return RowKeyUtils.concatFixedByteAndLong(bAgentId, AGENT_NAME_MAX_LEN, TimeUtils.reverseTimeMillis(timestamp));
|
||||
}
|
||||
|
||||
private Scan createScan(String agentId, Range range) {
|
||||
Scan scan = new Scan();
|
||||
scan.setCaching(this.scanCacheSize);
|
||||
|
||||
byte[] startKey = getRowKey(agentId, range.getFrom() - 1);
|
||||
byte[] endKey = getRowKey(agentId, range.getTo());
|
||||
|
||||
// start key is replaced by end key because key has been reversed
|
||||
scan.setStartRow(endKey);
|
||||
scan.setStopRow(startKey);
|
||||
|
||||
// scan.addColumn(HBaseTables.AGENT_STAT_CF_STATISTICS, HBaseTables.AGENT_STAT_CF_STATISTICS_V1);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
scan.setId("AgentStatScan");
|
||||
|
||||
// toString() method of Scan converts a message to json format so it is slow for the first time.
|
||||
logger.debug("create scan:{}", scan);
|
||||
return scan;
|
||||
}
|
||||
}
|
||||
+236
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.hbase.stat.compatibility.HbaseSampledAgentStatDualReadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
abstract class SampledAgentStatDaoFactory<S extends SampledAgentStatDataPoint, D extends SampledAgentStatDao<S>> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
protected D v1;
|
||||
protected D v2;
|
||||
|
||||
@Value("#{pinpointWebProps['web.experimental.stat.format.compatibility.version'] ?: 'v1'}")
|
||||
private String mode = "v1";
|
||||
|
||||
D getDao() throws Exception {
|
||||
logger.info("SampledAgentStatDao Compatibility {}", mode);
|
||||
if (mode.equalsIgnoreCase("v1")) {
|
||||
return v1;
|
||||
} else if (mode.equalsIgnoreCase("v2")) {
|
||||
return v2;
|
||||
} else if (mode.equalsIgnoreCase("compatibilityMode")) {
|
||||
return getCompatibilityDao(this.v1, this.v2);
|
||||
}
|
||||
return v1;
|
||||
}
|
||||
|
||||
abstract D getCompatibilityDao(D v1, D v2);
|
||||
|
||||
@Repository("sampledJvmGcDaoFactory")
|
||||
public static class SampledJvmGcDaoFactory extends SampledAgentStatDaoFactory<SampledJvmGc, SampledJvmGcDao> implements FactoryBean<SampledJvmGcDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("sampledJvmGcDaoV1") SampledJvmGcDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("sampledJvmGcDaoV2") SampledJvmGcDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SampledJvmGcDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SampledJvmGcDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
SampledJvmGcDao getCompatibilityDao(SampledJvmGcDao v1, SampledJvmGcDao v2) {
|
||||
return new HbaseSampledAgentStatDualReadDao.SampledJvmGcDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("sampledJvmGcDetailedDaoFactory")
|
||||
public static class SampledJvmGcDetailedDaoFactory extends SampledAgentStatDaoFactory<SampledJvmGcDetailed, SampledJvmGcDetailedDao> implements FactoryBean<SampledJvmGcDetailedDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("sampledJvmGcDetailedDaoV1") SampledJvmGcDetailedDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("sampledJvmGcDetailedDaoV2") SampledJvmGcDetailedDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SampledJvmGcDetailedDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SampledJvmGcDetailedDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
SampledJvmGcDetailedDao getCompatibilityDao(SampledJvmGcDetailedDao v1, SampledJvmGcDetailedDao v2) {
|
||||
return new HbaseSampledAgentStatDualReadDao.SampledJvmGcDetailedDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("sampledCpuLoadDaoFactory")
|
||||
public static class SampledCpuLoadDaoFactory extends SampledAgentStatDaoFactory<SampledCpuLoad, SampledCpuLoadDao> implements FactoryBean<SampledCpuLoadDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("sampledCpuLoadDaoV1") SampledCpuLoadDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("sampledCpuLoadDaoV2") SampledCpuLoadDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SampledCpuLoadDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SampledCpuLoadDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
SampledCpuLoadDao getCompatibilityDao(SampledCpuLoadDao v1, SampledCpuLoadDao v2) {
|
||||
return new HbaseSampledAgentStatDualReadDao.SampledCpuLoadDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("sampledTransactionDaoFactory")
|
||||
public static class SampledTransactionDaoFactory extends SampledAgentStatDaoFactory<SampledTransaction, SampledTransactionDao> implements FactoryBean<SampledTransactionDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("sampledTransactionDaoV1") SampledTransactionDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("sampledTransactionDaoV2") SampledTransactionDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SampledTransactionDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SampledTransactionDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
SampledTransactionDao getCompatibilityDao(SampledTransactionDao v1, SampledTransactionDao v2) {
|
||||
return new HbaseSampledAgentStatDualReadDao.SampledTransactionDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Repository("sampledActiveTraceDaoFactory")
|
||||
public static class SampledActiveTraceDaoFactory extends SampledAgentStatDaoFactory<SampledActiveTrace, SampledActiveTraceDao> implements FactoryBean<SampledActiveTraceDao> {
|
||||
|
||||
@Autowired
|
||||
public void setV1(@Qualifier("sampledActiveTraceDaoV1") SampledActiveTraceDao v1) {
|
||||
this.v1 = v1;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setV2(@Qualifier("sampledActiveTraceDaoV2") SampledActiveTraceDao v2) {
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SampledActiveTraceDao getObject() throws Exception {
|
||||
return super.getDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SampledActiveTraceDao.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
SampledActiveTraceDao getCompatibilityDao(SampledActiveTraceDao v1, SampledActiveTraceDao v2) {
|
||||
return new HbaseSampledAgentStatDualReadDao.SampledActiveTraceDualReadDao(v2, v1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.compatibility;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.ActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.CpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.TransactionDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public abstract class HbaseAgentStatDualReadDao<T extends AgentStatDataPoint> implements AgentStatDao<T> {
|
||||
|
||||
private final AgentStatDao<T> master;
|
||||
private final AgentStatDao<T> slave;
|
||||
|
||||
protected HbaseAgentStatDualReadDao(AgentStatDao<T> master, AgentStatDao<T> slave) {
|
||||
this.master = master;
|
||||
this.slave = slave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getAgentStatList(String agentId, Range range) {
|
||||
List<T> agentStats = this.master.getAgentStatList(agentId, range);
|
||||
if (CollectionUtils.isNotEmpty(agentStats)) {
|
||||
return agentStats;
|
||||
} else {
|
||||
return this.slave.getAgentStatList(agentId, range);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
boolean exists = this.master.agentStatExists(agentId, range);
|
||||
if (exists) {
|
||||
return true;
|
||||
} else {
|
||||
return this.slave.agentStatExists(agentId, range);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JvmGcDualReadDao extends HbaseAgentStatDualReadDao<JvmGcBo> implements JvmGcDao {
|
||||
public JvmGcDualReadDao(AgentStatDao<JvmGcBo> master, AgentStatDao<JvmGcBo> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JvmGcDetailedDualReadDao extends HbaseAgentStatDualReadDao<JvmGcDetailedBo> implements JvmGcDetailedDao {
|
||||
public JvmGcDetailedDualReadDao(AgentStatDao<JvmGcDetailedBo> master, AgentStatDao<JvmGcDetailedBo> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CpuLoadDualReadDao extends HbaseAgentStatDualReadDao<CpuLoadBo> implements CpuLoadDao {
|
||||
public CpuLoadDualReadDao(AgentStatDao<CpuLoadBo> master, AgentStatDao<CpuLoadBo> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TransactionDualReadDao extends HbaseAgentStatDualReadDao<TransactionBo> implements TransactionDao {
|
||||
public TransactionDualReadDao(AgentStatDao<TransactionBo> master, AgentStatDao<TransactionBo> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ActiveTraceDualReadDao extends HbaseAgentStatDualReadDao<ActiveTraceBo> implements ActiveTraceDao {
|
||||
public ActiveTraceDualReadDao(AgentStatDao<ActiveTraceBo> master, AgentStatDao<ActiveTraceBo> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.compatibility;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public abstract class HbaseSampledAgentStatDualReadDao<S extends SampledAgentStatDataPoint> implements SampledAgentStatDao<S> {
|
||||
|
||||
private final SampledAgentStatDao<S> master;
|
||||
private final SampledAgentStatDao<S> slave;
|
||||
|
||||
protected HbaseSampledAgentStatDualReadDao(SampledAgentStatDao<S> master, SampledAgentStatDao<S> slave) {
|
||||
this.master = master;
|
||||
this.slave = slave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<S> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
List<S> sampledAgentStats = this.master.getSampledAgentStatList(agentId, timeWindow);
|
||||
if (CollectionUtils.isNotEmpty(sampledAgentStats)) {
|
||||
return sampledAgentStats;
|
||||
} else {
|
||||
return this.slave.getSampledAgentStatList(agentId, timeWindow);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampledJvmGcDualReadDao extends HbaseSampledAgentStatDualReadDao<SampledJvmGc> implements SampledJvmGcDao {
|
||||
public SampledJvmGcDualReadDao(SampledAgentStatDao<SampledJvmGc> master, SampledAgentStatDao<SampledJvmGc> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampledJvmGcDetailedDualReadDao extends HbaseSampledAgentStatDualReadDao<SampledJvmGcDetailed> implements SampledJvmGcDetailedDao {
|
||||
public SampledJvmGcDetailedDualReadDao(SampledAgentStatDao<SampledJvmGcDetailed> master, SampledAgentStatDao<SampledJvmGcDetailed> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampledCpuLoadDualReadDao extends HbaseSampledAgentStatDualReadDao<SampledCpuLoad> implements SampledCpuLoadDao {
|
||||
public SampledCpuLoadDualReadDao(SampledAgentStatDao<SampledCpuLoad> master, SampledAgentStatDao<SampledCpuLoad> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampledTransactionDualReadDao extends HbaseSampledAgentStatDualReadDao<SampledTransaction> implements SampledTransactionDao {
|
||||
public SampledTransactionDualReadDao(SampledAgentStatDao<SampledTransaction> master, SampledAgentStatDao<SampledTransaction> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SampledActiveTraceDualReadDao extends HbaseSampledAgentStatDualReadDao<SampledActiveTrace> implements SampledActiveTraceDao {
|
||||
public SampledActiveTraceDualReadDao(SampledAgentStatDao<SampledActiveTrace> master, SampledAgentStatDao<SampledActiveTrace> slave) {
|
||||
super(master, slave);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author Jongho Moon
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface Aggregator<T extends AgentStatDataPoint> {
|
||||
|
||||
long AGGR_SAMPLE_INTERVAL = TimeUnit.MINUTES.toMillis(10);
|
||||
long RAW_SAMPLE_INTERVAL = TimeUnit.SECONDS.toMillis(5);
|
||||
Comparator<AgentStatDataPoint> TIMESTAMP_COMPARATOR = new Comparator<AgentStatDataPoint>() {
|
||||
|
||||
@Override
|
||||
public int compare(AgentStatDataPoint o1, AgentStatDataPoint o2) {
|
||||
return Long.compare(o1.getTimestamp(), o2.getTimestamp());
|
||||
}
|
||||
};
|
||||
|
||||
List<T> aggregate(List<T> statsToAggregate, long interval);
|
||||
|
||||
abstract class AbstractAggregator<T extends AgentStatDataPoint> implements Aggregator<T> {
|
||||
|
||||
private AbstractAggregator() {
|
||||
}
|
||||
|
||||
public List<T> aggregate(List<T> statsToAggregate, long interval) {
|
||||
if (statsToAggregate.isEmpty()) {
|
||||
return statsToAggregate;
|
||||
}
|
||||
List<T> stats = new ArrayList<>(statsToAggregate);
|
||||
Collections.sort(stats, TIMESTAMP_COMPARATOR);
|
||||
|
||||
List<T> result = new ArrayList<>();
|
||||
T current = null;
|
||||
for (T stat : stats) {
|
||||
long normalizedTimestamp = normalizeTimestamp(interval, stat.getTimestamp());
|
||||
if (current == null) {
|
||||
current = normalizeAgentStat(stat, interval, normalizedTimestamp);
|
||||
} else {
|
||||
if (current.getTimestamp() == normalizedTimestamp) {
|
||||
current = merge(current, stat, interval);
|
||||
} else {
|
||||
result.add(current);
|
||||
current = normalizeAgentStat(stat, interval, normalizedTimestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.add(current);
|
||||
return result;
|
||||
}
|
||||
|
||||
private long normalizeTimestamp(long interval, long timestamp) {
|
||||
long normalizedTimestamp = (timestamp / interval) * interval;
|
||||
return normalizedTimestamp;
|
||||
}
|
||||
|
||||
private T normalizeAgentStat(T stat, long interval, long normalizedTimestamp) {
|
||||
T result = createNormalizedAgentStat(stat, normalizedTimestamp, interval);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected final long addUnsignedLongs(long v1, long v2) {
|
||||
if (v1 < 0) {
|
||||
if (v2 < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return v2;
|
||||
}
|
||||
} else {
|
||||
if (v2 < 0) {
|
||||
return v1;
|
||||
} else {
|
||||
return v1 + v2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected final long maxUnsignedLongs(long v1, long v2) {
|
||||
if (v1 < 0) {
|
||||
return v2;
|
||||
} else if (v2 < 0) {
|
||||
return v1;
|
||||
}
|
||||
|
||||
return v1 < v2 ? v2 : v1;
|
||||
}
|
||||
|
||||
protected final T getLatest(T s1, T s2) {
|
||||
return s1.getTimestamp() > s2.getTimestamp() ? s1 : s2;
|
||||
}
|
||||
|
||||
protected abstract T createNormalizedAgentStat(T src, long normalizedTimestamp, long interval);
|
||||
|
||||
protected abstract T merge(T s1, T s2, long interval);
|
||||
}
|
||||
|
||||
@Component
|
||||
class JvmGcAggregator extends AbstractAggregator<JvmGcBo> {
|
||||
|
||||
@Override
|
||||
protected JvmGcBo createNormalizedAgentStat(JvmGcBo src, long normalizedTimestamp, long interval) {
|
||||
JvmGcBo normalized = new JvmGcBo();
|
||||
normalized.setAgentId(src.getAgentId());
|
||||
normalized.setTimestamp(normalizedTimestamp);
|
||||
normalized.setHeapUsed(src.getHeapUsed());
|
||||
normalized.setHeapMax(src.getHeapMax());
|
||||
normalized.setNonHeapUsed(src.getNonHeapUsed());
|
||||
normalized.setNonHeapMax(src.getNonHeapMax());
|
||||
normalized.setGcOldCount(src.getGcOldCount());
|
||||
normalized.setGcOldTime(src.getGcOldTime());
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JvmGcBo merge(JvmGcBo s1, JvmGcBo s2, long interval) {
|
||||
JvmGcBo latest = getLatest(s1, s2);
|
||||
JvmGcBo merged = new JvmGcBo();
|
||||
merged.setAgentId(latest.getAgentId());
|
||||
merged.setTimestamp(latest.getTimestamp());
|
||||
merged.setHeapUsed(latest.getHeapUsed());
|
||||
merged.setHeapMax(maxUnsignedLongs(s1.getHeapMax(), s2.getHeapMax()));
|
||||
merged.setNonHeapUsed(latest.getNonHeapUsed());
|
||||
merged.setNonHeapMax(maxUnsignedLongs(s1.getNonHeapMax(), s2.getNonHeapMax()));
|
||||
merged.setGcOldCount(latest.getGcOldCount());
|
||||
merged.setGcOldTime(latest.getGcOldTime());
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
class JvmGcDetailedAggregator extends AbstractAggregator<JvmGcDetailedBo> {
|
||||
|
||||
@Override
|
||||
protected JvmGcDetailedBo createNormalizedAgentStat(JvmGcDetailedBo src, long normalizedTimestamp, long interval) {
|
||||
JvmGcDetailedBo normalized = new JvmGcDetailedBo();
|
||||
normalized.setAgentId(src.getAgentId());
|
||||
normalized.setTimestamp(normalizedTimestamp);
|
||||
normalized.setGcNewCount(src.getGcNewCount());
|
||||
normalized.setGcNewTime(src.getGcNewTime());
|
||||
normalized.setCodeCacheUsed(src.getCodeCacheUsed());
|
||||
normalized.setNewGenUsed(src.getNewGenUsed());
|
||||
normalized.setOldGenUsed(src.getOldGenUsed());
|
||||
normalized.setSurvivorSpaceUsed(src.getSurvivorSpaceUsed());
|
||||
normalized.setPermGenUsed(src.getPermGenUsed());
|
||||
normalized.setMetaspaceUsed(src.getMetaspaceUsed());
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JvmGcDetailedBo merge(JvmGcDetailedBo s1, JvmGcDetailedBo s2, long interval) {
|
||||
JvmGcDetailedBo latest = getLatest(s1, s2);
|
||||
JvmGcDetailedBo merged = new JvmGcDetailedBo();
|
||||
merged.setAgentId(latest.getAgentId());
|
||||
merged.setTimestamp(latest.getTimestamp());
|
||||
merged.setGcNewCount(latest.getGcNewCount());
|
||||
merged.setGcNewTime(latest.getGcNewTime());
|
||||
merged.setCodeCacheUsed(latest.getCodeCacheUsed());
|
||||
merged.setNewGenUsed(latest.getNewGenUsed());
|
||||
merged.setOldGenUsed(latest.getOldGenUsed());
|
||||
merged.setSurvivorSpaceUsed(latest.getSurvivorSpaceUsed());
|
||||
merged.setPermGenUsed(latest.getPermGenUsed());
|
||||
merged.setMetaspaceUsed(latest.getMetaspaceUsed());
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
class CpuLoadAggregator extends AbstractAggregator<CpuLoadBo> {
|
||||
|
||||
@Override
|
||||
protected CpuLoadBo createNormalizedAgentStat(CpuLoadBo src, long normalizedTimestamp, long interval) {
|
||||
CpuLoadBo normalized = new CpuLoadBo();
|
||||
normalized.setAgentId(src.getAgentId());
|
||||
normalized.setTimestamp(normalizedTimestamp);
|
||||
normalized.setJvmCpuLoad(src.getJvmCpuLoad());
|
||||
normalized.setSystemCpuLoad(src.getSystemCpuLoad());
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CpuLoadBo merge(CpuLoadBo s1, CpuLoadBo s2, long interval) {
|
||||
CpuLoadBo latest = getLatest(s1, s2);
|
||||
CpuLoadBo merged = new CpuLoadBo();
|
||||
merged.setAgentId(latest.getAgentId());
|
||||
merged.setTimestamp(latest.getTimestamp());
|
||||
merged.setJvmCpuLoad(latest.getJvmCpuLoad());
|
||||
merged.setSystemCpuLoad(latest.getSystemCpuLoad());
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
class TransactionAggregator extends AbstractAggregator<TransactionBo> {
|
||||
|
||||
@Override
|
||||
protected TransactionBo createNormalizedAgentStat(TransactionBo src, long normalizedTimestamp, long interval) {
|
||||
TransactionBo normalized = new TransactionBo();
|
||||
normalized.setAgentId(src.getAgentId());
|
||||
normalized.setTimestamp(normalizedTimestamp);
|
||||
normalized.setCollectInterval(interval);
|
||||
normalized.setSampledNewCount(src.getSampledNewCount());
|
||||
normalized.setSampledContinuationCount(src.getSampledContinuationCount());
|
||||
normalized.setUnsampledNewCount(src.getUnsampledNewCount());
|
||||
normalized.setUnsampledContinuationCount(src.getUnsampledContinuationCount());
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TransactionBo merge(TransactionBo s1, TransactionBo s2, long interval) {
|
||||
TransactionBo latest = getLatest(s1, s2);
|
||||
TransactionBo merged = new TransactionBo();
|
||||
merged.setAgentId(latest.getAgentId());
|
||||
merged.setTimestamp(latest.getTimestamp());
|
||||
merged.setSampledNewCount(addUnsignedLongs(s1.getSampledNewCount(), s2.getSampledNewCount()));
|
||||
merged.setSampledContinuationCount(addUnsignedLongs(s1.getSampledContinuationCount(), s2.getSampledContinuationCount()));
|
||||
merged.setUnsampledNewCount(addUnsignedLongs(s1.getUnsampledNewCount(), s2.getUnsampledNewCount()));
|
||||
merged.setUnsampledContinuationCount(addUnsignedLongs(s1.getUnsampledContinuationCount(), s2.getUnsampledContinuationCount()));
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
class ActiveTraceAggregator extends AbstractAggregator<ActiveTraceBo> {
|
||||
|
||||
@Override
|
||||
protected ActiveTraceBo createNormalizedAgentStat(ActiveTraceBo src, long normalizedTimestamp, long interval) {
|
||||
ActiveTraceBo normalized = new ActiveTraceBo();
|
||||
normalized.setAgentId(src.getAgentId());
|
||||
normalized.setTimestamp(normalizedTimestamp);
|
||||
normalized.setVersion(src.getVersion());
|
||||
normalized.setHistogramSchemaType(src.getHistogramSchemaType());
|
||||
normalized.setActiveTraceCounts(src.getActiveTraceCounts());
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ActiveTraceBo merge(ActiveTraceBo s1, ActiveTraceBo s2, long interval) {
|
||||
ActiveTraceBo latest = getLatest(s1, s2);
|
||||
ActiveTraceBo merged = new ActiveTraceBo();
|
||||
merged.setAgentId(latest.getAgentId());
|
||||
merged.setTimestamp(latest.getTimestamp());
|
||||
merged.setVersion(latest.getVersion());
|
||||
merged.setHistogramSchemaType(latest.getHistogramSchemaType());
|
||||
merged.setActiveTraceCounts(latest.getActiveTraceCounts());
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.ActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("activeTraceDaoV1")
|
||||
public class HbaseActiveTraceDao implements ActiveTraceDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.ActiveTraceMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.ActiveTraceAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<ActiveTraceBo> getAgentStatList(String agentId, Range range) {
|
||||
return operations.getAgentStatList(mapper, aggregator, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
return operations.agentStatExists(mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+71
-102
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,14 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase;
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import static com.navercorp.pinpoint.common.hbase.HBaseTables.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
@@ -29,7 +34,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.navercorp.pinpoint.common.hbase.HBaseTables;
|
||||
import com.navercorp.pinpoint.common.hbase.HbaseOperations2;
|
||||
@@ -38,39 +42,33 @@ import com.navercorp.pinpoint.common.hbase.RowMapper;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.server.util.RowKeyUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
import com.navercorp.pinpoint.web.dao.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.util.AgentStats;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.sematext.hbase.wd.AbstractRowKeyDistributor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
@Repository
|
||||
public class HbaseAgentStatDao implements AgentStatDao {
|
||||
@Component
|
||||
public class HbaseAgentStatDaoOperations {
|
||||
private static final long USE_AGGREGATED_THRESHOLD = TimeUnit.HOURS.toMillis(24);
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private HbaseOperations2 hbaseOperations2;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("agentStatMapper")
|
||||
private RowMapper<List<AgentStat>> agentStatMapper;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("agentStatRowKeyDistributor")
|
||||
private AbstractRowKeyDistributor rowKeyDistributor;
|
||||
|
||||
private int scanCacheSize = 256;
|
||||
|
||||
public void setScanCacheSize(int scanCacheSize) {
|
||||
void setScanCacheSize(int scanCacheSize) {
|
||||
this.scanCacheSize = scanCacheSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AgentStat> getAgentStatList(String agentId, Range range) {
|
||||
<T extends AgentStatDataPoint> List<T> getAgentStatList(AgentStatMapperV1<T> mapper, Aggregator<T> aggregator, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
@@ -81,88 +79,78 @@ public class HbaseAgentStatDao implements AgentStatDao {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("scanAgentStat : agentId={}, {}", agentId, range);
|
||||
}
|
||||
|
||||
return getAgentStatListFromRaw(agentId, range);
|
||||
}
|
||||
|
||||
private List<AgentStat> getAgentStatListFromRaw(String agentId, Range range) {
|
||||
Scan scan = createScan(agentId, range);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
|
||||
List<List<AgentStat>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, agentStatMapper);
|
||||
// boolean useAggregated = range.getRange() > USE_AGGREGATED_THRESHOLD;
|
||||
// if (useAggregated) {
|
||||
// return getAggregatedAgentStatList(mapper, aggregator, agentId, range);
|
||||
// } else {
|
||||
return getAgentStatListFromRaw(mapper, agentId, range);
|
||||
// }
|
||||
}
|
||||
|
||||
private <T extends AgentStatDataPoint> List<T> getAgentStatListFromRaw(AgentStatMapperV1<T> mapper, String agentId, Range range) {
|
||||
Scan scan = createScan(agentId, range);
|
||||
|
||||
List<List<T>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, mapper);
|
||||
|
||||
int expectedSize = (int) (range.getRange() / 5000); // data for 5 seconds
|
||||
List<AgentStat> merged = new ArrayList<>(expectedSize);
|
||||
List<T> merged = new ArrayList<>(expectedSize);
|
||||
|
||||
for (List<AgentStat> each : intermediate) {
|
||||
for (List<T> each : intermediate) {
|
||||
merged.addAll(each);
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
public List<AgentStat> getAggregatedAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("scanAgentStat : agentId={}, {}", agentId, range);
|
||||
}
|
||||
|
||||
private <T extends AgentStatDataPoint> List<T> getAggregatedAgentStatList(AgentStatMapperV1<T> mapper, Aggregator<T> aggregator, String agentId, Range range) {
|
||||
Scan scan = createScan(agentId, range);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
|
||||
List<List<AgentStat>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT_AGGR, scan, rowKeyDistributor, agentStatMapper);
|
||||
|
||||
List<AgentStat> merged = new ArrayList<>();
|
||||
|
||||
for (List<AgentStat> each : intermediate) {
|
||||
List<List<T>> intermediate = hbaseOperations2.find(HBaseTables.AGENT_STAT_AGGR, scan, rowKeyDistributor, mapper);
|
||||
|
||||
List<T> merged = new ArrayList<>();
|
||||
|
||||
for (List<T> each : intermediate) {
|
||||
merged.addAll(each);
|
||||
}
|
||||
|
||||
Collections.sort(merged, AgentStats.TIMESTAMP_COMPARATOR);
|
||||
|
||||
|
||||
|
||||
Collections.sort(merged, Aggregator.TIMESTAMP_COMPARATOR);
|
||||
|
||||
List<Range> missingRanges = new ArrayList<>();
|
||||
long last = range.getFrom();
|
||||
|
||||
for (AgentStat stat : merged) {
|
||||
if (last + AgentStat.AGGR_SAMPLE_INTERVAL * 2 < stat.getTimestamp()) {
|
||||
Range r = new Range(last, stat.getTimestamp() - stat.getCollectInterval());
|
||||
|
||||
for (T stat : merged) {
|
||||
if (last + Aggregator.AGGR_SAMPLE_INTERVAL * 2 < stat.getTimestamp()) {
|
||||
Range r = new Range(last, stat.getTimestamp() - Aggregator.AGGR_SAMPLE_INTERVAL);
|
||||
missingRanges.add(r);
|
||||
}
|
||||
|
||||
|
||||
last = stat.getTimestamp();
|
||||
}
|
||||
|
||||
if (last + AgentStat.AGGR_SAMPLE_INTERVAL * 2 < range.getTo()) {
|
||||
|
||||
if (last + Aggregator.AGGR_SAMPLE_INTERVAL * 2 < range.getTo()) {
|
||||
Range r = new Range(last, range.getTo());
|
||||
missingRanges.add(r);
|
||||
}
|
||||
|
||||
|
||||
for (Range r : missingRanges) {
|
||||
logger.debug("AgentStatAggr doesn't have range: " + r.prettyToString() + " of " + agentId);
|
||||
|
||||
List<AgentStat> list = getAgentStatListFromRaw(agentId, r);
|
||||
|
||||
List<T> list = getAgentStatListFromRaw(mapper, agentId, r);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
logger.debug("AgentStat also doesn't have range: " + r.prettyToString() + " of " + agentId);
|
||||
continue;
|
||||
}
|
||||
|
||||
List<AgentStat> aggregated = AgentStats.aggregate(list, AgentStat.AGGR_SAMPLE_INTERVAL);
|
||||
|
||||
List<T> aggregated = aggregator.aggregate(list, Aggregator.AGGR_SAMPLE_INTERVAL);
|
||||
merged.addAll(aggregated);
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
|
||||
<T extends AgentStatDataPoint> boolean agentStatExists(AgentStatMapperV1<T> mapper, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
@@ -176,16 +164,30 @@ public class HbaseAgentStatDao implements AgentStatDao {
|
||||
|
||||
Scan scan = createScan(agentId, range);
|
||||
scan.setCaching(1);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
|
||||
return hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, new AgentStatDataExistsResultsExtractor(this.agentStatMapper));
|
||||
AgentStatDataExistsResultsExtractor<T> extractor = new AgentStatDataExistsResultsExtractor(mapper);
|
||||
return hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, extractor);
|
||||
}
|
||||
|
||||
private class AgentStatDataExistsResultsExtractor implements ResultsExtractor<Boolean> {
|
||||
<T extends AgentStatDataPoint, S extends SampledAgentStatDataPoint> List<S> getSampledAgentStatList(SampledAgentStatResultExtractor<T, S> resultExtractor, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
if (resultExtractor == null) {
|
||||
throw new NullPointerException("sampledResultExtractor must not be null");
|
||||
}
|
||||
Scan scan = createScan(agentId, range);
|
||||
return hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, resultExtractor);
|
||||
}
|
||||
|
||||
private final RowMapper<List<AgentStat>> agentStatMapper;
|
||||
private class AgentStatDataExistsResultsExtractor<T extends AgentStatDataPoint> implements ResultsExtractor<Boolean> {
|
||||
|
||||
private AgentStatDataExistsResultsExtractor(RowMapper<List<AgentStat>> agentStatMapper) {
|
||||
private final RowMapper<List<T>> agentStatMapper;
|
||||
|
||||
private AgentStatDataExistsResultsExtractor(AgentStatMapperV1<T> agentStatMapper) {
|
||||
this.agentStatMapper = agentStatMapper;
|
||||
}
|
||||
|
||||
@@ -222,7 +224,7 @@ public class HbaseAgentStatDao implements AgentStatDao {
|
||||
Scan scan = new Scan();
|
||||
scan.setCaching(this.scanCacheSize);
|
||||
|
||||
byte[] startKey = getRowKey(agentId, range.getFrom());
|
||||
byte[] startKey = getRowKey(agentId, range.getFrom() - 1);
|
||||
byte[] endKey = getRowKey(agentId, range.getTo());
|
||||
|
||||
// start key is replaced by end key because key has been reversed
|
||||
@@ -237,37 +239,4 @@ public class HbaseAgentStatDao implements AgentStatDao {
|
||||
logger.debug("create scan:{}", scan);
|
||||
return scan;
|
||||
}
|
||||
|
||||
// public List<AgentStat> scanAgentStatList(String agentId, long start, long end, final int limit) {
|
||||
// if (logger.isDebugEnabled()) {
|
||||
// logger.debug("scanAgentStatList");
|
||||
// }
|
||||
// Scan scan = createScan(agentId, start, end);
|
||||
//
|
||||
// List<AgentStat> list = hbaseOperations2.find(HBaseTables.AGENT_STAT, scan, rowKeyDistributor, new ResultsExtractor<List<AgentStat>>() {
|
||||
// @Override
|
||||
// public List<AgentStat> extractData(ResultScanner results) throws Exception {
|
||||
// TDeserializer deserializer = new TDeserializer();
|
||||
// List<AgentStat> list = new ArrayList<AgentStat>();
|
||||
// for (Result result : results) {
|
||||
// if (result == null) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (list.size() >= limit) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// for (KeyValue kv : result.raw()) {
|
||||
// AgentStat agentStat = new AgentStat();
|
||||
// deserializer.deserialize(agentStat, kv.getBuffer());
|
||||
// list.add(agentStat);
|
||||
// }
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
// });
|
||||
// return list;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.CpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("cpuLoadDaoV1")
|
||||
public class HbaseCpuLoadDao implements CpuLoadDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.CpuLoadMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.CpuLoadAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
|
||||
return operations.getAgentStatList(mapper, aggregator, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
return operations.agentStatExists(mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("jvmGcDaoV1")
|
||||
public class HbaseJvmGcDao implements JvmGcDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.JvmGcMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.JvmGcAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
|
||||
return this.operations.getAgentStatList(mapper, aggregator, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
return operations.agentStatExists(mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.apache.thrift.TException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("jvmGcDetailedDaoV1")
|
||||
public class HbaseJvmGcDetailedDao implements JvmGcDetailedDao {
|
||||
|
||||
@Override
|
||||
public List<JvmGcDetailedBo> getAgentStatList(String agentId, Range range) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledActiveTraceResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledActiveTraceDaoV1")
|
||||
public class HbaseSampledActiveTraceDao implements SampledActiveTraceDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.ActiveTraceMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.ActiveTraceAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<SampledActiveTrace> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
SampledActiveTraceResultExtractor resultExtractor = new SampledActiveTraceResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledCpuLoadResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledCpuLoadDaoV1")
|
||||
public class HbaseSampledCpuLoadDao implements SampledCpuLoadDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.CpuLoadMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.CpuLoadAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<SampledCpuLoad> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
SampledCpuLoadResultExtractor resultExtractor = new SampledCpuLoadResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledJvmGcResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledJvmGcDaoV1")
|
||||
public class HbaseSampledJvmGcDao implements SampledJvmGcDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.JvmGcMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.JvmGcAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<SampledJvmGc> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
SampledJvmGcResultExtractor resultExtractor = new SampledJvmGcResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledJvmGcDetailedDaoV1")
|
||||
public class HbaseSampledJvmGcDetailedDao implements SampledJvmGcDetailedDao {
|
||||
|
||||
@Override
|
||||
public List<SampledJvmGcDetailed> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledTransactionResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledTransactionDaoV1")
|
||||
public class HbaseSampledTransactionDao implements SampledTransactionDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.TransactionMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.TransactionAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<SampledTransaction> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
SampledTransactionResultExtractor resultExtractor = new SampledTransactionResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v1;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.TransactionDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV1;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("transactionDaoV1")
|
||||
public class HbaseTransactionDao implements TransactionDao {
|
||||
|
||||
@Autowired
|
||||
private AgentStatMapperV1.TransactionMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private Aggregator.TransactionAggregator aggregator;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperations operations;
|
||||
|
||||
@Override
|
||||
public List<TransactionBo> getAgentStatList(String agentId, Range range) {
|
||||
return operations.getAgentStatList(mapper, aggregator, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
return operations.agentStatExists(mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.ActiveTraceDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.web.dao.stat.ActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("activeTraceDaoV2")
|
||||
public class HbaseActiveTraceDaoV2 implements ActiveTraceDao {
|
||||
|
||||
@Autowired
|
||||
private ActiveTraceDecoder activeTraceDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<ActiveTraceBo> getAgentStatList(String agentId, Range range) {
|
||||
AgentStatMapperV2<ActiveTraceBo> mapper = operations.createRowMapper(activeTraceDecoder, range);
|
||||
return operations.getAgentStatList(AgentStatType.ACTIVE_TRACE, mapper, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
AgentStatMapperV2<ActiveTraceBo> mapper = operations.createRowMapper(activeTraceDecoder, range);
|
||||
return operations.agentStatExists(AgentStatType.ACTIVE_TRACE, mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.hbase.HBaseTables;
|
||||
import com.navercorp.pinpoint.common.hbase.HbaseOperations2;
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory;
|
||||
import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.web.mapper.RangeTimestampFilter;
|
||||
import com.navercorp.pinpoint.web.mapper.TimestampFilter;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Component
|
||||
public class HbaseAgentStatDaoOperationsV2 {
|
||||
|
||||
private static final int AGENT_STAT_VER2_NUM_PARTITIONS = 32;
|
||||
private static final int MAX_SCAN_CACHE_SIZE = 256;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private HbaseOperations2 hbaseOperations2;
|
||||
|
||||
@Autowired
|
||||
private AgentStatHbaseOperationFactory operationFactory;
|
||||
|
||||
<T extends AgentStatDataPoint> List<T> getAgentStatList(AgentStatType agentStatType, AgentStatMapperV2<T> mapper, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
|
||||
Scan scan = this.createScan(agentStatType, agentId, range);
|
||||
|
||||
List<List<T>> intermediate = hbaseOperations2.findParallel(HBaseTables.AGENT_STAT_VER2, scan, this.operationFactory.getRowKeyDistributor(), mapper, AGENT_STAT_VER2_NUM_PARTITIONS);
|
||||
int expectedSize = (int) (range.getRange() / HBaseTables.AGENT_STAT_TIMESPAN_MS);
|
||||
List<T> merged = new ArrayList<>(expectedSize);
|
||||
for (List<T> each : intermediate) {
|
||||
merged.addAll(each);
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
<T extends AgentStatDataPoint> boolean agentStatExists(AgentStatType agentStatType, AgentStatMapperV2<T> mapper, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("checking for stat data existence : agentId={}, {}", agentId, range);
|
||||
}
|
||||
|
||||
int resultLimit = 1;
|
||||
Scan scan = this.createScan(agentStatType, agentId, range, resultLimit);
|
||||
|
||||
List<List<T>> result = hbaseOperations2.findParallel(HBaseTables.AGENT_STAT_VER2, scan, this.operationFactory.getRowKeyDistributor(), resultLimit, mapper, AGENT_STAT_VER2_NUM_PARTITIONS);
|
||||
if (result.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
<T extends AgentStatDataPoint, S extends SampledAgentStatDataPoint> List<S> getSampledAgentStatList(AgentStatType agentStatType, SampledAgentStatResultExtractor<T, S> resultExtractor, String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
if (resultExtractor == null) {
|
||||
throw new NullPointerException("resultExtractor must not be null");
|
||||
}
|
||||
Scan scan = this.createScan(agentStatType, agentId, range);
|
||||
return hbaseOperations2.findParallel(HBaseTables.AGENT_STAT_VER2, scan, this.operationFactory.getRowKeyDistributor(), resultExtractor, AGENT_STAT_VER2_NUM_PARTITIONS);
|
||||
}
|
||||
|
||||
<T extends AgentStatDataPoint> AgentStatMapperV2<T> createRowMapper(AgentStatDecoder<T> decoder, Range range) {
|
||||
TimestampFilter filter = new RangeTimestampFilter(range);
|
||||
return new AgentStatMapperV2<>(this.operationFactory, decoder, filter);
|
||||
}
|
||||
|
||||
private Scan createScan(AgentStatType agentStatType, String agentId, Range range) {
|
||||
long scanRange = range.getTo() - range.getFrom();
|
||||
long expectedNumRows = ((scanRange - 1) / HBaseTables.AGENT_STAT_TIMESPAN_MS) + 1;
|
||||
if (range.getFrom() != AgentStatUtils.getBaseTimestamp(range.getFrom())) {
|
||||
expectedNumRows++;
|
||||
}
|
||||
if (expectedNumRows > MAX_SCAN_CACHE_SIZE) {
|
||||
return this.createScan(agentStatType, agentId, range, MAX_SCAN_CACHE_SIZE);
|
||||
} else {
|
||||
// expectedNumRows guaranteed to be within integer range at this point
|
||||
return this.createScan(agentStatType, agentId, range, (int) expectedNumRows);
|
||||
}
|
||||
}
|
||||
|
||||
private Scan createScan(AgentStatType agentStatType, String agentId, Range range, int scanCacheSize) {
|
||||
Scan scan = this.operationFactory.createScan(agentId, agentStatType, range.getFrom(), range.getTo());
|
||||
scan.setCaching(scanCacheSize);
|
||||
scan.setId("AgentStat_" + agentStatType);
|
||||
scan.addFamily(HBaseTables.AGENT_STAT_CF_STATISTICS);
|
||||
return scan;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.CpuLoadDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.CpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("cpuLoadDaoV2")
|
||||
public class HbaseCpuLoadDaoV2 implements CpuLoadDao {
|
||||
|
||||
@Autowired
|
||||
private CpuLoadDecoder cpuLoadDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
|
||||
AgentStatMapperV2<CpuLoadBo> mapper = operations.createRowMapper(cpuLoadDecoder, range);
|
||||
return operations.getAgentStatList(AgentStatType.CPU_LOAD, mapper, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
AgentStatMapperV2<CpuLoadBo> mapper = operations.createRowMapper(cpuLoadDecoder, range);
|
||||
return operations.agentStatExists(AgentStatType.CPU_LOAD, mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.JvmGcDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("jvmGcDaoV2")
|
||||
public class HbaseJvmGcDaoV2 implements JvmGcDao {
|
||||
|
||||
@Autowired
|
||||
private JvmGcDecoder jvmGcDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
|
||||
AgentStatMapperV2<JvmGcBo> mapper = operations.createRowMapper(jvmGcDecoder, range);
|
||||
return operations.getAgentStatList(AgentStatType.JVM_GC, mapper, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
AgentStatMapperV2<JvmGcBo> mapper = operations.createRowMapper(jvmGcDecoder, range);
|
||||
return operations.agentStatExists(AgentStatType.JVM_GC, mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.JvmGcDetailedDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("jvmGcDetailedDaoV2")
|
||||
public class HbaseJvmGcDetailedDaoV2 implements JvmGcDetailedDao {
|
||||
|
||||
@Autowired
|
||||
private JvmGcDetailedDecoder jvmGcDetailedDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<JvmGcDetailedBo> getAgentStatList(String agentId, Range range) {
|
||||
AgentStatMapperV2<JvmGcDetailedBo> mapper = operations.createRowMapper(jvmGcDetailedDecoder, range);
|
||||
return operations.getAgentStatList(AgentStatType.JVM_GC_DETAILED, mapper, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
AgentStatMapperV2<JvmGcDetailedBo> mapper = operations.createRowMapper(jvmGcDetailedDecoder, range);
|
||||
return operations.agentStatExists(AgentStatType.JVM_GC_DETAILED, mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.ActiveTraceDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledActiveTraceResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledActiveTraceDaoV2")
|
||||
public class HbaseSampledActiveTraceDaoV2 implements SampledActiveTraceDao {
|
||||
|
||||
@Autowired
|
||||
private ActiveTraceDecoder activeTraceDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<SampledActiveTrace> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
AgentStatMapperV2<ActiveTraceBo> mapper = operations.createRowMapper(activeTraceDecoder, range);
|
||||
SampledActiveTraceResultExtractor resultExtractor = new SampledActiveTraceResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(AgentStatType.ACTIVE_TRACE, resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.CpuLoadDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledCpuLoadResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledCpuLoadDaoV2")
|
||||
public class HbaseSampledCpuLoadDaoV2 implements SampledCpuLoadDao {
|
||||
|
||||
@Autowired
|
||||
private CpuLoadDecoder cpuLoadDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<SampledCpuLoad> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
AgentStatMapperV2<CpuLoadBo> mapper = operations.createRowMapper(cpuLoadDecoder, range);
|
||||
SampledCpuLoadResultExtractor resultExtractor = new SampledCpuLoadResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(AgentStatType.CPU_LOAD, resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.JvmGcDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledJvmGcResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledJvmGcDaoV2")
|
||||
public class HbaseSampledJvmGcDaoV2 implements SampledJvmGcDao {
|
||||
|
||||
@Autowired
|
||||
private JvmGcDecoder jvmGcDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<SampledJvmGc> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
AgentStatMapperV2<JvmGcBo> mapper = operations.createRowMapper(jvmGcDecoder, range);
|
||||
SampledJvmGcResultExtractor resultExtractor = new SampledJvmGcResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(AgentStatType.JVM_GC, resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.JvmGcDetailedDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledJvmGcDetailedResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledJvmGcDetailedDaoV2")
|
||||
public class HbaseSampledJvmGcDetailedDaoV2 implements SampledJvmGcDetailedDao {
|
||||
|
||||
@Autowired
|
||||
private JvmGcDetailedDecoder jvmGcDetailedDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<SampledJvmGcDetailed> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
AgentStatMapperV2<JvmGcDetailedBo> mapper = operations.createRowMapper(jvmGcDetailedDecoder, range);
|
||||
SampledJvmGcDetailedResultExtractor resultExtractor = new SampledJvmGcDetailedResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(AgentStatType.JVM_GC_DETAILED, resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.TransactionDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.SampledTransactionResultExtractor;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("sampledTransactionDaoV2")
|
||||
public class HbaseSampledTransactionDaoV2 implements SampledTransactionDao {
|
||||
|
||||
@Autowired
|
||||
private TransactionDecoder transactionDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<SampledTransaction> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range range = new Range(scanFrom, scanTo);
|
||||
AgentStatMapperV2<TransactionBo> mapper = operations.createRowMapper(transactionDecoder, range);
|
||||
SampledTransactionResultExtractor resultExtractor = new SampledTransactionResultExtractor(timeWindow, mapper);
|
||||
return operations.getSampledAgentStatList(AgentStatType.TRANSACTION, resultExtractor, agentId, range);
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.hbase.stat.v2;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.TransactionDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.TransactionDao;
|
||||
import com.navercorp.pinpoint.web.mapper.stat.AgentStatMapperV2;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Repository("transactionDaoV2")
|
||||
public class HbaseTransactionDaoV2 implements TransactionDao {
|
||||
|
||||
@Autowired
|
||||
private TransactionDecoder transactionDecoder;
|
||||
|
||||
@Autowired
|
||||
private HbaseAgentStatDaoOperationsV2 operations;
|
||||
|
||||
@Override
|
||||
public List<TransactionBo> getAgentStatList(String agentId, Range range) {
|
||||
AgentStatMapperV2<TransactionBo> mapper = operations.createRowMapper(transactionDecoder, range);
|
||||
return operations.getAgentStatList(AgentStatType.TRANSACTION, mapper, agentId, range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agentStatExists(String agentId, Range range) {
|
||||
AgentStatMapperV2<TransactionBo> mapper = operations.createRowMapper(transactionDecoder, range);
|
||||
return operations.agentStatExists(AgentStatType.TRANSACTION, mapper, agentId, range);
|
||||
}
|
||||
}
|
||||
+6
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,15 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledDataDoubleChartBuilder extends SampledDataChartBuilder<Long, Double> {
|
||||
|
||||
public SampledDataDoubleChartBuilder(DownSampler<Double> downSampler, int sampleRate) {
|
||||
super(downSampler, sampleRate);
|
||||
}
|
||||
|
||||
public interface ActiveTraceDao extends AgentStatDao<ActiveTraceBo> {
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2014 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface AgentStatDao<T extends AgentStatDataPoint> {
|
||||
|
||||
List<T> getAgentStatList(String agentId, Range range);
|
||||
|
||||
boolean agentStatExists(String agentId, Range range);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface CpuLoadDao extends AgentStatDao<CpuLoadBo> {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface JvmGcDao extends AgentStatDao<JvmGcBo> {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface JvmGcDetailedDao extends AgentStatDao<JvmGcDetailedBo> {
|
||||
}
|
||||
+4
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao;
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,11 +24,7 @@ import com.navercorp.pinpoint.web.vo.Range;
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public interface AgentStatDao {
|
||||
|
||||
@Deprecated
|
||||
public interface LegacyAgentStatDao {
|
||||
List<AgentStat> getAgentStatList(String agentId, Range range);
|
||||
List<AgentStat> getAggregatedAgentStatList(String agentId, Range range);
|
||||
|
||||
boolean agentStatExists(String agentId, Range range);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledActiveTraceDao extends SampledAgentStatDao<SampledActiveTrace> {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledCpuLoadDao extends SampledAgentStatDao<SampledCpuLoad> {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledJvmGcDao extends SampledAgentStatDao<SampledJvmGc> {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledJvmGcDetailedDao extends SampledAgentStatDao<SampledJvmGcDetailed> {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.SampledAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledTransactionDao extends SampledAgentStatDao<SampledTransaction> {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.dao.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface TransactionDao extends AgentStatDao<TransactionBo> {
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class RangeTimestampFilter implements TimestampFilter {
|
||||
|
||||
private final Range range;
|
||||
|
||||
public RangeTimestampFilter(Range range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filter(long timestamp) {
|
||||
return timestamp < this.range.getFrom() || timestamp > this.range.getTo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface TimestampFilter {
|
||||
boolean filter(long timestamp);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.hbase.RowMapper;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface AgentStatMapper<T extends AgentStatDataPoint> extends RowMapper<List<T>> {
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import static com.navercorp.pinpoint.common.hbase.HBaseTables.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo;
|
||||
import com.navercorp.pinpoint.common.hbase.RowMapper;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
import com.navercorp.pinpoint.thrift.dto.TAgentStat;
|
||||
import com.navercorp.pinpoint.thrift.dto.TJvmGc;
|
||||
import com.sematext.hbase.wd.RowKeyDistributorByHashPrefix;
|
||||
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.thrift.TDeserializer;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TCompactProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public abstract class AgentStatMapperV1<T extends AgentStatDataPoint> implements AgentStatMapper<T> {
|
||||
|
||||
private static final TProtocolFactory FACTORY = new TCompactProtocol.Factory();
|
||||
|
||||
@Autowired
|
||||
@Qualifier("agentStatRowKeyDistributor")
|
||||
private RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix;
|
||||
|
||||
@Override
|
||||
public List<T> mapRow(Result result, int rowNum) throws Exception {
|
||||
if (result.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final byte[] rowKey = getOriginalKey(result.getRow());
|
||||
final String agentId = BytesUtils.toString(rowKey, 0, AGENT_NAME_MAX_LEN).trim();
|
||||
final long reverseTimestamp = BytesUtils.bytesToLong(rowKey, AGENT_NAME_MAX_LEN);
|
||||
final long timestamp = TimeUtils.recoveryTimeMillis(reverseTimestamp);
|
||||
NavigableMap<byte[], byte[]> qualifierMap = result.getFamilyMap(AGENT_STAT_CF_STATISTICS);
|
||||
|
||||
if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_V1)) {
|
||||
// FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
|
||||
return readAgentStatThriftDto(agentId, timestamp, qualifierMap.get(AGENT_STAT_CF_STATISTICS_V1));
|
||||
} else if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC) || qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) {
|
||||
// FIXME (2015.10) Legacy column for storing serialzied Bos separately.
|
||||
return readSerializedBos(agentId, timestamp, qualifierMap);
|
||||
} else {
|
||||
return mapQualifiers(agentId, timestamp, qualifierMap);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] getOriginalKey(byte[] rowKey) {
|
||||
return rowKeyDistributorByHashPrefix.getOriginalKey(rowKey);
|
||||
}
|
||||
|
||||
// FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
|
||||
@Deprecated
|
||||
protected abstract List<T> readAgentStatThriftDto(String agentId, long timestamp, byte[]tAgentStatByteArray) throws TException;
|
||||
|
||||
// FIXME (2015.10) Legacy column for storing serialzied Bos separately.
|
||||
@Deprecated
|
||||
protected abstract List<T> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap);
|
||||
|
||||
protected abstract List<T> mapQualifiers(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap);
|
||||
|
||||
@Component("jvmGcMapper")
|
||||
public static class JvmGcMapper extends AgentStatMapperV1<JvmGcBo> {
|
||||
|
||||
@Override
|
||||
protected List<JvmGcBo> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
|
||||
// CompactProtocol used
|
||||
TDeserializer deserializer = new TDeserializer(FACTORY);
|
||||
TAgentStat tAgentStat = new TAgentStat();
|
||||
deserializer.deserialize(tAgentStat, tAgentStatByteArray);
|
||||
TJvmGc gc = tAgentStat.getGc();
|
||||
if (gc == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
AgentStatMemoryGcBo.Builder memoryGcBoBuilder = new AgentStatMemoryGcBo.Builder(tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp());
|
||||
memoryGcBoBuilder.gcType(gc.getType().name());
|
||||
memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed());
|
||||
memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax());
|
||||
memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed());
|
||||
memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax());
|
||||
memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount());
|
||||
memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime());
|
||||
AgentStatMemoryGcBo agentStatMemoryGcBo = memoryGcBoBuilder.build();
|
||||
JvmGcBo jvmGcBo = new JvmGcBo();
|
||||
jvmGcBo.setAgentId(agentStatMemoryGcBo.getAgentId());
|
||||
jvmGcBo.setTimestamp(agentStatMemoryGcBo.getTimestamp());
|
||||
jvmGcBo.setGcOldCount(agentStatMemoryGcBo.getJvmGcOldCount());
|
||||
jvmGcBo.setGcOldTime(agentStatMemoryGcBo.getJvmGcOldTime());
|
||||
jvmGcBo.setHeapUsed(agentStatMemoryGcBo.getJvmMemoryHeapUsed());
|
||||
jvmGcBo.setHeapMax(agentStatMemoryGcBo.getJvmMemoryHeapMax());
|
||||
jvmGcBo.setNonHeapUsed(agentStatMemoryGcBo.getJvmMemoryNonHeapUsed());
|
||||
jvmGcBo.setNonHeapMax(agentStatMemoryGcBo.getJvmMemoryNonHeapMax());
|
||||
return Arrays.asList(jvmGcBo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<JvmGcBo> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC)) {
|
||||
AgentStatMemoryGcBo.Builder builder = new AgentStatMemoryGcBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_MEMORY_GC));
|
||||
AgentStatMemoryGcBo agentStatMemoryGcBo = builder.build();
|
||||
JvmGcBo jvmGcBo = new JvmGcBo();
|
||||
jvmGcBo.setAgentId(agentStatMemoryGcBo.getAgentId());
|
||||
jvmGcBo.setTimestamp(agentStatMemoryGcBo.getTimestamp());
|
||||
jvmGcBo.setGcOldCount(agentStatMemoryGcBo.getJvmGcOldCount());
|
||||
jvmGcBo.setGcOldTime(agentStatMemoryGcBo.getJvmGcOldTime());
|
||||
jvmGcBo.setHeapUsed(agentStatMemoryGcBo.getJvmMemoryHeapUsed());
|
||||
jvmGcBo.setHeapMax(agentStatMemoryGcBo.getJvmMemoryHeapMax());
|
||||
jvmGcBo.setNonHeapUsed(agentStatMemoryGcBo.getJvmMemoryNonHeapUsed());
|
||||
jvmGcBo.setNonHeapMax(agentStatMemoryGcBo.getJvmMemoryNonHeapMax());
|
||||
return Arrays.asList(jvmGcBo);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<JvmGcBo> mapQualifiers(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
JvmGcBo jvmGcBo = new JvmGcBo();
|
||||
jvmGcBo.setAgentId(agentId);
|
||||
jvmGcBo.setTimestamp(timestamp);
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_GC_OLD_COUNT)) {
|
||||
jvmGcBo.setGcOldCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_GC_OLD_COUNT)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_GC_OLD_TIME)) {
|
||||
jvmGcBo.setGcOldTime(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_GC_OLD_TIME)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_HEAP_USED)) {
|
||||
jvmGcBo.setHeapUsed(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_HEAP_USED)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_HEAP_MAX)) {
|
||||
jvmGcBo.setHeapMax(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_HEAP_MAX)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_NON_HEAP_USED)) {
|
||||
jvmGcBo.setNonHeapUsed(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_NON_HEAP_USED)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_NON_HEAP_MAX)) {
|
||||
jvmGcBo.setNonHeapMax(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_NON_HEAP_MAX)));
|
||||
}
|
||||
return Arrays.asList(jvmGcBo);
|
||||
}
|
||||
}
|
||||
|
||||
@Component("cpuLoadMapper")
|
||||
public static class CpuLoadMapper extends AgentStatMapperV1<CpuLoadBo> {
|
||||
|
||||
@Override
|
||||
protected List<CpuLoadBo> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
|
||||
// cpu load collection wasn't implemented for this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<CpuLoadBo> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) {
|
||||
AgentStatCpuLoadBo.Builder builder = new AgentStatCpuLoadBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_CPU_LOAD));
|
||||
AgentStatCpuLoadBo agentStatCpuLoadBo = builder.build();
|
||||
CpuLoadBo cpuLoadBo = new CpuLoadBo();
|
||||
cpuLoadBo.setAgentId(agentStatCpuLoadBo.getAgentId());
|
||||
cpuLoadBo.setTimestamp(agentStatCpuLoadBo.getTimestamp());
|
||||
cpuLoadBo.setJvmCpuLoad(agentStatCpuLoadBo.getJvmCpuLoad());
|
||||
cpuLoadBo.setSystemCpuLoad(agentStatCpuLoadBo.getSystemCpuLoad());
|
||||
return Arrays.asList(cpuLoadBo);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<CpuLoadBo> mapQualifiers(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
CpuLoadBo cpuLoadBo = new CpuLoadBo();
|
||||
cpuLoadBo.setAgentId(agentId);
|
||||
cpuLoadBo.setTimestamp(timestamp);
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_JVM_CPU)) {
|
||||
cpuLoadBo.setJvmCpuLoad(Bytes.toDouble(qualifierMap.get(AGENT_STAT_COL_JVM_CPU)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_SYS_CPU)) {
|
||||
cpuLoadBo.setSystemCpuLoad(Bytes.toDouble(qualifierMap.get(AGENT_STAT_COL_SYS_CPU)));
|
||||
}
|
||||
return Arrays.asList(cpuLoadBo);
|
||||
}
|
||||
}
|
||||
|
||||
@Component("transactionMapper")
|
||||
public static class TransactionMapper extends AgentStatMapperV1<TransactionBo> {
|
||||
|
||||
@Override
|
||||
protected List<TransactionBo> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
|
||||
// transaction collection wasn't implemented for this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TransactionBo> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
// transaction collection wasn't implemented for this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TransactionBo> mapQualifiers(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
TransactionBo transactionBo = new TransactionBo();
|
||||
transactionBo.setAgentId(agentId);
|
||||
transactionBo.setTimestamp(timestamp);
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_INTERVAL)) {
|
||||
transactionBo.setCollectInterval(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_INTERVAL)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)) {
|
||||
transactionBo.setSampledNewCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION)) {
|
||||
transactionBo.setSampledContinuationCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW)) {
|
||||
transactionBo.setUnsampledNewCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW)));
|
||||
}
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION)) {
|
||||
transactionBo.setUnsampledContinuationCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_CONTINUATION)));
|
||||
}
|
||||
return Arrays.asList(transactionBo);
|
||||
}
|
||||
}
|
||||
|
||||
@Component("activeTraceMapper")
|
||||
public static class ActiveTraceMapper extends AgentStatMapperV1<ActiveTraceBo> {
|
||||
|
||||
@Override
|
||||
protected List<ActiveTraceBo> readAgentStatThriftDto(String agentId, long timestamp, byte[] tAgentStatByteArray) throws TException {
|
||||
// active trace collection wasn't implemented for this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ActiveTraceBo> readSerializedBos(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
// active trace collection wasn't implemented for this
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ActiveTraceBo> mapQualifiers(String agentId, long timestamp, Map<byte[], byte[]> qualifierMap) {
|
||||
ActiveTraceBo activeTraceBo = new ActiveTraceBo();
|
||||
activeTraceBo.setAgentId(agentId);
|
||||
activeTraceBo.setTimestamp(timestamp);
|
||||
if (qualifierMap.containsKey(AGENT_STAT_COL_ACTIVE_TRACE_HISTOGRAM)) {
|
||||
ActiveTraceHistogramBo activeTraceHistogramBo = new ActiveTraceHistogramBo(qualifierMap.get(AGENT_STAT_COL_ACTIVE_TRACE_HISTOGRAM));
|
||||
activeTraceBo.setHistogramSchemaType(activeTraceHistogramBo.getHistogramSchemaType());
|
||||
activeTraceBo.setActiveTraceCounts(activeTraceHistogramBo.getActiveTraceCountMap());
|
||||
}
|
||||
return Arrays.asList(activeTraceBo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.buffer.Buffer;
|
||||
import com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer;
|
||||
import com.navercorp.pinpoint.common.hbase.HBaseTables;
|
||||
import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDecoder;
|
||||
import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.mapper.TimestampFilter;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.CellUtil;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class AgentStatMapperV2<T extends AgentStatDataPoint> implements AgentStatMapper<T> {
|
||||
|
||||
public static Comparator<AgentStatDataPoint> REVERSE_TIMESTAMP_COMPARATOR = new Comparator<AgentStatDataPoint>() {
|
||||
@Override
|
||||
public int compare(AgentStatDataPoint o1, AgentStatDataPoint o2) {
|
||||
long x = o2.getTimestamp();
|
||||
long y = o1.getTimestamp();
|
||||
return (x < y) ? -1 : ((x == y) ? 0 : 1);
|
||||
}
|
||||
};
|
||||
|
||||
private final AgentStatHbaseOperationFactory hbaseOperationFactory;
|
||||
private final AgentStatDecoder<T> decoder;
|
||||
private final TimestampFilter filter;
|
||||
|
||||
public AgentStatMapperV2(AgentStatHbaseOperationFactory hbaseOperationFactory, AgentStatDecoder<T> decoder, TimestampFilter filter) {
|
||||
this.hbaseOperationFactory = hbaseOperationFactory;
|
||||
this.decoder = decoder;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> mapRow(Result result, int rowNum) throws Exception {
|
||||
if (result.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final byte[] distributedRowKey = result.getRow();
|
||||
final String agentId = this.hbaseOperationFactory.getAgentId(distributedRowKey);
|
||||
final long baseTimestamp = this.hbaseOperationFactory.getBaseTimestamp(distributedRowKey);
|
||||
|
||||
List<T> dataPoints = new ArrayList<>();
|
||||
|
||||
for (Cell cell : result.rawCells()) {
|
||||
if (CellUtil.matchingFamily(cell, HBaseTables.AGENT_STAT_CF_STATISTICS)) {
|
||||
Buffer qualifierBuffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
|
||||
Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
|
||||
|
||||
long initialTimestamp = this.decoder.decodeInitialTimestamp(baseTimestamp, qualifierBuffer);
|
||||
List<T> candidates = this.decoder.decodeDataPoints(initialTimestamp, valueBuffer);
|
||||
for (T candidate : candidates) {
|
||||
candidate.setAgentId(agentId);
|
||||
long timestamp = candidate.getTimestamp();
|
||||
if (this.filter.filter(timestamp)) {
|
||||
continue;
|
||||
}
|
||||
dataPoints.add(candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reverse sort as timestamp is stored in a reversed order.
|
||||
Collections.sort(dataPoints, REVERSE_TIMESTAMP_COMPARATOR);
|
||||
return dataPoints;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper;
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import static com.navercorp.pinpoint.common.hbase.HBaseTables.*;
|
||||
|
||||
@@ -50,8 +50,9 @@ import org.springframework.stereotype.Component;
|
||||
* @author harebox
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Component
|
||||
public class AgentStatMapper implements RowMapper<List<AgentStat>> {
|
||||
@Deprecated
|
||||
@Component("legacyAgentStatMapper")
|
||||
public class LegacyAgentStatMapper implements RowMapper<List<AgentStat>> {
|
||||
|
||||
private TProtocolFactory factory = new TCompactProtocol.Factory();
|
||||
|
||||
@@ -195,5 +196,4 @@ public class AgentStatMapper implements RowMapper<List<AgentStat>> {
|
||||
result.add(agentStat);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.common.trace.BaseHistogramSchema;
|
||||
import com.navercorp.pinpoint.common.trace.HistogramSchema;
|
||||
import com.navercorp.pinpoint.common.trace.SlotType;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.chart.TitledPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledActiveTraceResultExtractor extends SampledAgentStatResultExtractor<ActiveTraceBo, SampledActiveTrace> {
|
||||
|
||||
private static final int UNCOLLECTED_COUNT = -1;
|
||||
public static final DownSampler<Integer> INTEGER_DOWN_SAMPLER = DownSamplers.getIntegerDownSampler(UNCOLLECTED_COUNT);
|
||||
|
||||
public SampledActiveTraceResultExtractor(TimeWindow timeWindow, AgentStatMapper<ActiveTraceBo> rowMapper) {
|
||||
super(timeWindow, rowMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SampledActiveTrace sampleCurrentBatch(long timestamp, List<ActiveTraceBo> dataPointsToSample) {
|
||||
HistogramSchema schema = BaseHistogramSchema.getDefaultHistogramSchemaByTypeCode(dataPointsToSample.get(0).getHistogramSchemaType());
|
||||
List<Integer> fastCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Integer> normalCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Integer> slowCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Integer> verySlowCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
for (ActiveTraceBo activeTraceBo : dataPointsToSample) {
|
||||
Map<SlotType, Integer> activeTraceCounts = activeTraceBo.getActiveTraceCounts();
|
||||
fastCounts.add(activeTraceCounts.get(SlotType.FAST));
|
||||
normalCounts.add(activeTraceCounts.get(SlotType.NORMAL));
|
||||
slowCounts.add(activeTraceCounts.get(SlotType.SLOW));
|
||||
verySlowCounts.add(activeTraceCounts.get(SlotType.VERY_SLOW));
|
||||
}
|
||||
SampledActiveTrace sampledActiveTrace = new SampledActiveTrace();
|
||||
sampledActiveTrace.setFastCounts(createSampledTitledPoint(schema.getFastSlot().getSlotName(), timestamp, fastCounts));
|
||||
sampledActiveTrace.setNormalCounts(createSampledTitledPoint(schema.getNormalSlot().getSlotName(), timestamp, normalCounts));
|
||||
sampledActiveTrace.setSlowCounts(createSampledTitledPoint(schema.getSlowSlot().getSlotName(), timestamp, slowCounts));
|
||||
sampledActiveTrace.setVerySlowCounts(createSampledTitledPoint(schema.getVerySlowSlot().getSlotName(), timestamp, verySlowCounts));
|
||||
return sampledActiveTrace;
|
||||
}
|
||||
|
||||
private TitledPoint<Long, Integer> createSampledTitledPoint(String title, long timestamp, List<Integer> values) {
|
||||
return new TitledPoint<>(
|
||||
title,
|
||||
timestamp,
|
||||
INTEGER_DOWN_SAMPLER.sampleMin(values),
|
||||
INTEGER_DOWN_SAMPLER.sampleMax(values),
|
||||
INTEGER_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.hbase.ResultsExtractor;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public abstract class SampledAgentStatResultExtractor<T extends AgentStatDataPoint, S extends SampledAgentStatDataPoint> implements ResultsExtractor<List<S>> {
|
||||
|
||||
private final TimeWindow timeWindow;
|
||||
private final AgentStatMapper<T> rowMapper;
|
||||
private final List<S> sampledDataPoints;
|
||||
|
||||
public SampledAgentStatResultExtractor(TimeWindow timeWindow, AgentStatMapper<T> rowMapper) {
|
||||
if (timeWindow.getWindowRangeCount() > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("range yields too many timeslots");
|
||||
}
|
||||
this.timeWindow = timeWindow;
|
||||
this.rowMapper = rowMapper;
|
||||
this.sampledDataPoints = new ArrayList<>((int) timeWindow.getWindowRangeCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<S> extractData(ResultScanner results) throws Exception {
|
||||
int rowNum = 0;
|
||||
// Sample straight away, tossing out already sampled data points so they can be garbage collected
|
||||
// as soon as possible.
|
||||
// This is mainly important when querying over a long period of time which simply using SampledChartBuilder
|
||||
// could could consume too much memory.
|
||||
List<T> currentBatchToSample = new ArrayList<>();
|
||||
long currentTimeslotTimestamp = 0;
|
||||
for (Result result : results) {
|
||||
List<T> dataPoints = this.rowMapper.mapRow(result, rowNum++);
|
||||
for (T dataPoint : dataPoints) {
|
||||
long timestamp = dataPoint.getTimestamp();
|
||||
long timeslotTimestamp = this.timeWindow.refineTimestamp(timestamp);
|
||||
if (currentTimeslotTimestamp == 0 || currentTimeslotTimestamp == timeslotTimestamp) {
|
||||
currentBatchToSample.add(dataPoint);
|
||||
currentTimeslotTimestamp = timeslotTimestamp;
|
||||
} else if (timeslotTimestamp < currentTimeslotTimestamp) {
|
||||
// currentBatchToSample shouldn't be empty at this point
|
||||
S sampledBatch = sampleCurrentBatch(currentTimeslotTimestamp, currentBatchToSample);
|
||||
this.sampledDataPoints.add(sampledBatch);
|
||||
currentBatchToSample = new ArrayList<>();
|
||||
currentBatchToSample.add(dataPoint);
|
||||
currentTimeslotTimestamp = timeslotTimestamp;
|
||||
} else {
|
||||
// Results should be sorted in a descending order of their actual timestamp values
|
||||
// as they are stored using reverse timestamp.
|
||||
throw new IllegalStateException("Out of order AgentStatDataPoint");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!currentBatchToSample.isEmpty()) {
|
||||
S sampledBatch = sampleCurrentBatch(currentTimeslotTimestamp, currentBatchToSample);
|
||||
sampledDataPoints.add(sampledBatch);
|
||||
}
|
||||
return this.sampledDataPoints;
|
||||
}
|
||||
|
||||
protected abstract S sampleCurrentBatch(long timestamp, List<T> dataPointsToSample);
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledCpuLoadResultExtractor extends SampledAgentStatResultExtractor<CpuLoadBo, SampledCpuLoad> {
|
||||
|
||||
private static final double UNCOLLECTED_CPU_LOAD = -1D;
|
||||
private static final int NUM_DECIMAL_PLACES = 1;
|
||||
public static final DownSampler<Double> DOUBLE_DOWN_SAMPLER = DownSamplers.getDoubleDownSampler(UNCOLLECTED_CPU_LOAD, NUM_DECIMAL_PLACES);
|
||||
|
||||
public SampledCpuLoadResultExtractor(TimeWindow timeWindow, AgentStatMapper<CpuLoadBo> rowMapper) {
|
||||
super(timeWindow, rowMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SampledCpuLoad sampleCurrentBatch(long timestamp, List<CpuLoadBo> dataPointsToSample) {
|
||||
List<Double> jvmCpuLoads = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> systemCpuLoads = new ArrayList<>(dataPointsToSample.size());
|
||||
for (CpuLoadBo cpuLoadBo : dataPointsToSample) {
|
||||
jvmCpuLoads.add(cpuLoadBo.getJvmCpuLoad() * 100);
|
||||
systemCpuLoads.add(cpuLoadBo.getSystemCpuLoad() * 100);
|
||||
}
|
||||
SampledCpuLoad sampledCpuLoad = new SampledCpuLoad();
|
||||
sampledCpuLoad.setJvmCpuLoad(createPoint(timestamp, jvmCpuLoads));
|
||||
sampledCpuLoad.setSystemCpuLoad(createPoint(timestamp, systemCpuLoads));
|
||||
return sampledCpuLoad;
|
||||
}
|
||||
|
||||
private Point<Long, Double> createPoint(long timestamp, List<Double> values) {
|
||||
return new Point<>(timestamp, DOUBLE_DOWN_SAMPLER.sampleMin(values), DOUBLE_DOWN_SAMPLER.sampleMax(values), DOUBLE_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledJvmGcDetailedResultExtractor extends SampledAgentStatResultExtractor<JvmGcDetailedBo, SampledJvmGcDetailed> {
|
||||
|
||||
private static final long UNCOLLECTED_VALUE = -1L;
|
||||
private static final int NUM_DECIMAL_PLACES = 1;
|
||||
public static final DownSampler<Long> LONG_DOWN_SAMPLER = DownSamplers.getLongDownSampler(UNCOLLECTED_VALUE);
|
||||
public static final DownSampler<Double> DOUBLE_DOWN_SAMPLER = DownSamplers.getDoubleDownSampler(UNCOLLECTED_VALUE, NUM_DECIMAL_PLACES);
|
||||
|
||||
public SampledJvmGcDetailedResultExtractor(TimeWindow timeWindow, AgentStatMapper<JvmGcDetailedBo> rowMapper) {
|
||||
super(timeWindow, rowMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SampledJvmGcDetailed sampleCurrentBatch(long timestamp, List<JvmGcDetailedBo> dataPointsToSample) {
|
||||
List<Long> gcNewCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> gcNewTimes = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> codeCacheUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> newGenUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> oldGenUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> survivorSpaceUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> permGenUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> metaspaceUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
for (JvmGcDetailedBo jvmGcDetailedBo : dataPointsToSample) {
|
||||
gcNewCounts.add(jvmGcDetailedBo.getGcNewCount());
|
||||
gcNewTimes.add(jvmGcDetailedBo.getGcNewTime());
|
||||
codeCacheUseds.add(jvmGcDetailedBo.getCodeCacheUsed() * 100);
|
||||
newGenUseds.add(jvmGcDetailedBo.getNewGenUsed() * 100);
|
||||
oldGenUseds.add(jvmGcDetailedBo.getOldGenUsed() * 100);
|
||||
survivorSpaceUseds.add(jvmGcDetailedBo.getSurvivorSpaceUsed() * 100);
|
||||
permGenUseds.add(jvmGcDetailedBo.getPermGenUsed() * 100);
|
||||
metaspaceUseds.add(jvmGcDetailedBo.getMetaspaceUsed() * 100);
|
||||
}
|
||||
SampledJvmGcDetailed sampledJvmGcDetailed = new SampledJvmGcDetailed();
|
||||
sampledJvmGcDetailed.setGcNewCount(createLongPoint(timestamp, gcNewCounts));
|
||||
sampledJvmGcDetailed.setGcNewTime(createLongPoint(timestamp, gcNewTimes));
|
||||
sampledJvmGcDetailed.setCodeCacheUsed(createDoublePoint(timestamp, codeCacheUseds));
|
||||
sampledJvmGcDetailed.setNewGenUsed(createDoublePoint(timestamp, newGenUseds));
|
||||
sampledJvmGcDetailed.setOldGenUsed(createDoublePoint(timestamp, oldGenUseds));
|
||||
sampledJvmGcDetailed.setSurvivorSpaceUsed(createDoublePoint(timestamp, survivorSpaceUseds));
|
||||
sampledJvmGcDetailed.setPermGenUsed(createDoublePoint(timestamp, permGenUseds));
|
||||
sampledJvmGcDetailed.setMetaspaceUsed(createDoublePoint(timestamp, metaspaceUseds));
|
||||
return sampledJvmGcDetailed;
|
||||
}
|
||||
|
||||
private Point<Long, Long> createLongPoint(long timestamp, List<Long> values) {
|
||||
return new Point<>(timestamp, LONG_DOWN_SAMPLER.sampleMin(values), LONG_DOWN_SAMPLER.sampleMax(values), LONG_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
|
||||
private Point<Long, Double> createDoublePoint(long timestamp, List<Double> values) {
|
||||
return new Point(timestamp, DOUBLE_DOWN_SAMPLER.sampleMin(values), DOUBLE_DOWN_SAMPLER.sampleMax(values), DOUBLE_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledJvmGcResultExtractor extends SampledAgentStatResultExtractor<JvmGcBo, SampledJvmGc> {
|
||||
|
||||
private static final long UNCOLLECTED_VALUE = -1L;
|
||||
public static final DownSampler<Long> LONG_DOWN_SAMPLER = DownSamplers.getLongDownSampler(UNCOLLECTED_VALUE);
|
||||
|
||||
public SampledJvmGcResultExtractor(TimeWindow timeWindow, AgentStatMapper<JvmGcBo> rowMapper) {
|
||||
super(timeWindow, rowMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SampledJvmGc sampleCurrentBatch(long timestamp, List<JvmGcBo> dataPointsToSample) {
|
||||
List<Long> heapUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> heapMaxes = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> nonHeapUseds = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> nonHeapMaxes = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> gcOldCounts = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Long> gcOldTimes = new ArrayList<>(dataPointsToSample.size());
|
||||
for (JvmGcBo jvmGcBo : dataPointsToSample) {
|
||||
heapUseds.add(jvmGcBo.getHeapUsed());
|
||||
heapMaxes.add(jvmGcBo.getHeapMax());
|
||||
nonHeapUseds.add(jvmGcBo.getNonHeapUsed());
|
||||
nonHeapMaxes.add(jvmGcBo.getNonHeapMax());
|
||||
gcOldCounts.add(jvmGcBo.getGcOldCount());
|
||||
gcOldTimes.add(jvmGcBo.getGcOldTime());
|
||||
}
|
||||
SampledJvmGc sampledJvmGc = new SampledJvmGc();
|
||||
sampledJvmGc.setHeapUsed(createPoint(timestamp, heapUseds));
|
||||
sampledJvmGc.setHeapMax(createPoint(timestamp, heapMaxes));
|
||||
sampledJvmGc.setNonHeapUsed(createPoint(timestamp, nonHeapUseds));
|
||||
sampledJvmGc.setNonHeapMax(createPoint(timestamp, nonHeapMaxes));
|
||||
sampledJvmGc.setGcOldCount(createPoint(timestamp, gcOldCounts));
|
||||
sampledJvmGc.setGcOldTime(createPoint(timestamp, gcOldTimes));
|
||||
return sampledJvmGc;
|
||||
}
|
||||
|
||||
private Point<Long, Long> createPoint(long timestamp, List<Long> values) {
|
||||
return new Point<>(timestamp, LONG_DOWN_SAMPLER.sampleMin(values), LONG_DOWN_SAMPLER.sampleMax(values), LONG_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.mapper.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils;
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledTransactionResultExtractor extends SampledAgentStatResultExtractor<TransactionBo, SampledTransaction> {
|
||||
|
||||
private static final double UNCOLLECTED_TPS = -1D;
|
||||
private static final int NUM_DECIMAL_PLACES = 1;
|
||||
public static final DownSampler<Double> DOUBLE_DOWN_SAMPLER = DownSamplers.getDoubleDownSampler(UNCOLLECTED_TPS, NUM_DECIMAL_PLACES);
|
||||
|
||||
public SampledTransactionResultExtractor(TimeWindow timeWindow, AgentStatMapper<TransactionBo> rowMapper) {
|
||||
super(timeWindow, rowMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SampledTransaction sampleCurrentBatch(long timestamp, List<TransactionBo> dataPointsToSample) {
|
||||
List<Double> sampledNews = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> sampledContinuations = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> unsampledNews = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> unsampledContinuations = new ArrayList<>(dataPointsToSample.size());
|
||||
List<Double> totals = new ArrayList<>(dataPointsToSample.size());
|
||||
for (TransactionBo transactionBo : dataPointsToSample) {
|
||||
long collectInterval = transactionBo.getCollectInterval();
|
||||
long sampledNewCount = transactionBo.getSampledNewCount();
|
||||
long sampledContinuationCount = transactionBo.getSampledContinuationCount();
|
||||
long unsampledNewCount = transactionBo.getUnsampledNewCount();
|
||||
long unsampledContinuationCount = transactionBo.getUnsampledContinuationCount();
|
||||
long total = sampledNewCount + sampledContinuationCount + unsampledNewCount + unsampledContinuationCount;
|
||||
sampledNews.add(calculateTps(sampledNewCount, collectInterval));
|
||||
sampledContinuations.add(calculateTps(sampledContinuationCount, collectInterval));
|
||||
unsampledNews.add(calculateTps(unsampledNewCount, collectInterval));
|
||||
unsampledContinuations.add(calculateTps(unsampledContinuationCount, collectInterval));
|
||||
totals.add(calculateTps(total, collectInterval));
|
||||
}
|
||||
SampledTransaction sampledTransaction = new SampledTransaction();
|
||||
sampledTransaction.setSampledNew(createPoint(timestamp, sampledNews));
|
||||
sampledTransaction.setSampledContinuation(createPoint(timestamp, sampledContinuations));
|
||||
sampledTransaction.setUnsampledNew(createPoint(timestamp, unsampledNews));
|
||||
sampledTransaction.setUnsampledContinuation(createPoint(timestamp, unsampledContinuations));
|
||||
sampledTransaction.setTotal(createPoint(timestamp, totals));
|
||||
return sampledTransaction;
|
||||
}
|
||||
|
||||
private double calculateTps(long count, long intervalMs) {
|
||||
return AgentStatUtils.calculateRate(count, intervalMs, NUM_DECIMAL_PLACES, UNCOLLECTED_TPS);
|
||||
}
|
||||
|
||||
private Point<Long, Double> createPoint(long timestamp, List<Double> values) {
|
||||
return new Point<>(timestamp, DOUBLE_DOWN_SAMPLER.sampleMin(values), DOUBLE_DOWN_SAMPLER.sampleMax(values), DOUBLE_DOWN_SAMPLER.sampleAvg(values));
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,14 @@
|
||||
package com.navercorp.pinpoint.web.service;
|
||||
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.navercorp.pinpoint.web.dao.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.vo.Application;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.ApplicationIndexDao;
|
||||
@@ -52,7 +53,8 @@ public class AdminServiceImpl implements AdminService {
|
||||
private ApplicationIndexDao applicationIndexDao;
|
||||
|
||||
@Autowired
|
||||
private AgentStatDao agentStatDao;
|
||||
@Qualifier("jvmGcDaoFactory")
|
||||
private JvmGcDao jvmGcDao;
|
||||
|
||||
@Override
|
||||
public void removeApplicationName(String applicationName) {
|
||||
@@ -154,7 +156,10 @@ public class AdminServiceImpl implements AdminService {
|
||||
final long fromTimestamp = cal.getTimeInMillis();
|
||||
Range queryRange = new Range(fromTimestamp, toTimestamp);
|
||||
for (String agentId : agentIds) {
|
||||
boolean dataExists = this.agentStatDao.agentStatExists(agentId, queryRange);
|
||||
// FIXME This needs to be done with a more accurate information.
|
||||
// If at any time a non-java agent is introduced, or an agent that does not collect jvm data,
|
||||
// this will fail
|
||||
boolean dataExists = this.jvmGcDao.agentStatExists(agentId, queryRange);
|
||||
if (!dataExists) {
|
||||
inactiveAgentIds.add(agentId);
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.ActiveTraceChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class ActiveTraceChartService implements AgentStatChartService {
|
||||
|
||||
private final SampledActiveTraceDao sampledActiveTraceDao;
|
||||
|
||||
@Autowired
|
||||
public ActiveTraceChartService(@Qualifier("sampledActiveTraceDaoFactory") SampledActiveTraceDao sampledActiveTraceDao) {
|
||||
this.sampledActiveTraceDao = sampledActiveTraceDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledActiveTrace> sampledActiveTraces = this.sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
return new ActiveTraceChartGroup(timeWindow, sampledActiveTraces);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.ActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class ActiveTraceService implements AgentStatService<ActiveTraceBo> {
|
||||
|
||||
private final ActiveTraceDao activeTraceDao;
|
||||
|
||||
@Autowired
|
||||
public ActiveTraceService(@Qualifier("activeTraceDaoFactory") ActiveTraceDao activeTraceDao) {
|
||||
this.activeTraceDao = activeTraceDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActiveTraceBo> selectAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
return this.activeTraceDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
}
|
||||
+27
-30
@@ -1,30 +1,27 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class SampledTimeSeriesLongChartBuilder extends SampledTimeSeriesChartBuilder<Long> {
|
||||
|
||||
public SampledTimeSeriesLongChartBuilder(DownSampler<Long> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler, timeWindow);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface AgentStatChartService {
|
||||
AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface AgentStatService<T extends AgentStatDataPoint> {
|
||||
List<T> selectAgentStatList(String agentId, Range range);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.CpuLoadChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class CpuLoadChartService implements AgentStatChartService {
|
||||
|
||||
private final SampledCpuLoadDao sampledCpuLoadDao;
|
||||
|
||||
@Autowired
|
||||
public CpuLoadChartService(@Qualifier("sampledCpuLoadDaoFactory") SampledCpuLoadDao sampledCpuLoadDao) {
|
||||
this.sampledCpuLoadDao = sampledCpuLoadDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledCpuLoad> sampledCpuLoads = this.sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
return new CpuLoadChartGroup(timeWindow, sampledCpuLoads);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.CpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class CpuLoadService implements AgentStatService<CpuLoadBo> {
|
||||
|
||||
private final CpuLoadDao cpuLoadDao;
|
||||
|
||||
@Autowired
|
||||
public CpuLoadService(@Qualifier("cpuLoadDaoFactory") CpuLoadDao cpuLoadDao) {
|
||||
this.cpuLoadDao = cpuLoadDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CpuLoadBo> selectAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
return this.cpuLoadDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.JvmGcChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class JvmGcChartService implements AgentStatChartService {
|
||||
|
||||
private final SampledJvmGcDao sampledJvmGcDao;
|
||||
|
||||
@Autowired
|
||||
public JvmGcChartService(@Qualifier("sampledJvmGcDaoFactory") SampledJvmGcDao sampledJvmGcDao) {
|
||||
this.sampledJvmGcDao = sampledJvmGcDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledJvmGc> sampledJvmGcs = this.sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
return new JvmGcChartGroup(timeWindow, sampledJvmGcs);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGcDetailed;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.JvmGcDetailedChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class JvmGcDetailedChartService implements AgentStatChartService {
|
||||
|
||||
private final SampledJvmGcDetailedDao sampledJvmGcDetailedDao;
|
||||
|
||||
@Autowired
|
||||
public JvmGcDetailedChartService(@Qualifier("sampledJvmGcDetailedDaoFactory") SampledJvmGcDetailedDao sampledJvmGcDetailedDao) {
|
||||
this.sampledJvmGcDetailedDao = sampledJvmGcDetailedDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledJvmGcDetailed> sampledJvmGcDetaileds = this.sampledJvmGcDetailedDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
return new JvmGcDetailedChartGroup(timeWindow, sampledJvmGcDetaileds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDetailedDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class JvmGcDetailedService implements AgentStatService<JvmGcDetailedBo> {
|
||||
|
||||
private final JvmGcDetailedDao jvmGcDetailedDao;
|
||||
|
||||
@Autowired
|
||||
public JvmGcDetailedService(@Qualifier("jvmGcDetailedDaoFactory") JvmGcDetailedDao jvmGcDetailedDao) {
|
||||
this.jvmGcDetailedDao = jvmGcDetailedDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JvmGcDetailedBo> selectAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
return this.jvmGcDetailedDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
}
|
||||
+21
-22
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,39 +14,38 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service;
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.JvmGcDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.AgentStatDao;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author harebox
|
||||
* @author hyungil.jeong
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class AgentStatServiceImpl implements AgentStatService {
|
||||
public class JvmGcService implements AgentStatService<JvmGcBo> {
|
||||
|
||||
private final JvmGcDao jvmGcDao;
|
||||
|
||||
@Autowired
|
||||
private AgentStatDao agentStatDao;
|
||||
public JvmGcService(@Qualifier("jvmGcDaoFactory") JvmGcDao jvmGcDao) {
|
||||
this.jvmGcDao = jvmGcDao;
|
||||
}
|
||||
|
||||
public List<AgentStat> selectAgentStatList(String agentId, Range range) {
|
||||
@Override
|
||||
public List<JvmGcBo> selectAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
return agentStatDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
|
||||
public List<AgentStat> selectAggregatedAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
return agentStatDao.getAggregatedAgentStatList(agentId, range);
|
||||
return this.jvmGcDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.LegacyAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Service
|
||||
public class LegacyAgentStatChartCompatibilityService implements LegacyAgentStatChartService {
|
||||
|
||||
@Autowired
|
||||
private LegacyAgentStatDao legacyAgentStatDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledJvmGcDaoV2")
|
||||
private SampledJvmGcDao sampledJvmGcDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledCpuLoadDaoV2")
|
||||
private SampledCpuLoadDao sampledCpuLoadDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledTransactionDaoV2")
|
||||
private SampledTransactionDao sampledTransactionDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledActiveTraceDaoV2")
|
||||
private SampledActiveTraceDao sampledActiveTraceDao;
|
||||
|
||||
@Override
|
||||
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledJvmGc> jvmGcs = sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
if (CollectionUtils.isNotEmpty(jvmGcs)) {
|
||||
List<SampledCpuLoad> cpuLoads = sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
List<SampledTransaction> transactions = sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
List<SampledActiveTrace> activeTraces = sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder builder = new LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder(timeWindow);
|
||||
builder.jvmGcs(jvmGcs);
|
||||
builder.cpuLoads(cpuLoads);
|
||||
builder.transactions(transactions);
|
||||
builder.activeTraces(activeTraces);
|
||||
return builder.build();
|
||||
} else {
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range rangeToScan = new Range(scanFrom, scanTo);
|
||||
List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
|
||||
LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
|
||||
chartGroup.addAgentStats(agentStats);
|
||||
chartGroup.buildCharts();
|
||||
return chartGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-30
@@ -1,30 +1,28 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class SampledTimeSeriesDoubleChartBuilder extends SampledTimeSeriesChartBuilder<Double> {
|
||||
|
||||
public SampledTimeSeriesDoubleChartBuilder(DownSampler<Double> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler, timeWindow);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public interface LegacyAgentStatChartService {
|
||||
LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow);
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Service("legacyAgentStatChartServiceFactory")
|
||||
public class LegacyAgentStatChartServiceFactory implements FactoryBean<LegacyAgentStatChartService> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Value("#{pinpointWebProps['web.experimental.stat.format.compatibility.version'] ?: 'v1'}")
|
||||
private String mode = "v1";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartV1Service")
|
||||
private LegacyAgentStatChartService v1;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartV2Service")
|
||||
private LegacyAgentStatChartService v2;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("legacyAgentStatChartCompatibilityService")
|
||||
private LegacyAgentStatChartService compatibility;
|
||||
|
||||
@Override
|
||||
public LegacyAgentStatChartService getObject() throws Exception {
|
||||
logger.info("LegacyAgentStatService Compatibility {}", mode);
|
||||
if (mode.equalsIgnoreCase("v1")) {
|
||||
return v1;
|
||||
} else if (mode.equalsIgnoreCase("v2")) {
|
||||
return v2;
|
||||
} else if (mode.equalsIgnoreCase("compatibilityMode")) {
|
||||
return compatibility;
|
||||
}
|
||||
return v1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return LegacyAgentStatChartService.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.LegacyAgentStatDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Service
|
||||
public class LegacyAgentStatChartV1Service implements LegacyAgentStatChartService {
|
||||
|
||||
@Autowired
|
||||
private LegacyAgentStatDao legacyAgentStatDao;
|
||||
|
||||
@Override
|
||||
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
long scanFrom = timeWindow.getWindowRange().getFrom();
|
||||
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
|
||||
Range rangeToScan = new Range(scanFrom, scanTo);
|
||||
List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
|
||||
LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
|
||||
chartGroup.addAgentStats(agentStats);
|
||||
chartGroup.buildCharts();
|
||||
return chartGroup;
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledActiveTraceDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledCpuLoadDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledJvmGcDao;
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.LegacyAgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledCpuLoad;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledJvmGc;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
@Service
|
||||
public class LegacyAgentStatChartV2Service implements LegacyAgentStatChartService {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledJvmGcDaoV2")
|
||||
private SampledJvmGcDao sampledJvmGcDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledCpuLoadDaoV2")
|
||||
private SampledCpuLoadDao sampledCpuLoadDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledTransactionDaoV2")
|
||||
private SampledTransactionDao sampledTransactionDao;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("sampledActiveTraceDaoV2")
|
||||
private SampledActiveTraceDao sampledActiveTraceDao;
|
||||
|
||||
@Override
|
||||
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledJvmGc> jvmGcs = sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
List<SampledCpuLoad> cpuLoads = sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
List<SampledTransaction> transactions = sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
List<SampledActiveTrace> activeTraces = sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder builder = new LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder(timeWindow);
|
||||
builder.jvmGcs(jvmGcs);
|
||||
builder.cpuLoads(cpuLoads);
|
||||
builder.transactions(transactions);
|
||||
builder.activeTraces(activeTraces);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.dao.stat.SampledTransactionDao;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.SampledTransaction;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.AgentStatChartGroup;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.TransactionChartGroup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class TransactionChartService implements AgentStatChartService {
|
||||
|
||||
private final SampledTransactionDao sampledTransactionDao;
|
||||
|
||||
@Autowired
|
||||
public TransactionChartService(@Qualifier("sampledTransactionDaoFactory") SampledTransactionDao sampledTransactionDao) {
|
||||
this.sampledTransactionDao = sampledTransactionDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentStatChartGroup selectAgentChart(String agentId, TimeWindow timeWindow) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (timeWindow == null) {
|
||||
throw new NullPointerException("timeWindow must not be null");
|
||||
}
|
||||
List<SampledTransaction> sampledTransactions = this.sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
|
||||
return new TransactionChartGroup(timeWindow, sampledTransactions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.service.stat;
|
||||
|
||||
import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo;
|
||||
import com.navercorp.pinpoint.web.dao.stat.TransactionDao;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Service
|
||||
public class TransactionService implements AgentStatService<TransactionBo> {
|
||||
|
||||
private final TransactionDao transactionDao;
|
||||
|
||||
@Autowired
|
||||
public TransactionService(@Qualifier("transactionDaoFactory") TransactionDao transactionDao) {
|
||||
this.transactionDao = transactionDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransactionBo> selectAgentStatList(String agentId, Range range) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
if (range == null) {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
return this.transactionDao.getAgentStatList(agentId, range);
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
/**
|
||||
* Copyright 2014 NAVER Corp.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.navercorp.pinpoint.web.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
|
||||
/**
|
||||
* @author Jongho Moon
|
||||
*
|
||||
*/
|
||||
public class AgentStats {
|
||||
public static final Comparator<AgentStat> TIMESTAMP_COMPARATOR = new Comparator<AgentStat>() {
|
||||
|
||||
@Override
|
||||
public int compare(AgentStat o1, AgentStat o2) {
|
||||
return Long.compare(o1.getTimestamp(), o2.getTimestamp());
|
||||
}
|
||||
};
|
||||
|
||||
public static List<AgentStat> aggregate(List<AgentStat> stats, long newInterval) {
|
||||
return new Aggregator(stats, newInterval).aggregate();
|
||||
}
|
||||
|
||||
|
||||
private static class Aggregator {
|
||||
private final List<AgentStat> stats;
|
||||
private final long interval;
|
||||
|
||||
public Aggregator(List<AgentStat> stats, long interval) {
|
||||
this.interval = interval;
|
||||
this.stats = new ArrayList<>(stats);
|
||||
Collections.sort(this.stats, TIMESTAMP_COMPARATOR);
|
||||
}
|
||||
|
||||
public List<AgentStat> aggregate() {
|
||||
if (stats.isEmpty()) {
|
||||
return stats;
|
||||
}
|
||||
|
||||
List<AgentStat> result = new ArrayList<>();
|
||||
AgentStat current = toAggregatedAgentStat(stats.get(0));
|
||||
|
||||
for (AgentStat stat : stats.subList(1, stats.size())) {
|
||||
long timestamp = toAggregatedTimestamp(stat, interval);
|
||||
|
||||
if (current.getTimestamp() == timestamp) {
|
||||
current = merge(current, stat, interval);
|
||||
} else {
|
||||
result.add(current);
|
||||
current = toAggregatedAgentStat(stat);
|
||||
}
|
||||
}
|
||||
|
||||
current.setCollectInterval(interval);
|
||||
result.add(current);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private AgentStat toAggregatedAgentStat(AgentStat stat) {
|
||||
long timestamp = toAggregatedTimestamp(stat, interval);
|
||||
AgentStat result = new AgentStat(stat.getAgentId(), timestamp);
|
||||
|
||||
result.setCollectInterval(interval);
|
||||
|
||||
result.setGcType(stat.getGcType());
|
||||
result.setGcOldCount(stat.getGcOldCount());
|
||||
result.setGcOldTime(stat.getGcOldTime());
|
||||
|
||||
result.setHeapUsed(stat.getHeapUsed());
|
||||
result.setHeapMax(stat.getHeapMax());
|
||||
|
||||
result.setNonHeapUsed(stat.getNonHeapUsed());
|
||||
result.setNonHeapMax(stat.getNonHeapMax());
|
||||
|
||||
result.setJvmCpuUsage(stat.getJvmCpuUsage());
|
||||
result.setSystemCpuUsage(stat.getSystemCpuUsage());
|
||||
|
||||
result.setSampledNewCount(stat.getSampledNewCount());
|
||||
result.setSampledContinuationCount(stat.getSampledContinuationCount());
|
||||
result.setUnsampledNewCount(stat.getUnsampledNewCount());
|
||||
result.setUnsampledContinuationCount(stat.getUnsampledContinuationCount());
|
||||
|
||||
result.setHistogramSchema(stat.getHistogramSchema());
|
||||
result.setActiveTraceCounts(stat.getActiveTraceCounts());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static long toAggregatedTimestamp(AgentStat stat, long interval) {
|
||||
long timestamp = (stat.getTimestamp() / interval) * interval;
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public static AgentStat merge(AgentStat s1, AgentStat s2, long interval) {
|
||||
AgentStat latest = s1.getTimestamp() > s2.getTimestamp() ? s1 : s2;
|
||||
|
||||
AgentStat stat = new AgentStat(s1.getAgentId(), latest.getTimestamp());
|
||||
stat.setCollectInterval(interval);
|
||||
|
||||
stat.setGcType(latest.getGcType());
|
||||
stat.setGcOldCount(latest.getGcOldCount());
|
||||
stat.setGcOldTime(latest.getGcOldTime());
|
||||
|
||||
stat.setHeapUsed(latest.getHeapUsed());
|
||||
stat.setHeapMax(maxValue(s1.getHeapMax(), s2.getHeapMax()));
|
||||
|
||||
stat.setNonHeapUsed(latest.getNonHeapUsed());
|
||||
stat.setNonHeapMax(maxValue(s1.getNonHeapMax(), s2.getNonHeapMax()));
|
||||
|
||||
stat.setJvmCpuUsage(latest.getJvmCpuUsage());
|
||||
stat.setSystemCpuUsage(latest.getSystemCpuUsage());
|
||||
|
||||
stat.setSampledNewCount(addValue(s1.getSampledNewCount(), s2.getSampledNewCount()));
|
||||
stat.setSampledContinuationCount(addValue(s1.getSampledContinuationCount(), s2.getSampledContinuationCount()));
|
||||
stat.setUnsampledNewCount(addValue(s1.getUnsampledNewCount(), s2.getUnsampledNewCount()));
|
||||
stat.setUnsampledContinuationCount(addValue(s1.getUnsampledContinuationCount(), s2.getUnsampledContinuationCount()));
|
||||
|
||||
stat.setHistogramSchema(latest.getHistogramSchema());
|
||||
stat.setActiveTraceCounts(latest.getActiveTraceCounts());
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
private static long addValue(long v1, long v2) {
|
||||
if (v1 == AgentStat.NOT_COLLECTED) {
|
||||
if (v2 == AgentStat.NOT_COLLECTED) {
|
||||
return AgentStat.NOT_COLLECTED;
|
||||
} else {
|
||||
return v2;
|
||||
}
|
||||
} else {
|
||||
if (v1 == AgentStat.NOT_COLLECTED) {
|
||||
return v1;
|
||||
} else {
|
||||
return v1 + v2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static long maxValue(long v1, long v2) {
|
||||
if (v1 == AgentStat.NOT_COLLECTED) {
|
||||
return v2;
|
||||
} else if (v2 == AgentStat.NOT_COLLECTED) {
|
||||
return v1;
|
||||
}
|
||||
|
||||
return v1 < v2 ? v2 : v1;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.navercorp.pinpoint.web.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -26,6 +25,7 @@ import com.navercorp.pinpoint.common.trace.SlotType;
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class AgentStat {
|
||||
public static final long AGGR_SAMPLE_INTERVAL = TimeUnit.MINUTES.toMillis(10);
|
||||
public static final long RAW_SAMPLE_INTERVAL = TimeUnit.SECONDS.toMillis(5);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Chart<X extends Number, Y extends Number> {
|
||||
|
||||
private final List<Point<X, Y>> points;
|
||||
|
||||
Chart(List<Point<X, Y>> points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public List<Point<X, Y>> getPoints() {
|
||||
return this.points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Chart chart = (Chart) o;
|
||||
|
||||
return points != null ? points.equals(chart.points) : chart.points == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return points != null ? points.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Chart{" +
|
||||
"points=" + points +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class DataPoint<X extends Number, Y extends Number> {
|
||||
|
||||
private final X xVal;
|
||||
private final Y yVal;
|
||||
|
||||
public DataPoint(X xVal, Y yVal) {
|
||||
this.xVal = xVal;
|
||||
this.yVal = yVal;
|
||||
}
|
||||
|
||||
public X getxVal() {
|
||||
return xVal;
|
||||
}
|
||||
|
||||
public Y getyVal() {
|
||||
return yVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + xVal + "," + yVal + ")";
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class DataPoint<X extends Number, Y extends Number> {
|
||||
|
||||
private final X xVal;
|
||||
private final Y yVal;
|
||||
|
||||
public DataPoint(X xVal, Y yVal) {
|
||||
this.xVal = xVal;
|
||||
this.yVal = yVal;
|
||||
}
|
||||
|
||||
public X getXVal() {
|
||||
return xVal;
|
||||
}
|
||||
|
||||
public Y getYVal() {
|
||||
return yVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + xVal + "," + yVal + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class LegacyChartBuilder<D extends DataPoint<X, Y>, X extends Number, Y extends Number> {
|
||||
|
||||
private final List<D> dataPoints;
|
||||
|
||||
protected LegacyChartBuilder() {
|
||||
this.dataPoints = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addDataPoint(D dataPoint) {
|
||||
this.dataPoints.add(dataPoint);
|
||||
}
|
||||
|
||||
public Chart<X, Y> buildChart() {
|
||||
List<Point<X, Y>> points = makePoints(this.dataPoints);
|
||||
return new Chart<>(points);
|
||||
}
|
||||
|
||||
protected List<Point<X, Y>> makePoints(List<D> dataPoints) {
|
||||
List<Point<X, Y>> points = new ArrayList<>(dataPoints.size());
|
||||
for (D dataPoint : dataPoints) {
|
||||
points.add(new Point<>(dataPoint.getXVal(), dataPoint.getYVal(), dataPoint.getYVal(), dataPoint.getYVal()));
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
public int numDataPoints() {
|
||||
return this.dataPoints.size();
|
||||
}
|
||||
}
|
||||
+51
-49
@@ -1,49 +1,51 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.ChartBuilder;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public abstract class SampledChartBuilder<X extends Number, Y extends Number> extends ChartBuilder<X, Y> {
|
||||
|
||||
private final DownSampler<Y> downSampler;
|
||||
|
||||
protected SampledChartBuilder(DownSampler<Y> downSampler) {
|
||||
if (downSampler == null) {
|
||||
throw new NullPointerException("downSampler must not be null");
|
||||
}
|
||||
this.downSampler = downSampler;
|
||||
}
|
||||
|
||||
protected final Y sampleMin(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleMin(sampleBuffer);
|
||||
}
|
||||
|
||||
protected final Y sampleMax(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleMax(sampleBuffer);
|
||||
}
|
||||
|
||||
protected final Y sampleAvg(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleAvg(sampleBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class LegacySampledChartBuilder<D extends DataPoint<X, Y>, X extends Number, Y extends Number> extends LegacyChartBuilder<D, X, Y> {
|
||||
|
||||
private final DownSampler<Y> downSampler;
|
||||
protected final Y defaultValue;
|
||||
|
||||
protected LegacySampledChartBuilder(DownSampler<Y> downSampler) {
|
||||
if (downSampler == null) {
|
||||
throw new NullPointerException("downSampler must not be null");
|
||||
}
|
||||
this.downSampler = downSampler;
|
||||
this.defaultValue = downSampler.getDefaultValue();
|
||||
}
|
||||
|
||||
protected final Y sampleMin(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleMin(sampleBuffer);
|
||||
}
|
||||
|
||||
protected final Y sampleMax(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleMax(sampleBuffer);
|
||||
}
|
||||
|
||||
protected final Y sampleAvg(List<Y> sampleBuffer) {
|
||||
return this.downSampler.sampleAvg(sampleBuffer);
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class LegacySampledTimeSeriesChartBuilder<D extends DataPoint<Long, Y>, Y extends Number> extends LegacySampledChartBuilder<D, Long, Y> {
|
||||
|
||||
private final TimeWindow timeWindow;
|
||||
|
||||
public LegacySampledTimeSeriesChartBuilder(DownSampler<Y> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler);
|
||||
if (timeWindow.getWindowRangeCount() > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("range yields too many timeslots");
|
||||
}
|
||||
this.timeWindow = timeWindow;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final List<Point<Long, Y>> makePoints(List<D> dataPoints) {
|
||||
List<List<D>> timeSlots = createTimeSlots(dataPoints);
|
||||
List<Point<Long, Y>> sampledPoints = new ArrayList<>(timeSlots.size());
|
||||
int index = 0;
|
||||
for (Long timestamp : this.timeWindow) {
|
||||
List<D> samples = timeSlots.get(index);
|
||||
if (samples.isEmpty()) {
|
||||
sampledPoints.add(new UncollectedPoint<>(timestamp, this.defaultValue));
|
||||
} else {
|
||||
sampledPoints.add(sampleDataPoints(timestamp, samples));
|
||||
}
|
||||
++index;
|
||||
}
|
||||
return sampledPoints;
|
||||
}
|
||||
|
||||
protected Point<Long, Y> sampleDataPoints(long timestamp, List<D> samples) {
|
||||
List<Y> values = new ArrayList<>(samples.size());
|
||||
for (D sample : samples) {
|
||||
values.add(sample.getYVal());
|
||||
}
|
||||
return new Point<>(timestamp, sampleMin(values), sampleMax(values), sampleAvg(values));
|
||||
}
|
||||
|
||||
private List<List<D>> createTimeSlots(List<D> dataPoints) {
|
||||
int numTimeSlots = (int) this.timeWindow.getWindowRangeCount();
|
||||
List<List<D>> timeSlots = new ArrayList<>(numTimeSlots);
|
||||
for (int i = 0; i < numTimeSlots; ++i) {
|
||||
timeSlots.add(new ArrayList<D>());
|
||||
}
|
||||
for (D dataPoint : dataPoints) {
|
||||
long timestamp = dataPoint.getXVal();
|
||||
int index = this.timeWindow.getWindowIndex(timestamp);
|
||||
if (index >= 0 && index < timeSlots.size()) {
|
||||
List<D> timeSlot = timeSlots.get(index);
|
||||
timeSlot.add(dataPoint);
|
||||
}
|
||||
}
|
||||
return timeSlots;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.stat.chart.DownSampler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class LegacySampledTitledTimeSeriesChartBuilder<Y extends Number> extends LegacySampledTimeSeriesChartBuilder<TitledDataPoint<Long, Y>, Y> {
|
||||
|
||||
public LegacySampledTitledTimeSeriesChartBuilder(DownSampler<Y> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler, timeWindow);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point<Long, Y> sampleDataPoints(long timestamp, List<TitledDataPoint<Long, Y>> samples) {
|
||||
String title = samples.get(0).getTitle();
|
||||
List<Y> values = new ArrayList<>(samples.size());
|
||||
for (TitledDataPoint<Long, Y> sample : samples) {
|
||||
values.add(sample.getYVal());
|
||||
}
|
||||
return new TitledPoint<>(title, timestamp, sampleMin(values), sampleMax(values), sampleAvg(values));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class Point<X extends Number, Y extends Number> {
|
||||
private final X xVal;
|
||||
private final Y minYVal;
|
||||
private final Y maxYVal;
|
||||
private final Y avgYVal;
|
||||
|
||||
public Point(X xVal, Y minYVal, Y maxYVal, Y avgYVal) {
|
||||
this.xVal = xVal;
|
||||
this.minYVal = minYVal;
|
||||
this.maxYVal = maxYVal;
|
||||
this.avgYVal = avgYVal;
|
||||
}
|
||||
|
||||
public X getxVal() {
|
||||
return xVal;
|
||||
}
|
||||
|
||||
public Y getMinYVal() {
|
||||
return minYVal;
|
||||
}
|
||||
|
||||
public Y getMaxYVal() {
|
||||
return maxYVal;
|
||||
}
|
||||
|
||||
public Y getAvgYVal() {
|
||||
return avgYVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Point<?, ?> point = (Point<?, ?>) o;
|
||||
|
||||
if (xVal != null ? !xVal.equals(point.xVal) : point.xVal != null) return false;
|
||||
if (minYVal != null ? !minYVal.equals(point.minYVal) : point.minYVal != null) return false;
|
||||
if (maxYVal != null ? !maxYVal.equals(point.maxYVal) : point.maxYVal != null) return false;
|
||||
return avgYVal != null ? avgYVal.equals(point.avgYVal) : point.avgYVal == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = xVal != null ? xVal.hashCode() : 0;
|
||||
result = 31 * result + (minYVal != null ? minYVal.hashCode() : 0);
|
||||
result = 31 * result + (maxYVal != null ? maxYVal.hashCode() : 0);
|
||||
result = 31 * result + (avgYVal != null ? avgYVal.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Point{" +
|
||||
"xVal=" + xVal +
|
||||
", minYVal=" + minYVal +
|
||||
", maxYVal=" + maxYVal +
|
||||
", avgYVal=" + avgYVal +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class TimeSeriesChartBuilder<Y extends Number> {
|
||||
|
||||
private final TimeWindow timeWindow;
|
||||
private final List<Point<Long, Y>> points;
|
||||
|
||||
public TimeSeriesChartBuilder(TimeWindow timeWindow) {
|
||||
this(timeWindow, null);
|
||||
}
|
||||
|
||||
public TimeSeriesChartBuilder(TimeWindow timeWindow, Y uncollectedValue) {
|
||||
if (timeWindow.getWindowRangeCount() > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("range yields too many timeslots");
|
||||
}
|
||||
this.timeWindow = timeWindow;
|
||||
int numTimeslots = (int) this.timeWindow.getWindowRangeCount();
|
||||
this.points = new ArrayList<>(numTimeslots);
|
||||
for (long timestamp : this.timeWindow) {
|
||||
this.points.add(new UncollectedPoint<>(timestamp, uncollectedValue));
|
||||
}
|
||||
}
|
||||
|
||||
public Chart<Long, Y> build(List<Point<Long, Y>> sampledPoints) {
|
||||
for (Point<Long, Y> sampledPoint : sampledPoints) {
|
||||
int timeslotIndex = this.timeWindow.getWindowIndex(sampledPoint.getxVal());
|
||||
this.points.set(timeslotIndex, sampledPoint);
|
||||
}
|
||||
return new Chart<>(this.points);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 NAVER Corp.
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,11 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
@Deprecated
|
||||
public class TitledDataPoint<X extends Number, Y extends Number> extends DataPoint<X, Y> {
|
||||
|
||||
private final String title;
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class TitledPoint<X extends Number, Y extends Number> extends Point<X, Y> {
|
||||
|
||||
private final String title;
|
||||
|
||||
public TitledPoint(String title, X xVal, Y minYVal, Y maxYVal, Y avgYVal) {
|
||||
super(xVal, minYVal, maxYVal, avgYVal);
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
TitledPoint<?, ?> that = (TitledPoint<?, ?>) o;
|
||||
|
||||
return title != null ? title.equals(that.title) : that.title == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (title != null ? title.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TitledPoint{" +
|
||||
"title='" + title + '\'' +
|
||||
"} " + super.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.chart;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class UncollectedPoint<X extends Number, Y extends Number> extends Point<X, Y> {
|
||||
|
||||
public UncollectedPoint(X xVal) {
|
||||
this(xVal, null);
|
||||
}
|
||||
|
||||
public UncollectedPoint(X xVal, Y uncollectedValue) {
|
||||
super(xVal, uncollectedValue, uncollectedValue, uncollectedValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UncollectedPoint{" + super.toString() + "}";
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Chart {
|
||||
|
||||
private final Points points;
|
||||
|
||||
private Chart(Points points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public List<Point> getPoints() {
|
||||
return this.points.getPoints();
|
||||
}
|
||||
|
||||
public static abstract class ChartBuilder<X extends Number, Y extends Number> {
|
||||
|
||||
protected abstract Points makePoints(List<DataPoint<X, Y>> dataPoints);
|
||||
|
||||
private final List<DataPoint<X, Y>> dataPoints;
|
||||
|
||||
protected ChartBuilder() {
|
||||
this.dataPoints = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addDataPoint(DataPoint<X, Y> dataPoint) {
|
||||
this.dataPoints.add(dataPoint);
|
||||
}
|
||||
|
||||
public Chart buildChart() {
|
||||
Points points = makePoints(this.dataPoints);
|
||||
return new Chart(points);
|
||||
}
|
||||
|
||||
public int numDataPoints() {
|
||||
return this.dataPoints.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class Points {
|
||||
|
||||
private final List<Point> points;
|
||||
|
||||
public Points() {
|
||||
this.points = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addPoint(Point point) {
|
||||
this.points.add(point);
|
||||
}
|
||||
|
||||
public List<Point> getPoints() {
|
||||
return Collections.unmodifiableList(this.points);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class Point {
|
||||
|
||||
private final Number timestamp;
|
||||
private final Number minVal;
|
||||
private final Number maxVal;
|
||||
private final Number avgVal;
|
||||
|
||||
public Point(Number timestamp, Number minVal, Number maxVal, Number avgVal) {
|
||||
this.timestamp = timestamp;
|
||||
this.minVal = minVal;
|
||||
this.maxVal = maxVal;
|
||||
this.avgVal = avgVal;
|
||||
}
|
||||
|
||||
public Number getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public Number getMinVal() {
|
||||
return minVal;
|
||||
}
|
||||
|
||||
public Number getMaxVal() {
|
||||
return maxVal;
|
||||
}
|
||||
|
||||
public Number getAvgVal() {
|
||||
return avgVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Point [timestamp=" + timestamp + ", minVal=" + minVal + ", maxVal=" + maxVal + ", avgVal=" + avgVal + "]";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.Points;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public abstract class SampledDataChartBuilder<X extends Number, Y extends Number> extends SampledChartBuilder<X, Y> {
|
||||
|
||||
private final int sampleRate;
|
||||
|
||||
protected SampledDataChartBuilder(DownSampler<Y> downSampler, int sampleRate) {
|
||||
super(downSampler);
|
||||
this.sampleRate = sampleRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Points makePoints(List<DataPoint<X, Y>> dataPoints) {
|
||||
Points points = new Points();
|
||||
for (int i = 0; i < dataPoints.size(); i += this.sampleRate) {
|
||||
final int beginIndex = i;
|
||||
final int endIndex = Math.min(beginIndex + this.sampleRate, dataPoints.size());
|
||||
List<DataPoint<X, Y>> sampleDataPoints = dataPoints.subList(beginIndex, endIndex);
|
||||
points.addPoint(makePoint(sampleDataPoints));
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
private Point makePoint(List<DataPoint<X, Y>> sampleDataPoints) {
|
||||
X xVal = sampleDataPoints.get(sampleDataPoints.size() - 1).getxVal();
|
||||
List<Y> sampleBuffer = new ArrayList<>(sampleDataPoints.size());
|
||||
for (DataPoint<X, Y> sampleDataPoint : sampleDataPoints) {
|
||||
sampleBuffer.add(sampleDataPoint.getyVal());
|
||||
}
|
||||
Y minVal = sampleMin(sampleBuffer);
|
||||
Y maxVal = sampleMax(sampleBuffer);
|
||||
Y avgVal = sampleAvg(sampleBuffer);
|
||||
return new Point(xVal, minVal, maxVal, avgVal);
|
||||
}
|
||||
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.Point;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.Points;
|
||||
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class SampledTimeSeriesChartBuilder<Y extends Number> extends SampledChartBuilder<Long, Y> {
|
||||
|
||||
private final TimeWindow timeWindow;
|
||||
private final List<List<Y>> timeslots;
|
||||
|
||||
public SampledTimeSeriesChartBuilder(DownSampler<Y> downSampler, TimeWindow timeWindow) {
|
||||
super(downSampler);
|
||||
if (timeWindow.getWindowRangeCount() > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("range yields too many timeslots");
|
||||
}
|
||||
this.timeWindow = timeWindow;
|
||||
int numTimeslots = (int) this.timeWindow.getWindowRangeCount();
|
||||
this.timeslots = new ArrayList<>(numTimeslots);
|
||||
initializeTimeslots(numTimeslots);
|
||||
}
|
||||
|
||||
private void initializeTimeslots(int numTimeslots) {
|
||||
for (int i = 0; i < numTimeslots; ++i) {
|
||||
this.timeslots.add(new ArrayList<Y>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Points makePoints(List<DataPoint<Long, Y>> dataPoints) {
|
||||
Points points = new Points();
|
||||
allocateDataPoints(dataPoints);
|
||||
int timeSlotIndex = 0;
|
||||
for (Long timestamp : this.timeWindow) {
|
||||
List<Y> samples = this.timeslots.get(timeSlotIndex);
|
||||
Point point = new Point(timestamp, sampleMin(samples), sampleMax(samples), sampleAvg(samples));
|
||||
points.addPoint(point);
|
||||
++timeSlotIndex;
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
private void allocateDataPoints(List<DataPoint<Long, Y>> dataPoints) {
|
||||
for (DataPoint<Long, Y> dataPoint : dataPoints) {
|
||||
int timeslotIndex = this.timeWindow.getWindowIndex(dataPoint.getxVal());
|
||||
if (isValidIndex(timeslotIndex)) {
|
||||
List<Y> timeSlottedDataPoints = this.timeslots.get(timeslotIndex);
|
||||
timeSlottedDataPoints.add(dataPoint.getyVal());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidIndex(int timeslot) {
|
||||
return timeslot >= 0 && timeslot < this.timeslots.size();
|
||||
}
|
||||
|
||||
}
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 NAVER Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.linechart.agentstat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.navercorp.pinpoint.common.trace.HistogramSchema;
|
||||
import com.navercorp.pinpoint.common.trace.SlotType;
|
||||
import com.navercorp.pinpoint.web.util.TimeWindow;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStat;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.DataPoint;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.DownSampler;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.DownSamplers;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.SampledTimeSeriesDoubleChartBuilder;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.SampledTimeSeriesIntegerChartBuilder;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.SampledTimeSeriesLongChartBuilder;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.Chart.ChartBuilder;
|
||||
import com.navercorp.pinpoint.web.vo.linechart.TitledDataPoint;
|
||||
|
||||
/**
|
||||
* @author harebox
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class AgentStatChartGroup {
|
||||
|
||||
private enum ChartType {
|
||||
JVM_MEMORY_HEAP_USED,
|
||||
JVM_MEMORY_HEAP_MAX,
|
||||
JVM_MEMORY_NON_HEAP_USED,
|
||||
JVM_MEMORY_NON_HEAP_MAX,
|
||||
JVM_GC_OLD_COUNT,
|
||||
JVM_GC_OLD_TIME,
|
||||
CPU_LOAD_JVM,
|
||||
CPU_LOAD_SYSTEM,
|
||||
TPS_SAMPLED_NEW,
|
||||
TPS_SAMPLED_CONTINUATION,
|
||||
TPS_UNSAMPLED_NEW,
|
||||
TPS_UNSAMPLED_CONTINUATION,
|
||||
TPS_TOTAL,
|
||||
ACTIVE_TRACE_FAST,
|
||||
ACTIVE_TRACE_NORMAL,
|
||||
ACTIVE_TRACE_SLOW,
|
||||
ACTIVE_TRACE_VERY_SLOW
|
||||
}
|
||||
|
||||
private static final int UNCOLLECTED_DATA = AgentStat.NOT_COLLECTED;
|
||||
private static final DownSampler<Integer> INTEGER_DOWN_SAMPLER = DownSamplers.getIntegerDownSampler(UNCOLLECTED_DATA);
|
||||
private static final DownSampler<Long> LONG_DOWN_SAMPLER = DownSamplers.getLongDownSampler(UNCOLLECTED_DATA);
|
||||
private static final DownSampler<Double> DOUBLE_DOWN_SAMPLER = DownSamplers.getDoubleDownSampler(UNCOLLECTED_DATA, 1);
|
||||
|
||||
private String type;
|
||||
|
||||
private final Map<ChartType, ChartBuilder<? extends Number, ? extends Number>> chartBuilders;
|
||||
|
||||
private final Map<ChartType, Chart> charts;
|
||||
|
||||
public AgentStatChartGroup(TimeWindow timeWindow) {
|
||||
this.chartBuilders = new EnumMap<>(ChartType.class);
|
||||
this.chartBuilders.put(ChartType.JVM_MEMORY_HEAP_USED, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.JVM_MEMORY_HEAP_MAX, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.JVM_MEMORY_NON_HEAP_USED, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.JVM_MEMORY_NON_HEAP_MAX, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.JVM_GC_OLD_COUNT, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.JVM_GC_OLD_TIME, new SampledTimeSeriesLongChartBuilder(LONG_DOWN_SAMPLER, timeWindow));
|
||||
|
||||
this.chartBuilders.put(ChartType.CPU_LOAD_JVM, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.CPU_LOAD_SYSTEM, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
|
||||
this.chartBuilders.put(ChartType.TPS_SAMPLED_NEW, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.TPS_SAMPLED_CONTINUATION, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.TPS_UNSAMPLED_NEW, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.TPS_UNSAMPLED_CONTINUATION, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.TPS_TOTAL, new SampledTimeSeriesDoubleChartBuilder(DOUBLE_DOWN_SAMPLER, timeWindow));
|
||||
|
||||
this.chartBuilders.put(ChartType.ACTIVE_TRACE_FAST, new SampledTimeSeriesIntegerChartBuilder(INTEGER_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.ACTIVE_TRACE_NORMAL, new SampledTimeSeriesIntegerChartBuilder(INTEGER_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.ACTIVE_TRACE_SLOW, new SampledTimeSeriesIntegerChartBuilder(INTEGER_DOWN_SAMPLER, timeWindow));
|
||||
this.chartBuilders.put(ChartType.ACTIVE_TRACE_VERY_SLOW, new SampledTimeSeriesIntegerChartBuilder(INTEGER_DOWN_SAMPLER, timeWindow));
|
||||
this.charts = new EnumMap<>(ChartType.class);
|
||||
}
|
||||
|
||||
public void addAgentStats(List<AgentStat> agentStats) {
|
||||
for (AgentStat agentStat : agentStats) {
|
||||
if (agentStat != null) {
|
||||
addMemoryGcData(agentStat);
|
||||
addCpuLoadData(agentStat);
|
||||
addTransactionData(agentStat);
|
||||
addActiveTraceData(agentStat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void buildCharts() {
|
||||
for (ChartType chartType : ChartType.values()) {
|
||||
this.charts.put(chartType, this.chartBuilders.get(chartType).buildChart());
|
||||
}
|
||||
}
|
||||
|
||||
private void addMemoryGcData(AgentStat agentStat) {
|
||||
this.type = agentStat.getGcType();
|
||||
long timestamp = agentStat.getTimestamp();
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_MEMORY_HEAP_USED)).addDataPoint(new DataPoint<>(timestamp, agentStat.getHeapUsed()));
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_MEMORY_HEAP_MAX)).addDataPoint(new DataPoint<>(timestamp, agentStat.getHeapMax()));
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_MEMORY_NON_HEAP_USED)).addDataPoint(new DataPoint<>(timestamp, agentStat.getNonHeapUsed()));
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_MEMORY_NON_HEAP_MAX)).addDataPoint(new DataPoint<>(timestamp, agentStat.getNonHeapMax()));
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_GC_OLD_COUNT)).addDataPoint(new DataPoint<>(timestamp, agentStat.getGcOldCount()));
|
||||
((SampledTimeSeriesLongChartBuilder) this.chartBuilders.get(ChartType.JVM_GC_OLD_TIME)).addDataPoint(new DataPoint<>(timestamp, agentStat.getGcOldTime()));
|
||||
}
|
||||
|
||||
private void addCpuLoadData(AgentStat agentStat) {
|
||||
long timestamp = agentStat.getTimestamp();
|
||||
double jvmCpuUsagePercentage = agentStat.getJvmCpuUsage() * 100;
|
||||
double systemCpuUsagePercentage = agentStat.getSystemCpuUsage() * 100;
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.CPU_LOAD_JVM)).addDataPoint(new DataPoint<>(timestamp, jvmCpuUsagePercentage));
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.CPU_LOAD_SYSTEM)).addDataPoint(new DataPoint<>(timestamp, systemCpuUsagePercentage));
|
||||
}
|
||||
|
||||
private void addTransactionData(AgentStat agentStat) {
|
||||
long timestamp = agentStat.getTimestamp();
|
||||
long interval = agentStat.getCollectInterval();
|
||||
if (interval > 0) {
|
||||
double sampledNewTps = calculateTps(agentStat.getSampledNewCount(), interval);
|
||||
double sampledContinuationTps = calculateTps(agentStat.getSampledContinuationCount(), interval);
|
||||
double unsampledNewTps = calculateTps(agentStat.getUnsampledNewCount(), interval);
|
||||
double unsampledContinuationTps = calculateTps(agentStat.getUnsampledContinuationCount(), interval);
|
||||
double totalTps = sampledNewTps + sampledContinuationTps + unsampledNewTps + unsampledContinuationTps;
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.TPS_SAMPLED_NEW)).addDataPoint(new DataPoint<>(timestamp, sampledNewTps));
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.TPS_SAMPLED_CONTINUATION)).addDataPoint(new DataPoint<>(timestamp, sampledContinuationTps));
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.TPS_UNSAMPLED_NEW)).addDataPoint(new DataPoint<>(timestamp, unsampledNewTps));
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.TPS_UNSAMPLED_CONTINUATION)).addDataPoint(new DataPoint<>(timestamp, unsampledContinuationTps));
|
||||
((SampledTimeSeriesDoubleChartBuilder) this.chartBuilders.get(ChartType.TPS_TOTAL)).addDataPoint(new DataPoint<>(timestamp, totalTps));
|
||||
}
|
||||
}
|
||||
|
||||
private void addActiveTraceData(AgentStat agentStat) {
|
||||
long timestamp = agentStat.getTimestamp();
|
||||
HistogramSchema schema = agentStat.getHistogramSchema();
|
||||
if (schema != null) {
|
||||
Map<SlotType, Integer> activeTraceCounts = agentStat.getActiveTraceCounts();
|
||||
|
||||
DataPoint<Long, Integer> fastDataPoint = new TitledDataPoint<>(schema.getFastSlot().getSlotName(), timestamp, activeTraceCounts.get(SlotType.FAST));
|
||||
((SampledTimeSeriesIntegerChartBuilder) this.chartBuilders.get(ChartType.ACTIVE_TRACE_FAST)).addDataPoint(fastDataPoint);
|
||||
|
||||
DataPoint<Long, Integer> normalDataPoint = new TitledDataPoint<>(schema.getNormalSlot().getSlotName(), timestamp, activeTraceCounts.get(SlotType.NORMAL));
|
||||
((SampledTimeSeriesIntegerChartBuilder) this.chartBuilders.get(ChartType.ACTIVE_TRACE_NORMAL)).addDataPoint(normalDataPoint);
|
||||
|
||||
DataPoint<Long, Integer> slowDataPoint = new TitledDataPoint<>(schema.getSlowSlot().getSlotName(), timestamp, activeTraceCounts.get(SlotType.SLOW));
|
||||
((SampledTimeSeriesIntegerChartBuilder) this.chartBuilders.get(ChartType.ACTIVE_TRACE_SLOW)).addDataPoint(slowDataPoint);
|
||||
|
||||
DataPoint<Long, Integer> verySlowDataPoint = new TitledDataPoint<>(schema.getVerySlowSlot().getSlotName(), timestamp, activeTraceCounts.get(SlotType.VERY_SLOW));
|
||||
((SampledTimeSeriesIntegerChartBuilder) this.chartBuilders.get(ChartType.ACTIVE_TRACE_VERY_SLOW)).addDataPoint(verySlowDataPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private double calculateTps(long count, long intervalMs) {
|
||||
final int numDecimal = 1;
|
||||
if (count == UNCOLLECTED_DATA) {
|
||||
return UNCOLLECTED_DATA;
|
||||
}
|
||||
return new BigDecimal(count / (intervalMs / 1000D)).setScale(numDecimal, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Map<ChartType, Chart> getCharts() {
|
||||
return charts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class JvmGc {
|
||||
|
||||
private final String agentId;
|
||||
private final long timestamp;
|
||||
|
||||
private long heapUsed;
|
||||
private long heapMax;
|
||||
private long nonHeapUsed;
|
||||
private long nonHeapMax;
|
||||
private long gcOldCount;
|
||||
private long gcOldTime;
|
||||
|
||||
public JvmGc(String agentId, long timestamp) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
}
|
||||
this.agentId = agentId;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getAgentId() {
|
||||
return agentId;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public long getHeapUsed() {
|
||||
return heapUsed;
|
||||
}
|
||||
|
||||
public void setHeapUsed(long heapUsed) {
|
||||
this.heapUsed = heapUsed;
|
||||
}
|
||||
|
||||
public long getHeapMax() {
|
||||
return heapMax;
|
||||
}
|
||||
|
||||
public void setHeapMax(long heapMax) {
|
||||
this.heapMax = heapMax;
|
||||
}
|
||||
|
||||
public long getNonHeapUsed() {
|
||||
return nonHeapUsed;
|
||||
}
|
||||
|
||||
public void setNonHeapUsed(long nonHeapUsed) {
|
||||
this.nonHeapUsed = nonHeapUsed;
|
||||
}
|
||||
|
||||
public long getNonHeapMax() {
|
||||
return nonHeapMax;
|
||||
}
|
||||
|
||||
public void setNonHeapMax(long nonHeapMax) {
|
||||
this.nonHeapMax = nonHeapMax;
|
||||
}
|
||||
|
||||
public long getGcOldCount() {
|
||||
return gcOldCount;
|
||||
}
|
||||
|
||||
public void setGcOldCount(long gcOldCount) {
|
||||
this.gcOldCount = gcOldCount;
|
||||
}
|
||||
|
||||
public long getGcOldTime() {
|
||||
return gcOldTime;
|
||||
}
|
||||
|
||||
public void setGcOldTime(long gcOldTime) {
|
||||
this.gcOldTime = gcOldTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
JvmGc jvmGc = (JvmGc) o;
|
||||
|
||||
if (timestamp != jvmGc.timestamp) return false;
|
||||
return agentId.equals(jvmGc.agentId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = agentId.hashCode();
|
||||
result = 31 * result + (int) (timestamp ^ (timestamp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JvmGc{" +
|
||||
"agentId='" + agentId + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", heapUsed=" + heapUsed +
|
||||
", heapMax=" + heapMax +
|
||||
", nonHeapUsed=" + nonHeapUsed +
|
||||
", nonHeapMax=" + nonHeapMax +
|
||||
", gcOldCount=" + gcOldCount +
|
||||
", gcOldTime=" + gcOldTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.chart.TitledPoint;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledActiveTrace implements SampledAgentStatDataPoint {
|
||||
|
||||
private TitledPoint<Long, Integer> fastCounts;
|
||||
private TitledPoint<Long, Integer> normalCounts;
|
||||
private TitledPoint<Long, Integer> slowCounts;
|
||||
private TitledPoint<Long, Integer> verySlowCounts;
|
||||
|
||||
public TitledPoint<Long, Integer> getFastCounts() {
|
||||
return fastCounts;
|
||||
}
|
||||
|
||||
public void setFastCounts(TitledPoint<Long, Integer> fastCounts) {
|
||||
this.fastCounts = fastCounts;
|
||||
}
|
||||
|
||||
public TitledPoint<Long, Integer> getNormalCounts() {
|
||||
return normalCounts;
|
||||
}
|
||||
|
||||
public void setNormalCounts(TitledPoint<Long, Integer> normalCounts) {
|
||||
this.normalCounts = normalCounts;
|
||||
}
|
||||
|
||||
public TitledPoint<Long, Integer> getSlowCounts() {
|
||||
return slowCounts;
|
||||
}
|
||||
|
||||
public void setSlowCounts(TitledPoint<Long, Integer> slowCounts) {
|
||||
this.slowCounts = slowCounts;
|
||||
}
|
||||
|
||||
public TitledPoint<Long, Integer> getVerySlowCounts() {
|
||||
return verySlowCounts;
|
||||
}
|
||||
|
||||
public void setVerySlowCounts(TitledPoint<Long, Integer> verySlowCounts) {
|
||||
this.verySlowCounts = verySlowCounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SampledActiveTrace that = (SampledActiveTrace) o;
|
||||
|
||||
if (fastCounts != null ? !fastCounts.equals(that.fastCounts) : that.fastCounts != null) return false;
|
||||
if (normalCounts != null ? !normalCounts.equals(that.normalCounts) : that.normalCounts != null) return false;
|
||||
if (slowCounts != null ? !slowCounts.equals(that.slowCounts) : that.slowCounts != null) return false;
|
||||
return verySlowCounts != null ? verySlowCounts.equals(that.verySlowCounts) : that.verySlowCounts == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = fastCounts != null ? fastCounts.hashCode() : 0;
|
||||
result = 31 * result + (normalCounts != null ? normalCounts.hashCode() : 0);
|
||||
result = 31 * result + (slowCounts != null ? slowCounts.hashCode() : 0);
|
||||
result = 31 * result + (verySlowCounts != null ? verySlowCounts.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SampledActiveTrace{" +
|
||||
"fastCounts=" + fastCounts +
|
||||
", normalCounts=" + normalCounts +
|
||||
", slowCounts=" + slowCounts +
|
||||
", verySlowCounts=" + verySlowCounts +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public interface SampledAgentStatDataPoint {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledCpuLoad implements SampledAgentStatDataPoint {
|
||||
|
||||
private Point<Long, Double> jvmCpuLoad;
|
||||
private Point<Long, Double> systemCpuLoad;
|
||||
|
||||
public Point<Long, Double> getJvmCpuLoad() {
|
||||
return jvmCpuLoad;
|
||||
}
|
||||
|
||||
public void setJvmCpuLoad(Point<Long, Double> jvmCpuLoad) {
|
||||
this.jvmCpuLoad = jvmCpuLoad;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getSystemCpuLoad() {
|
||||
return systemCpuLoad;
|
||||
}
|
||||
|
||||
public void setSystemCpuLoad(Point<Long, Double> systemCpuLoad) {
|
||||
this.systemCpuLoad = systemCpuLoad;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SampledCpuLoad that = (SampledCpuLoad) o;
|
||||
|
||||
if (jvmCpuLoad != null ? !jvmCpuLoad.equals(that.jvmCpuLoad) : that.jvmCpuLoad != null) return false;
|
||||
return systemCpuLoad != null ? systemCpuLoad.equals(that.systemCpuLoad) : that.systemCpuLoad == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = jvmCpuLoad != null ? jvmCpuLoad.hashCode() : 0;
|
||||
result = 31 * result + (systemCpuLoad != null ? systemCpuLoad.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SampledCpuLoad{" +
|
||||
"jvmCpuLoad=" + jvmCpuLoad +
|
||||
", systemCpuLoad=" + systemCpuLoad +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledJvmGc implements SampledAgentStatDataPoint {
|
||||
|
||||
private Point<Long, Long> heapUsed;
|
||||
private Point<Long, Long> heapMax;
|
||||
private Point<Long, Long> nonHeapUsed;
|
||||
private Point<Long, Long> nonHeapMax;
|
||||
private Point<Long, Long> gcOldCount;
|
||||
private Point<Long, Long> gcOldTime;
|
||||
|
||||
public Point<Long, Long> getHeapUsed() {
|
||||
return heapUsed;
|
||||
}
|
||||
|
||||
public void setHeapUsed(Point<Long, Long> heapUsed) {
|
||||
this.heapUsed = heapUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getHeapMax() {
|
||||
return heapMax;
|
||||
}
|
||||
|
||||
public void setHeapMax(Point<Long, Long> heapMax) {
|
||||
this.heapMax = heapMax;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getNonHeapUsed() {
|
||||
return nonHeapUsed;
|
||||
}
|
||||
|
||||
public void setNonHeapUsed(Point<Long, Long> nonHeapUsed) {
|
||||
this.nonHeapUsed = nonHeapUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getNonHeapMax() {
|
||||
return nonHeapMax;
|
||||
}
|
||||
|
||||
public void setNonHeapMax(Point<Long, Long> nonHeapMax) {
|
||||
this.nonHeapMax = nonHeapMax;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getGcOldCount() {
|
||||
return gcOldCount;
|
||||
}
|
||||
|
||||
public void setGcOldCount(Point<Long, Long> gcOldCount) {
|
||||
this.gcOldCount = gcOldCount;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getGcOldTime() {
|
||||
return gcOldTime;
|
||||
}
|
||||
|
||||
public void setGcOldTime(Point<Long, Long> gcOldTime) {
|
||||
this.gcOldTime = gcOldTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SampledJvmGc that = (SampledJvmGc) o;
|
||||
|
||||
if (heapUsed != null ? !heapUsed.equals(that.heapUsed) : that.heapUsed != null) return false;
|
||||
if (heapMax != null ? !heapMax.equals(that.heapMax) : that.heapMax != null) return false;
|
||||
if (nonHeapUsed != null ? !nonHeapUsed.equals(that.nonHeapUsed) : that.nonHeapUsed != null) return false;
|
||||
if (nonHeapMax != null ? !nonHeapMax.equals(that.nonHeapMax) : that.nonHeapMax != null) return false;
|
||||
if (gcOldCount != null ? !gcOldCount.equals(that.gcOldCount) : that.gcOldCount != null) return false;
|
||||
return gcOldTime != null ? gcOldTime.equals(that.gcOldTime) : that.gcOldTime == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = heapUsed != null ? heapUsed.hashCode() : 0;
|
||||
result = 31 * result + (heapMax != null ? heapMax.hashCode() : 0);
|
||||
result = 31 * result + (nonHeapUsed != null ? nonHeapUsed.hashCode() : 0);
|
||||
result = 31 * result + (nonHeapMax != null ? nonHeapMax.hashCode() : 0);
|
||||
result = 31 * result + (gcOldCount != null ? gcOldCount.hashCode() : 0);
|
||||
result = 31 * result + (gcOldTime != null ? gcOldTime.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SampledJvmGc{" +
|
||||
"heapUsed=" + heapUsed +
|
||||
", heapMax=" + heapMax +
|
||||
", nonHeapUsed=" + nonHeapUsed +
|
||||
", nonHeapMax=" + nonHeapMax +
|
||||
", gcOldCount=" + gcOldCount +
|
||||
", gcOldTime=" + gcOldTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2016 Naver Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.navercorp.pinpoint.web.vo.stat;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.chart.Point;
|
||||
|
||||
/**
|
||||
* @author HyunGil Jeong
|
||||
*/
|
||||
public class SampledJvmGcDetailed implements SampledAgentStatDataPoint {
|
||||
|
||||
private Point<Long, Long> gcNewCount;
|
||||
private Point<Long, Long> gcNewTime;
|
||||
private Point<Long, Double> codeCacheUsed;
|
||||
private Point<Long, Double> newGenUsed;
|
||||
private Point<Long, Double> oldGenUsed;
|
||||
private Point<Long, Double> survivorSpaceUsed;
|
||||
private Point<Long, Double> permGenUsed;
|
||||
private Point<Long, Double> metaspaceUsed;
|
||||
|
||||
public Point<Long, Long> getGcNewCount() {
|
||||
return gcNewCount;
|
||||
}
|
||||
|
||||
public void setGcNewCount(Point<Long, Long> gcNewCount) {
|
||||
this.gcNewCount = gcNewCount;
|
||||
}
|
||||
|
||||
public Point<Long, Long> getGcNewTime() {
|
||||
return gcNewTime;
|
||||
}
|
||||
|
||||
public void setGcNewTime(Point<Long, Long> gcNewTime) {
|
||||
this.gcNewTime = gcNewTime;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getCodeCacheUsed() {
|
||||
return codeCacheUsed;
|
||||
}
|
||||
|
||||
public void setCodeCacheUsed(Point<Long, Double> codeCacheUsed) {
|
||||
this.codeCacheUsed = codeCacheUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getNewGenUsed() {
|
||||
return newGenUsed;
|
||||
}
|
||||
|
||||
public void setNewGenUsed(Point<Long, Double> newGenUsed) {
|
||||
this.newGenUsed = newGenUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getOldGenUsed() {
|
||||
return oldGenUsed;
|
||||
}
|
||||
|
||||
public void setOldGenUsed(Point<Long, Double> oldGenUsed) {
|
||||
this.oldGenUsed = oldGenUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getSurvivorSpaceUsed() {
|
||||
return survivorSpaceUsed;
|
||||
}
|
||||
|
||||
public void setSurvivorSpaceUsed(Point<Long, Double> survivorSpaceUsed) {
|
||||
this.survivorSpaceUsed = survivorSpaceUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getPermGenUsed() {
|
||||
return permGenUsed;
|
||||
}
|
||||
|
||||
public void setPermGenUsed(Point<Long, Double> permGenUsed) {
|
||||
this.permGenUsed = permGenUsed;
|
||||
}
|
||||
|
||||
public Point<Long, Double> getMetaspaceUsed() {
|
||||
return metaspaceUsed;
|
||||
}
|
||||
|
||||
public void setMetaspaceUsed(Point<Long, Double> metaspaceUsed) {
|
||||
this.metaspaceUsed = metaspaceUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SampledJvmGcDetailed that = (SampledJvmGcDetailed) o;
|
||||
|
||||
if (gcNewCount != null ? !gcNewCount.equals(that.gcNewCount) : that.gcNewCount != null) return false;
|
||||
if (gcNewTime != null ? !gcNewTime.equals(that.gcNewTime) : that.gcNewTime != null) return false;
|
||||
if (codeCacheUsed != null ? !codeCacheUsed.equals(that.codeCacheUsed) : that.codeCacheUsed != null)
|
||||
return false;
|
||||
if (newGenUsed != null ? !newGenUsed.equals(that.newGenUsed) : that.newGenUsed != null) return false;
|
||||
if (oldGenUsed != null ? !oldGenUsed.equals(that.oldGenUsed) : that.oldGenUsed != null) return false;
|
||||
if (survivorSpaceUsed != null ? !survivorSpaceUsed.equals(that.survivorSpaceUsed) : that.survivorSpaceUsed != null)
|
||||
return false;
|
||||
if (permGenUsed != null ? !permGenUsed.equals(that.permGenUsed) : that.permGenUsed != null) return false;
|
||||
return metaspaceUsed != null ? metaspaceUsed.equals(that.metaspaceUsed) : that.metaspaceUsed == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = gcNewCount != null ? gcNewCount.hashCode() : 0;
|
||||
result = 31 * result + (gcNewTime != null ? gcNewTime.hashCode() : 0);
|
||||
result = 31 * result + (codeCacheUsed != null ? codeCacheUsed.hashCode() : 0);
|
||||
result = 31 * result + (newGenUsed != null ? newGenUsed.hashCode() : 0);
|
||||
result = 31 * result + (oldGenUsed != null ? oldGenUsed.hashCode() : 0);
|
||||
result = 31 * result + (survivorSpaceUsed != null ? survivorSpaceUsed.hashCode() : 0);
|
||||
result = 31 * result + (permGenUsed != null ? permGenUsed.hashCode() : 0);
|
||||
result = 31 * result + (metaspaceUsed != null ? metaspaceUsed.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SampledJvmGcDetailed{" +
|
||||
"gcNewCount=" + gcNewCount +
|
||||
", gcNewTime=" + gcNewTime +
|
||||
", codeCacheUsed=" + codeCacheUsed +
|
||||
", newGenUsed=" + newGenUsed +
|
||||
", oldGenUsed=" + oldGenUsed +
|
||||
", survivorSpaceUsed=" + survivorSpaceUsed +
|
||||
", permGenUsed=" + permGenUsed +
|
||||
", metaspaceUsed=" + metaspaceUsed +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user