통계 화면 추가
This commit is contained in:
@@ -68,6 +68,8 @@
|
||||
<context:component-scan base-package="com.eactive.eai.inbound.error.loader" />
|
||||
<context:component-scan base-package="com.eactive.apim.portal" />
|
||||
|
||||
<context:component-scan base-package="com.eactive.ext.kjb.statistics" />
|
||||
|
||||
|
||||
<bean id="cacheManager"
|
||||
class="org.springframework.cache.ehcache.EhCacheCacheManager">
|
||||
|
||||
@@ -150,4 +150,6 @@
|
||||
<aop:aspectj-autoproxy />
|
||||
|
||||
<bean class="com.eactive.ext.kjb.web.ApiTransactionLogController"></bean>
|
||||
<bean class="com.eactive.ext.kjb.statistics.ApiStatsMinuteController"></bean>
|
||||
<bean class="com.eactive.ext.kjb.statistics.ApiStatsHourController"></bean>
|
||||
</beans>
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
||||
<%@ page import="java.io.*"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
||||
<%
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<title>API 시간별 통계</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<jsp:include page="/jsp/common/include/css.jsp"/>
|
||||
<style>
|
||||
.chart-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.chart {
|
||||
width: 49%;
|
||||
height: 300px;
|
||||
border: 1px solid #ddd;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||
<script src="<c:url value="/addon/echarts/echarts.min.js"/>"></script>
|
||||
<script language="javascript">
|
||||
var url = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.json"/>';
|
||||
var url_view = '<c:url value="/onl/kjb/statistics/apiStatsHourMan.view"/>';
|
||||
var url_minute_view = '<c:url value="/onl/kjb/statistics/apiStatsMinuteMan.view"/>';
|
||||
|
||||
var callChart, respChart;
|
||||
|
||||
function numberFormatter(cellvalue, options, rowObject) {
|
||||
if (cellvalue == null || cellvalue == '') return '0';
|
||||
return Number(cellvalue).toLocaleString();
|
||||
}
|
||||
|
||||
function decimalFormatter(cellvalue, options, rowObject) {
|
||||
if (cellvalue == null || cellvalue == '') return '0.000';
|
||||
return Number(cellvalue).toFixed(3);
|
||||
}
|
||||
|
||||
function initCharts() {
|
||||
callChart = echarts.init(document.getElementById('callChart'));
|
||||
respChart = echarts.init(document.getElementById('respChart'));
|
||||
|
||||
var callOption = {
|
||||
title: { text: '호출량 추이', left: 'center', textStyle: { fontSize: 14 } },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } }
|
||||
},
|
||||
legend: { data: ['성공', 'Timeout', '시스템오류', '업무오류'], bottom: 0 },
|
||||
grid: { left: '3%', right: '4%', bottom: '15%', top: '15%', containLabel: true },
|
||||
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||
yAxis: { type: 'value', minInterval: 1 },
|
||||
series: [
|
||||
{ name: '성공', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#5470C6' }, data: [] },
|
||||
{ name: 'Timeout', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#FAC858' }, data: [] },
|
||||
{ name: '시스템오류', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#EE6666' }, data: [] },
|
||||
{ name: '업무오류', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#FC8452' }, data: [] }
|
||||
]
|
||||
};
|
||||
|
||||
var respOption = {
|
||||
title: { text: '응답시간 추이 (ms)', left: 'center', textStyle: { fontSize: 14 } },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } }
|
||||
},
|
||||
legend: { data: ['P95', 'P50', '평균'], bottom: 0 },
|
||||
grid: { left: '3%', right: '4%', bottom: '15%', top: '15%', containLabel: true },
|
||||
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{ name: 'P95', type: 'line', itemStyle: { color: '#EE6666' }, lineStyle: { type: 'dashed' }, data: [] },
|
||||
{ name: 'P50', type: 'line', itemStyle: { color: '#5470C6' }, data: [] },
|
||||
{ name: '평균', type: 'line', itemStyle: { color: '#91CC75' }, data: [] }
|
||||
]
|
||||
};
|
||||
|
||||
callChart.setOption(callOption);
|
||||
respChart.setOption(respOption);
|
||||
|
||||
// 드릴다운 이벤트 (시간 클릭 시 분단위 화면으로 이동)
|
||||
callChart.on('click', function(params) {
|
||||
drillDownToMinute(callChart, params.dataIndex);
|
||||
});
|
||||
respChart.on('click', function(params) {
|
||||
drillDownToMinute(respChart, params.dataIndex);
|
||||
});
|
||||
}
|
||||
|
||||
function drillDownToMinute(chart, dataIndex) {
|
||||
if (!chart.rawData || dataIndex < 0 || dataIndex >= chart.rawData.length) return;
|
||||
|
||||
// rawData에서 실제 statTime 가져오기 (yyyyMMddHH00 형식)
|
||||
var statTime = chart.rawData[dataIndex].statTime;
|
||||
var date = statTime.substring(0, 4) + '-' + statTime.substring(4, 6) + '-' + statTime.substring(6, 8);
|
||||
var hour = statTime.substring(8, 10);
|
||||
var startTime = hour + ':00';
|
||||
var endTime = hour + ':59';
|
||||
|
||||
var params = '?searchStartDate=' + date + '&searchStartTime=' + startTime
|
||||
+ '&searchEndDate=' + date + '&searchEndTime=' + endTime;
|
||||
|
||||
location.href = url_minute_view + params;
|
||||
}
|
||||
|
||||
function updateCharts(data) {
|
||||
var times = [];
|
||||
var successData = [];
|
||||
var timeoutData = [];
|
||||
var systemErrData = [];
|
||||
var bizErrData = [];
|
||||
var avgRespData = [];
|
||||
var p50RespData = [];
|
||||
var p95RespData = [];
|
||||
|
||||
data.forEach(function(item) {
|
||||
// statTime: yyyyMMddHH00 -> HH시 형식으로 표시
|
||||
var hour = item.statTime.substring(8, 10);
|
||||
times.push(item.statTime);
|
||||
successData.push(item.successCnt);
|
||||
timeoutData.push(item.timeoutCnt);
|
||||
systemErrData.push(item.systemErrCnt);
|
||||
bizErrData.push(item.bizErrCnt);
|
||||
avgRespData.push(item.avgRespTime);
|
||||
p50RespData.push(item.p50RespTime);
|
||||
p95RespData.push(item.p95RespTime);
|
||||
});
|
||||
|
||||
callChart.setOption({
|
||||
xAxis: { data: times.map(function(t) { return t.substring(8, 10) + '시'; }) },
|
||||
series: [
|
||||
{ data: successData },
|
||||
{ data: timeoutData },
|
||||
{ data: systemErrData },
|
||||
{ data: bizErrData }
|
||||
]
|
||||
});
|
||||
|
||||
respChart.setOption({
|
||||
xAxis: { data: times.map(function(t) { return t.substring(8, 10) + '시'; }) },
|
||||
series: [
|
||||
{ data: p95RespData },
|
||||
{ data: p50RespData },
|
||||
{ data: avgRespData }
|
||||
]
|
||||
});
|
||||
|
||||
// 드릴다운을 위해 원본 데이터 저장
|
||||
callChart.rawData = data;
|
||||
respChart.rawData = data;
|
||||
}
|
||||
|
||||
function fetchChartData() {
|
||||
var searchDate = $("input[name=searchDate]").val().replace(/-/g, "");
|
||||
|
||||
var postData = {
|
||||
cmd: 'CHART',
|
||||
searchApiName: $("input[name=searchApiName]").val(),
|
||||
searchGwInstanceId: $("input[name=searchGwInstanceId]").val(),
|
||||
searchBizDivCode: $("input[name=searchBizDivCode]").val(),
|
||||
searchClientId: $("input[name=searchClientId]").val(),
|
||||
searchInboundAdapter: $("input[name=searchInboundAdapter]").val(),
|
||||
searchOutboundAdapter: $("input[name=searchOutboundAdapter]").val()
|
||||
};
|
||||
|
||||
if (searchDate) {
|
||||
postData.searchStartDateTime = searchDate + "00";
|
||||
postData.searchEndDateTime = searchDate + "23";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
success: function(response) {
|
||||
updateCharts(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Chart data fetch error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function search() {
|
||||
var postData = getSearchForJqgrid("cmd", "LIST");
|
||||
|
||||
var searchDate = $("input[name=searchDate]").val().replace(/-/g, "");
|
||||
|
||||
if (searchDate) {
|
||||
postData.searchStartDateTime = searchDate + "00";
|
||||
postData.searchEndDateTime = searchDate + "23";
|
||||
}
|
||||
|
||||
$("#grid").setGridParam({ url: url, postData: postData, page: 1 }).trigger("reloadGrid");
|
||||
fetchChartData();
|
||||
}
|
||||
|
||||
function list() {
|
||||
var gridPostData = getSearchForJqgrid("cmd", "LIST");
|
||||
$('#grid').jqGrid({
|
||||
datatype: "json",
|
||||
mtype: 'POST',
|
||||
postData: gridPostData,
|
||||
colNames: [
|
||||
'통계시간', 'API명', '인스턴스', '업무구분', '클라이언트ID',
|
||||
'Inbound Adapter', 'Outbound Adapter',
|
||||
'총건수', '성공', 'Timeout', '시스템오류', '업무오류',
|
||||
'평균응답(ms)', '최소응답(ms)', '최대응답(ms)', 'P50(ms)', 'P95(ms)'
|
||||
],
|
||||
colModel: [
|
||||
{ name: 'statTime', align: 'center', width: '120', sortable: false },
|
||||
{ name: 'apiName', align: 'left', width: '150', sortable: false },
|
||||
{ name: 'gwInstanceId', align: 'center', width: '80', sortable: false },
|
||||
{ name: 'bizDivCode', align: 'center', width: '80', sortable: false },
|
||||
{ name: 'clientId', align: 'left', width: '100', sortable: false },
|
||||
{ name: 'inboundAdapter', align: 'left', width: '120', sortable: false },
|
||||
{ name: 'outboundAdapter', align: 'left', width: '120', sortable: false },
|
||||
{ name: 'totalCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'successCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'timeoutCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'systemErrCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'bizErrCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'avgRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'minRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'maxRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'p50RespTime', align: 'right', width: '70', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'p95RespTime', align: 'right', width: '70', formatter: decimalFormatter, sortable: false }
|
||||
],
|
||||
jsonReader: { repeatitems: false },
|
||||
pager: $('#pager'),
|
||||
page: '${param.page}',
|
||||
rowNum: '${rmsDefaultRowNum}',
|
||||
autoheight: true,
|
||||
height: $("#container").height(),
|
||||
autowidth: true,
|
||||
viewrecords: true,
|
||||
rowList: eval('[${rmsDefaultRowList}]'),
|
||||
loadComplete: function(d) {
|
||||
var colModel = $(this).getGridParam("colModel");
|
||||
for (var i = 0; i < colModel.length; i++) {
|
||||
$(this).setColProp(colModel[i].name, { sortable: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// 날짜 입력 마스크
|
||||
$("input[name=searchDate]").inputmask("9999-99-99", { 'autoUnmask': true });
|
||||
|
||||
// 기본값 설정 (오늘)
|
||||
var today = getToday();
|
||||
if (!$("input[name=searchDate]").val()) {
|
||||
$("input[name=searchDate]").val(today);
|
||||
}
|
||||
|
||||
initCharts();
|
||||
list();
|
||||
search();
|
||||
fetchChartData();
|
||||
resizeJqGridWidth('grid', 'content_middle', '1200');
|
||||
|
||||
$("#btn_search").click(function() {
|
||||
search();
|
||||
});
|
||||
|
||||
$("input[name^=search]").keydown(function(key) {
|
||||
if (key.keyCode == 13) {
|
||||
$("#btn_search").click();
|
||||
}
|
||||
});
|
||||
|
||||
// 윈도우 리사이즈 시 차트 리사이즈
|
||||
$(window).resize(function() {
|
||||
if (callChart) callChart.resize();
|
||||
if (respChart) respChart.resize();
|
||||
});
|
||||
|
||||
buttonControl();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="right_box">
|
||||
<div class="content_top">
|
||||
<ul class="path">
|
||||
<li><a href="#">${rmsMenuPath}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content_middle" id="content_middle">
|
||||
<div class="search_wrap">
|
||||
<button type="button" class="cssbtn" id="btn_search" level="R">
|
||||
<i class="material-icons">search</i> <%= localeMessage.getString("button.search") %>
|
||||
</button>
|
||||
</div>
|
||||
<div class="title" id="title">API 시간별 통계</div>
|
||||
<table class="search_condition" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width:100px;">조회일자</th>
|
||||
<td colspan="3">
|
||||
<input type="text" name="searchDate" value="${param.searchDate}" style="width:100px;">
|
||||
<span style="color:#888; font-size:12px; margin-left:10px;">(선택일 00시 ~ 23시 조회)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">API명</th>
|
||||
<td>
|
||||
<input type="text" name="searchApiName" value="${param.searchApiName}">
|
||||
</td>
|
||||
<th style="width:100px;">인스턴스</th>
|
||||
<td>
|
||||
<input type="text" name="searchGwInstanceId" value="${param.searchGwInstanceId}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">업무구분</th>
|
||||
<td>
|
||||
<input type="text" name="searchBizDivCode" value="${param.searchBizDivCode}">
|
||||
</td>
|
||||
<th style="width:100px;">클라이언트ID</th>
|
||||
<td>
|
||||
<input type="text" name="searchClientId" value="${param.searchClientId}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">Inbound Adapter</th>
|
||||
<td>
|
||||
<input type="text" name="searchInboundAdapter" value="${param.searchInboundAdapter}">
|
||||
</td>
|
||||
<th style="width:100px;">Outbound Adapter</th>
|
||||
<td>
|
||||
<input type="text" name="searchOutboundAdapter" value="${param.searchOutboundAdapter}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="chart-container">
|
||||
<div id="callChart" class="chart"></div>
|
||||
<div id="respChart" class="chart"></div>
|
||||
</div>
|
||||
<table id="grid"></table>
|
||||
<div id="pager"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,421 @@
|
||||
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
||||
<%@ page import="java.io.*"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
||||
<%
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<title>API 분단위 통계</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<jsp:include page="/jsp/common/include/css.jsp"/>
|
||||
<style>
|
||||
.chart-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.chart {
|
||||
width: 49%;
|
||||
height: 300px;
|
||||
border: 1px solid #ddd;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||
<script src="<c:url value="/addon/echarts/echarts.min.js"/>"></script>
|
||||
<script language="javascript">
|
||||
var url = '<c:url value="/onl/kjb/statistics/apiStatsMinuteMan.json"/>';
|
||||
var url_view = '<c:url value="/onl/kjb/statistics/apiStatsMinuteMan.view"/>';
|
||||
|
||||
var callChart, respChart;
|
||||
|
||||
function numberFormatter(cellvalue, options, rowObject) {
|
||||
if (cellvalue == null || cellvalue == '') return '0';
|
||||
return Number(cellvalue).toLocaleString();
|
||||
}
|
||||
|
||||
function decimalFormatter(cellvalue, options, rowObject) {
|
||||
if (cellvalue == null || cellvalue == '') return '0.000';
|
||||
return Number(cellvalue).toFixed(3);
|
||||
}
|
||||
|
||||
function initCharts() {
|
||||
callChart = echarts.init(document.getElementById('callChart'));
|
||||
respChart = echarts.init(document.getElementById('respChart'));
|
||||
|
||||
var callOption = {
|
||||
title: { text: '호출량 추이', left: 'center', textStyle: { fontSize: 14 } },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } }
|
||||
},
|
||||
legend: { data: ['성공', 'Timeout', '시스템오류', '업무오류'], bottom: 0 },
|
||||
grid: { left: '3%', right: '4%', bottom: '15%', top: '15%', containLabel: true },
|
||||
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||
yAxis: { type: 'value', minInterval: 1 },
|
||||
dataZoom: [
|
||||
{ type: 'inside', start: 0, end: 100 },
|
||||
{ start: 0, end: 100 }
|
||||
],
|
||||
series: [
|
||||
{ name: '성공', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#5470C6' }, data: [], showSymbol: false },
|
||||
{ name: 'Timeout', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#FAC858' }, data: [], showSymbol: false },
|
||||
{ name: '시스템오류', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#EE6666' }, data: [], showSymbol: false },
|
||||
{ name: '업무오류', type: 'line', stack: 'Total', areaStyle: { opacity: 0.5 }, itemStyle: { color: '#FC8452' }, data: [], showSymbol: false }
|
||||
]
|
||||
};
|
||||
|
||||
var respOption = {
|
||||
title: { text: '응답시간 추이 (ms)', left: 'center', textStyle: { fontSize: 14 } },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } }
|
||||
},
|
||||
legend: { data: ['P95', 'P50', '평균'], bottom: 0 },
|
||||
grid: { left: '3%', right: '4%', bottom: '15%', top: '15%', containLabel: true },
|
||||
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||
yAxis: { type: 'value' },
|
||||
dataZoom: [
|
||||
{ type: 'inside', start: 0, end: 100 },
|
||||
{ start: 0, end: 100 }
|
||||
],
|
||||
series: [
|
||||
{ name: 'P95', type: 'line', itemStyle: { color: '#EE6666' }, lineStyle: { type: 'dashed' }, data: [], showSymbol: false },
|
||||
{ name: 'P50', type: 'line', itemStyle: { color: '#5470C6' }, data: [], showSymbol: false },
|
||||
{ name: '평균', type: 'line', itemStyle: { color: '#91CC75' }, data: [], showSymbol: false }
|
||||
]
|
||||
};
|
||||
|
||||
callChart.setOption(callOption);
|
||||
respChart.setOption(respOption);
|
||||
}
|
||||
|
||||
function updateCharts(data) {
|
||||
var times = [];
|
||||
var successData = [];
|
||||
var timeoutData = [];
|
||||
var systemErrData = [];
|
||||
var bizErrData = [];
|
||||
var avgRespData = [];
|
||||
var p50RespData = [];
|
||||
var p95RespData = [];
|
||||
|
||||
data.forEach(function(item) {
|
||||
// statTime: yyyyMMddHHmm -> HH:mm 형식으로 표시
|
||||
var time = item.statTime.substring(8, 10) + ':' + item.statTime.substring(10, 12);
|
||||
times.push(time);
|
||||
successData.push(item.successCnt);
|
||||
timeoutData.push(item.timeoutCnt);
|
||||
systemErrData.push(item.systemErrCnt);
|
||||
bizErrData.push(item.bizErrCnt);
|
||||
avgRespData.push(item.avgRespTime);
|
||||
p50RespData.push(item.p50RespTime);
|
||||
p95RespData.push(item.p95RespTime);
|
||||
});
|
||||
|
||||
callChart.setOption({
|
||||
xAxis: { data: times },
|
||||
series: [
|
||||
{ data: successData },
|
||||
{ data: timeoutData },
|
||||
{ data: systemErrData },
|
||||
{ data: bizErrData }
|
||||
]
|
||||
});
|
||||
|
||||
respChart.setOption({
|
||||
xAxis: { data: times },
|
||||
series: [
|
||||
{ data: p95RespData },
|
||||
{ data: p50RespData },
|
||||
{ data: avgRespData }
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
// 조회 기간 검증 및 조정 (최대 1시간)
|
||||
function validateAndAdjustDateRange() {
|
||||
var startDate = $("input[name=searchStartDate]").val().replace(/-/g, "");
|
||||
var startTime = $("input[name=searchStartTime]").val().replace(/:/g, "");
|
||||
var endDate = $("input[name=searchEndDate]").val().replace(/-/g, "");
|
||||
var endTime = $("input[name=searchEndTime]").val().replace(/:/g, "");
|
||||
|
||||
if (!startDate || !startTime) return null;
|
||||
|
||||
// Date 객체 생성 헬퍼
|
||||
function parseDateTime(date, time) {
|
||||
return new Date(
|
||||
parseInt(date.substring(0, 4)),
|
||||
parseInt(date.substring(4, 6)) - 1,
|
||||
parseInt(date.substring(6, 8)),
|
||||
parseInt(time.substring(0, 2)),
|
||||
parseInt(time.substring(2, 4))
|
||||
);
|
||||
}
|
||||
|
||||
// UI 업데이트 헬퍼
|
||||
function updateEndDateTime(dt) {
|
||||
var d = dt.getFullYear() +
|
||||
String(dt.getMonth() + 1).padStart(2, '0') +
|
||||
String(dt.getDate()).padStart(2, '0');
|
||||
var t = String(dt.getHours()).padStart(2, '0') +
|
||||
String(dt.getMinutes()).padStart(2, '0');
|
||||
$("input[name=searchEndDate]").val(d.substring(0, 4) + '-' + d.substring(4, 6) + '-' + d.substring(6, 8));
|
||||
$("input[name=searchEndTime]").val(t.substring(0, 2) + ':' + t.substring(2, 4));
|
||||
return d + t;
|
||||
}
|
||||
|
||||
var start = parseDateTime(startDate, startTime);
|
||||
var startDateTime = startDate + startTime;
|
||||
var endDateTime;
|
||||
|
||||
if (endDate && endTime) {
|
||||
var end = parseDateTime(endDate, endTime);
|
||||
var diffMinutes = (end - start) / (1000 * 60);
|
||||
|
||||
if (diffMinutes > 60) {
|
||||
// 1시간 초과 시 시작 + 1시간으로 조정
|
||||
endDateTime = updateEndDateTime(new Date(start.getTime() + 60 * 60 * 1000));
|
||||
} else {
|
||||
endDateTime = endDate + endTime;
|
||||
}
|
||||
} else {
|
||||
// 종료시간 미입력 시 시작 + 1시간으로 설정
|
||||
endDateTime = updateEndDateTime(new Date(start.getTime() + 60 * 60 * 1000));
|
||||
}
|
||||
|
||||
return { start: startDateTime, end: endDateTime };
|
||||
}
|
||||
|
||||
function fetchChartData(range) {
|
||||
var postData = {
|
||||
cmd: 'CHART',
|
||||
searchApiName: $("input[name=searchApiName]").val(),
|
||||
searchGwInstanceId: $("input[name=searchGwInstanceId]").val(),
|
||||
searchBizDivCode: $("input[name=searchBizDivCode]").val(),
|
||||
searchClientId: $("input[name=searchClientId]").val(),
|
||||
searchInboundAdapter: $("input[name=searchInboundAdapter]").val(),
|
||||
searchOutboundAdapter: $("input[name=searchOutboundAdapter]").val()
|
||||
};
|
||||
|
||||
if (range) {
|
||||
postData.searchStartDateTime = range.start;
|
||||
postData.searchEndDateTime = range.end;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: postData,
|
||||
success: function(response) {
|
||||
updateCharts(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Chart data fetch error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function search() {
|
||||
var range = validateAndAdjustDateRange();
|
||||
|
||||
var postData = getSearchForJqgrid("cmd", "LIST");
|
||||
if (range) {
|
||||
postData.searchStartDateTime = range.start;
|
||||
postData.searchEndDateTime = range.end;
|
||||
}
|
||||
|
||||
$("#grid").setGridParam({ url: url, postData: postData, page: 1 }).trigger("reloadGrid");
|
||||
fetchChartData(range);
|
||||
}
|
||||
|
||||
function list() {
|
||||
var gridPostData = getSearchForJqgrid("cmd", "LIST");
|
||||
$('#grid').jqGrid({
|
||||
datatype: "json",
|
||||
mtype: 'POST',
|
||||
postData: gridPostData,
|
||||
colNames: [
|
||||
'통계시간', 'API명', '인스턴스', '업무구분', '클라이언트ID',
|
||||
'Inbound Adapter', 'Outbound Adapter',
|
||||
'총건수', '성공', 'Timeout', '시스템오류', '업무오류',
|
||||
'평균응답(ms)', '최소응답(ms)', '최대응답(ms)', 'P50(ms)', 'P95(ms)'
|
||||
],
|
||||
colModel: [
|
||||
{ name: 'statTime', align: 'center', width: '120', sortable: false },
|
||||
{ name: 'apiName', align: 'left', width: '150', sortable: false },
|
||||
{ name: 'gwInstanceId', align: 'center', width: '80', sortable: false },
|
||||
{ name: 'bizDivCode', align: 'center', width: '80', sortable: false },
|
||||
{ name: 'clientId', align: 'left', width: '100', sortable: false },
|
||||
{ name: 'inboundAdapter', align: 'left', width: '120', sortable: false },
|
||||
{ name: 'outboundAdapter', align: 'left', width: '120', sortable: false },
|
||||
{ name: 'totalCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'successCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'timeoutCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'systemErrCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'bizErrCnt', align: 'right', width: '70', formatter: numberFormatter, sortable: false },
|
||||
{ name: 'avgRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'minRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'maxRespTime', align: 'right', width: '80', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'p50RespTime', align: 'right', width: '70', formatter: decimalFormatter, sortable: false },
|
||||
{ name: 'p95RespTime', align: 'right', width: '70', formatter: decimalFormatter, sortable: false }
|
||||
],
|
||||
jsonReader: { repeatitems: false },
|
||||
pager: $('#pager'),
|
||||
page: '${param.page}',
|
||||
rowNum: '${rmsDefaultRowNum}',
|
||||
autoheight: true,
|
||||
height: $("#container").height(),
|
||||
autowidth: true,
|
||||
viewrecords: true,
|
||||
rowList: eval('[${rmsDefaultRowList}]'),
|
||||
loadComplete: function(d) {
|
||||
var colModel = $(this).getGridParam("colModel");
|
||||
for (var i = 0; i < colModel.length; i++) {
|
||||
$(this).setColProp(colModel[i].name, { sortable: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// 날짜/시간 입력 마스크
|
||||
$("input[name=searchStartDate], input[name=searchEndDate]").inputmask("9999-99-99", { 'autoUnmask': true });
|
||||
$("input[name=searchStartTime], input[name=searchEndTime]").inputmask("99:99", { 'autoUnmask': true });
|
||||
|
||||
// 기본값 설정 (현재 시간 기준 1시간 전 정각 ~ 현재 정각)
|
||||
var now = new Date();
|
||||
var endHour = now.getHours();
|
||||
var startHour = endHour - 1;
|
||||
var startDate, endDate;
|
||||
|
||||
if (startHour < 0) {
|
||||
startHour = 23;
|
||||
var yesterday = new Date(now);
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
startDate = yesterday.getFullYear() + '-' +
|
||||
String(yesterday.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(yesterday.getDate()).padStart(2, '0');
|
||||
endDate = now.getFullYear() + '-' +
|
||||
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(now.getDate()).padStart(2, '0');
|
||||
} else {
|
||||
var today = getToday();
|
||||
startDate = today;
|
||||
endDate = today;
|
||||
}
|
||||
|
||||
if (!$("input[name=searchStartDate]").val()) {
|
||||
$("input[name=searchStartDate]").val(startDate);
|
||||
$("input[name=searchStartTime]").val(String(startHour).padStart(2, '0') + ':00');
|
||||
}
|
||||
if (!$("input[name=searchEndDate]").val()) {
|
||||
$("input[name=searchEndDate]").val(endDate);
|
||||
$("input[name=searchEndTime]").val(String(endHour).padStart(2, '0') + ':00');
|
||||
}
|
||||
|
||||
initCharts();
|
||||
list();
|
||||
search();
|
||||
fetchChartData(validateAndAdjustDateRange());
|
||||
resizeJqGridWidth('grid', 'content_middle', '1200');
|
||||
|
||||
$("#btn_search").click(function() {
|
||||
search();
|
||||
});
|
||||
|
||||
$("input[name^=search]").keydown(function(key) {
|
||||
if (key.keyCode == 13) {
|
||||
$("#btn_search").click();
|
||||
}
|
||||
});
|
||||
|
||||
// 종료일/시간 변경 시 1시간 초과 검증
|
||||
$("input[name=searchEndDate], input[name=searchEndTime]").on('change blur', function() {
|
||||
validateAndAdjustDateRange();
|
||||
});
|
||||
|
||||
// 윈도우 리사이즈 시 차트 리사이즈
|
||||
$(window).resize(function() {
|
||||
if (callChart) callChart.resize();
|
||||
if (respChart) respChart.resize();
|
||||
});
|
||||
|
||||
buttonControl();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="right_box">
|
||||
<div class="content_top">
|
||||
<ul class="path">
|
||||
<li><a href="#">${rmsMenuPath}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content_middle" id="content_middle">
|
||||
<div class="search_wrap">
|
||||
<button type="button" class="cssbtn" id="btn_search" level="R">
|
||||
<i class="material-icons">search</i> <%= localeMessage.getString("button.search") %>
|
||||
</button>
|
||||
</div>
|
||||
<div class="title" id="title">API 분단위 통계</div>
|
||||
<table class="search_condition" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width:100px;">조회기간</th>
|
||||
<td colspan="3">
|
||||
<input type="text" name="searchStartDate" value="${param.searchStartDate}" style="width:100px;">
|
||||
<input type="text" name="searchStartTime" value="${param.searchStartTime}" style="width:60px;">
|
||||
~
|
||||
<input type="text" name="searchEndDate" value="${param.searchEndDate}" style="width:100px;">
|
||||
<input type="text" name="searchEndTime" value="${param.searchEndTime}" style="width:60px;">
|
||||
<span style="color:#888; font-size:12px; margin-left:10px;">(최대 1시간, 초과시 자동 조정)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">API명</th>
|
||||
<td>
|
||||
<input type="text" name="searchApiName" value="${param.searchApiName}">
|
||||
</td>
|
||||
<th style="width:100px;">인스턴스</th>
|
||||
<td>
|
||||
<input type="text" name="searchGwInstanceId" value="${param.searchGwInstanceId}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">업무구분</th>
|
||||
<td>
|
||||
<input type="text" name="searchBizDivCode" value="${param.searchBizDivCode}">
|
||||
</td>
|
||||
<th style="width:100px;">클라이언트ID</th>
|
||||
<td>
|
||||
<input type="text" name="searchClientId" value="${param.searchClientId}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:100px;">Inbound Adapter</th>
|
||||
<td>
|
||||
<input type="text" name="searchInboundAdapter" value="${param.searchInboundAdapter}">
|
||||
</td>
|
||||
<th style="width:100px;">Outbound Adapter</th>
|
||||
<td>
|
||||
<input type="text" name="searchOutboundAdapter" value="${param.searchOutboundAdapter}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="chart-container">
|
||||
<div id="callChart" class="chart"></div>
|
||||
<div id="respChart" class="chart"></div>
|
||||
</div>
|
||||
<table id="grid"></table>
|
||||
<div id="pager"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* API Gateway 시간별 처리 통계
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "API_STATS_HOUR")
|
||||
@IdClass(ApiStatsHourId.class)
|
||||
public class ApiStatsHour implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "STAT_TIME", nullable = false)
|
||||
private LocalDateTime statTime;
|
||||
|
||||
@Id
|
||||
@Column(name = "API_NAME", nullable = false, length = 100)
|
||||
private String apiName;
|
||||
|
||||
@Id
|
||||
@Column(name = "GW_INSTANCE_ID", nullable = false, length = 50)
|
||||
private String gwInstanceId;
|
||||
|
||||
@Id
|
||||
@Column(name = "BIZ_DIV_CODE", nullable = false, length = 50)
|
||||
private String bizDivCode = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "CLIENT_ID", nullable = false, length = 100)
|
||||
private String clientId = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "INBOUND_ADAPTER", nullable = false, length = 100)
|
||||
private String inboundAdapter = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "OUTBOUND_ADAPTER", nullable = false, length = 100)
|
||||
private String outboundAdapter = "NONE";
|
||||
|
||||
@Column(name = "TOTAL_CNT", nullable = false)
|
||||
private Long totalCnt = 0L;
|
||||
|
||||
@Column(name = "SUCCESS_CNT", nullable = false)
|
||||
private Long successCnt = 0L;
|
||||
|
||||
@Column(name = "TIMEOUT_CNT", nullable = false)
|
||||
private Long timeoutCnt = 0L;
|
||||
|
||||
@Column(name = "SYSTEM_ERR_CNT", nullable = false)
|
||||
private Long systemErrCnt = 0L;
|
||||
|
||||
@Column(name = "BIZ_ERR_CNT", nullable = false)
|
||||
private Long bizErrCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_TIMEOUT_CNT", nullable = false)
|
||||
private Long seq900TimeoutCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_SYSTEM_ERR_CNT", nullable = false)
|
||||
private Long seq900SystemErrCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_BIZ_ERR_CNT", nullable = false)
|
||||
private Long seq900BizErrCnt = 0L;
|
||||
|
||||
@Column(name = "AVG_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal avgRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "MIN_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal minRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "MAX_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal maxRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "P50_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal p50RespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "P95_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal p95RespTime = BigDecimal.ZERO;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* API 통계 시간별 복합키
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ApiStatsHourId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private LocalDateTime statTime;
|
||||
private String apiName;
|
||||
private String gwInstanceId;
|
||||
private String bizDivCode;
|
||||
private String clientId;
|
||||
private String inboundAdapter;
|
||||
private String outboundAdapter;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface ApiStatsHourRepository extends BaseRepository<ApiStatsHour, ApiStatsHourId> {
|
||||
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsChartUI;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsSearch;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Projections;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ApiStatsHourService
|
||||
extends AbstractDataService<ApiStatsHour, ApiStatsHourId, ApiStatsHourRepository> {
|
||||
|
||||
private static final int MAX_HOURS = 24;
|
||||
|
||||
public Page<ApiStatsHour> selectList(ApiStatsSearch search, Pageable pageable) {
|
||||
QApiStatsHour q = QApiStatsHour.apiStatsHour;
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
calculateDateRange(search);
|
||||
if (search.getParsedStartDateTime() != null) {
|
||||
builder.and(q.statTime.goe(search.getParsedStartDateTime()));
|
||||
builder.and(q.statTime.loe(search.getParsedEndDateTime()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchApiName())) {
|
||||
builder.and(q.apiName.containsIgnoreCase(search.getSearchApiName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchGwInstanceId())) {
|
||||
builder.and(q.gwInstanceId.containsIgnoreCase(search.getSearchGwInstanceId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchBizDivCode())) {
|
||||
builder.and(q.bizDivCode.containsIgnoreCase(search.getSearchBizDivCode()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchClientId())) {
|
||||
builder.and(q.clientId.containsIgnoreCase(search.getSearchClientId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchInboundAdapter())) {
|
||||
builder.and(q.inboundAdapter.containsIgnoreCase(search.getSearchInboundAdapter()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchOutboundAdapter())) {
|
||||
builder.and(q.outboundAdapter.containsIgnoreCase(search.getSearchOutboundAdapter()));
|
||||
}
|
||||
|
||||
return repository.findAll(builder, pageable);
|
||||
}
|
||||
|
||||
public List<ApiStatsChartUI> selectChartData(ApiStatsSearch search) {
|
||||
QApiStatsHour q = QApiStatsHour.apiStatsHour;
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
calculateDateRange(search);
|
||||
if (search.getParsedStartDateTime() != null) {
|
||||
builder.and(q.statTime.goe(search.getParsedStartDateTime()));
|
||||
builder.and(q.statTime.loe(search.getParsedEndDateTime()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchApiName())) {
|
||||
builder.and(q.apiName.containsIgnoreCase(search.getSearchApiName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchGwInstanceId())) {
|
||||
builder.and(q.gwInstanceId.containsIgnoreCase(search.getSearchGwInstanceId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchBizDivCode())) {
|
||||
builder.and(q.bizDivCode.containsIgnoreCase(search.getSearchBizDivCode()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchClientId())) {
|
||||
builder.and(q.clientId.containsIgnoreCase(search.getSearchClientId()));
|
||||
}
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(Projections.constructor(ApiStatsChartUI.class,
|
||||
q.statTime,
|
||||
q.totalCnt.sum(),
|
||||
q.successCnt.sum(),
|
||||
q.timeoutCnt.sum(),
|
||||
q.systemErrCnt.sum(),
|
||||
q.bizErrCnt.sum(),
|
||||
q.avgRespTime.avg(),
|
||||
q.p50RespTime.avg(),
|
||||
q.p95RespTime.avg()))
|
||||
.from(q)
|
||||
.where(builder)
|
||||
.groupBy(q.statTime)
|
||||
.orderBy(q.statTime.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 조회 기간 계산 (최대 24시간 제한)
|
||||
*/
|
||||
private void calculateDateRange(ApiStatsSearch search) {
|
||||
if (StringUtils.isBlank(search.getSearchStartDateTime())) {
|
||||
return;
|
||||
}
|
||||
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(search.getSearchStartDateTime() + "00",
|
||||
DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
LocalDateTime endDateTime;
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchEndDateTime())) {
|
||||
endDateTime = LocalDateTime.parse(search.getSearchEndDateTime() + "00",
|
||||
DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
// 24시간 초과 시 시작시간 기준 24시간 후로 강제 설정
|
||||
if (java.time.Duration.between(startDateTime, endDateTime).toHours() > MAX_HOURS) {
|
||||
endDateTime = startDateTime.plusHours(MAX_HOURS);
|
||||
}
|
||||
} else {
|
||||
endDateTime = startDateTime.plusHours(MAX_HOURS);
|
||||
}
|
||||
|
||||
search.setParsedStartDateTime(startDateTime);
|
||||
search.setParsedEndDateTime(endDateTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* API Gateway 분단위 처리 통계
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "API_STATS_MINUTE")
|
||||
@IdClass(ApiStatsMinuteId.class)
|
||||
public class ApiStatsMinute implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "STAT_TIME", nullable = false)
|
||||
private LocalDateTime statTime;
|
||||
|
||||
@Id
|
||||
@Column(name = "API_NAME", nullable = false, length = 100)
|
||||
private String apiName;
|
||||
|
||||
@Id
|
||||
@Column(name = "GW_INSTANCE_ID", nullable = false, length = 50)
|
||||
private String gwInstanceId;
|
||||
|
||||
@Id
|
||||
@Column(name = "BIZ_DIV_CODE", nullable = false, length = 50)
|
||||
private String bizDivCode = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "CLIENT_ID", nullable = false, length = 100)
|
||||
private String clientId = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "INBOUND_ADAPTER", nullable = false, length = 100)
|
||||
private String inboundAdapter = "NONE";
|
||||
|
||||
@Id
|
||||
@Column(name = "OUTBOUND_ADAPTER", nullable = false, length = 100)
|
||||
private String outboundAdapter = "NONE";
|
||||
|
||||
@Column(name = "TOTAL_CNT", nullable = false)
|
||||
private Long totalCnt = 0L;
|
||||
|
||||
@Column(name = "SUCCESS_CNT", nullable = false)
|
||||
private Long successCnt = 0L;
|
||||
|
||||
@Column(name = "TIMEOUT_CNT", nullable = false)
|
||||
private Long timeoutCnt = 0L;
|
||||
|
||||
@Column(name = "SYSTEM_ERR_CNT", nullable = false)
|
||||
private Long systemErrCnt = 0L;
|
||||
|
||||
@Column(name = "BIZ_ERR_CNT", nullable = false)
|
||||
private Long bizErrCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_TIMEOUT_CNT", nullable = false)
|
||||
private Long seq900TimeoutCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_SYSTEM_ERR_CNT", nullable = false)
|
||||
private Long seq900SystemErrCnt = 0L;
|
||||
|
||||
@Column(name = "SEQ900_BIZ_ERR_CNT", nullable = false)
|
||||
private Long seq900BizErrCnt = 0L;
|
||||
|
||||
@Column(name = "AVG_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal avgRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "MIN_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal minRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "MAX_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal maxRespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "P50_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal p50RespTime = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "P95_RESP_TIME", precision = 10, scale = 3)
|
||||
private BigDecimal p95RespTime = BigDecimal.ZERO;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* API 통계 분단위 복합키
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ApiStatsMinuteId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private LocalDateTime statTime;
|
||||
private String apiName;
|
||||
private String gwInstanceId;
|
||||
private String bizDivCode;
|
||||
private String clientId;
|
||||
private String inboundAdapter;
|
||||
private String outboundAdapter;
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface ApiStatsMinuteRepository extends BaseRepository<ApiStatsMinute, ApiStatsMinuteId> {
|
||||
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsChartUI;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsSearch;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Projections;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ApiStatsMinuteService
|
||||
extends AbstractDataService<ApiStatsMinute, ApiStatsMinuteId, ApiStatsMinuteRepository> {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
|
||||
|
||||
private static final int MAX_MINUTES = 60;
|
||||
|
||||
public Page<ApiStatsMinute> selectList(ApiStatsSearch search, Pageable pageable) {
|
||||
QApiStatsMinute q = QApiStatsMinute.apiStatsMinute;
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
calculateDateRange(search);
|
||||
if (search.getParsedStartDateTime() != null) {
|
||||
builder.and(q.statTime.goe(search.getParsedStartDateTime()));
|
||||
builder.and(q.statTime.loe(search.getParsedEndDateTime()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchApiName())) {
|
||||
builder.and(q.apiName.containsIgnoreCase(search.getSearchApiName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchGwInstanceId())) {
|
||||
builder.and(q.gwInstanceId.containsIgnoreCase(search.getSearchGwInstanceId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchBizDivCode())) {
|
||||
builder.and(q.bizDivCode.containsIgnoreCase(search.getSearchBizDivCode()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchClientId())) {
|
||||
builder.and(q.clientId.containsIgnoreCase(search.getSearchClientId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchInboundAdapter())) {
|
||||
builder.and(q.inboundAdapter.containsIgnoreCase(search.getSearchInboundAdapter()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchOutboundAdapter())) {
|
||||
builder.and(q.outboundAdapter.containsIgnoreCase(search.getSearchOutboundAdapter()));
|
||||
}
|
||||
|
||||
return repository.findAll(builder, pageable);
|
||||
}
|
||||
|
||||
public List<ApiStatsChartUI> selectChartData(ApiStatsSearch search) {
|
||||
QApiStatsMinute q = QApiStatsMinute.apiStatsMinute;
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
|
||||
calculateDateRange(search);
|
||||
if (search.getParsedStartDateTime() != null) {
|
||||
builder.and(q.statTime.goe(search.getParsedStartDateTime()));
|
||||
builder.and(q.statTime.loe(search.getParsedEndDateTime()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchApiName())) {
|
||||
builder.and(q.apiName.containsIgnoreCase(search.getSearchApiName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchGwInstanceId())) {
|
||||
builder.and(q.gwInstanceId.containsIgnoreCase(search.getSearchGwInstanceId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchBizDivCode())) {
|
||||
builder.and(q.bizDivCode.containsIgnoreCase(search.getSearchBizDivCode()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchClientId())) {
|
||||
builder.and(q.clientId.containsIgnoreCase(search.getSearchClientId()));
|
||||
}
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(Projections.constructor(ApiStatsChartUI.class,
|
||||
q.statTime,
|
||||
q.totalCnt.sum(),
|
||||
q.successCnt.sum(),
|
||||
q.timeoutCnt.sum(),
|
||||
q.systemErrCnt.sum(),
|
||||
q.bizErrCnt.sum(),
|
||||
q.avgRespTime.avg(),
|
||||
q.p50RespTime.avg(),
|
||||
q.p95RespTime.avg()))
|
||||
.from(q)
|
||||
.where(builder)
|
||||
.groupBy(q.statTime)
|
||||
.orderBy(q.statTime.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 조회 기간 계산 (최대 1시간 제한)
|
||||
*/
|
||||
private void calculateDateRange(ApiStatsSearch search) {
|
||||
if (StringUtils.isBlank(search.getSearchStartDateTime())) {
|
||||
return;
|
||||
}
|
||||
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(search.getSearchStartDateTime(), DATE_TIME_FORMATTER);
|
||||
LocalDateTime endDateTime;
|
||||
|
||||
if (StringUtils.isNotBlank(search.getSearchEndDateTime())) {
|
||||
endDateTime = LocalDateTime.parse(search.getSearchEndDateTime(), DATE_TIME_FORMATTER);
|
||||
// 1시간(60분) 초과 시 시작시간 기준 1시간 후로 강제 설정
|
||||
if (java.time.Duration.between(startDateTime, endDateTime).toMinutes() > MAX_MINUTES) {
|
||||
endDateTime = startDateTime.plusMinutes(MAX_MINUTES);
|
||||
}
|
||||
} else {
|
||||
endDateTime = startDateTime.plusMinutes(MAX_MINUTES);
|
||||
}
|
||||
|
||||
search.setParsedStartDateTime(startDateTime);
|
||||
search.setParsedEndDateTime(endDateTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.kjb.statistics;
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.eactive.ext.kjb.statistics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsHour;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsHourService;
|
||||
import com.eactive.ext.kjb.statistics.mapping.ApiStatsUIMapper;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsChartUI;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsSearch;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class ApiStatsHourController {
|
||||
|
||||
private final ApiStatsHourService service;
|
||||
private final ApiStatsUIMapper mapper;
|
||||
|
||||
@GetMapping(value = "/onl/kjb/statistics/apiStatsHourMan.view")
|
||||
public String view() {
|
||||
return "/onl/kjb/statistics/apiStatsHourMan";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/kjb/statistics/apiStatsHourMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<ApiStatsUI>> selectList(ApiStatsSearch search, Pageable pageable) {
|
||||
Pageable sortedPageable = PageRequest.of(
|
||||
pageable.getPageNumber(),
|
||||
pageable.getPageSize(),
|
||||
Sort.by(Sort.Order.desc("statTime")));
|
||||
|
||||
Page<ApiStatsHour> page = service.selectList(search, sortedPageable);
|
||||
Page<ApiStatsUI> uiPage = page.map(mapper::toVo);
|
||||
|
||||
return ResponseEntity.ok(new GridResponse<>(uiPage));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/kjb/statistics/apiStatsHourMan.json", params = "cmd=CHART")
|
||||
public ResponseEntity<List<ApiStatsChartUI>> selectChartData(ApiStatsSearch search) {
|
||||
List<ApiStatsChartUI> chartData = service.selectChartData(search);
|
||||
return ResponseEntity.ok(chartData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.eactive.ext.kjb.statistics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsMinute;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsMinuteService;
|
||||
import com.eactive.ext.kjb.statistics.mapping.ApiStatsUIMapper;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsChartUI;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsSearch;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class ApiStatsMinuteController {
|
||||
|
||||
private final ApiStatsMinuteService service;
|
||||
private final ApiStatsUIMapper mapper;
|
||||
|
||||
@GetMapping(value = "/onl/kjb/statistics/apiStatsMinuteMan.view")
|
||||
public String view() {
|
||||
return "/onl/kjb/statistics/apiStatsMinuteMan";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/kjb/statistics/apiStatsMinuteMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<ApiStatsUI>> selectList(ApiStatsSearch search, Pageable pageable) {
|
||||
Pageable sortedPageable = PageRequest.of(
|
||||
pageable.getPageNumber(),
|
||||
pageable.getPageSize(),
|
||||
Sort.by(Sort.Order.desc("statTime")));
|
||||
|
||||
Page<ApiStatsMinute> page = service.selectList(search, sortedPageable);
|
||||
Page<ApiStatsUI> uiPage = page.map(mapper::toVo);
|
||||
|
||||
return ResponseEntity.ok(new GridResponse<>(uiPage));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/kjb/statistics/apiStatsMinuteMan.json", params = "cmd=CHART")
|
||||
public ResponseEntity<List<ApiStatsChartUI>> selectChartData(ApiStatsSearch search) {
|
||||
List<ApiStatsChartUI> chartData = service.selectChartData(search);
|
||||
return ResponseEntity.ok(chartData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
# API Gateway 통계 화면
|
||||
|
||||
## 개요
|
||||
|
||||
API Gateway의 분단위/시간별 처리 통계를 조회하는 관리 화면입니다.
|
||||
|
||||
## 파일 구조
|
||||
|
||||
```
|
||||
com.eactive.ext.kjb.statistics/
|
||||
├── ApiStatsMinuteController.java # 분단위 통계 Controller
|
||||
├── ApiStatsMinuteService.java # 분단위 통계 Service
|
||||
├── ApiStatsHourController.java # 시간별 통계 Controller
|
||||
├── ApiStatsHourService.java # 시간별 통계 Service
|
||||
├── entity/
|
||||
│ ├── ApiStatsMinute.java # 분단위 통계 Entity
|
||||
│ ├── ApiStatsMinuteId.java # 분단위 통계 복합키
|
||||
│ ├── ApiStatsHour.java # 시간별 통계 Entity
|
||||
│ └── ApiStatsHourId.java # 시간별 통계 복합키
|
||||
├── repository/
|
||||
│ ├── ApiStatsMinuteRepository.java
|
||||
│ └── ApiStatsHourRepository.java
|
||||
├── ui/
|
||||
│ ├── ApiStatsUI.java # 통계 UI DTO
|
||||
│ └── ApiStatsSearch.java # 검색조건 DTO
|
||||
├── mapping/
|
||||
│ └── ApiStatsUIMapper.java # Entity ↔ UI 매핑
|
||||
└── README.md
|
||||
|
||||
JSP 화면:
|
||||
WebContent/jsp/kjb/statistics/
|
||||
├── apiStatsMinuteMan.jsp # 분단위 통계 화면
|
||||
└── apiStatsHourMan.jsp # 시간별 통계 화면
|
||||
```
|
||||
|
||||
## URL
|
||||
|
||||
| 화면 | URL |
|
||||
|------|-----|
|
||||
| 분단위 통계 | `/kjb/statistics/apiStatsMinuteMan.view` |
|
||||
| 시간별 통계 | `/kjb/statistics/apiStatsHourMan.view` |
|
||||
|
||||
## 테이블
|
||||
|
||||
| 테이블명 | 설명 |
|
||||
|----------|------|
|
||||
| API_STATS_MINUTE | 분단위 통계 |
|
||||
| API_STATS_HOUR | 시간별 통계 |
|
||||
|
||||
## 복합키 구성
|
||||
|
||||
- statTime (통계 시간)
|
||||
- apiName (API명)
|
||||
- gwInstanceId (Gateway 인스턴스 ID)
|
||||
- bizDivCode (업무구분코드)
|
||||
- clientId (클라이언트 ID)
|
||||
- inboundAdapter (Inbound Adapter)
|
||||
- outboundAdapter (Outbound Adapter)
|
||||
|
||||
## 메트릭
|
||||
|
||||
### 건수 메트릭
|
||||
- totalCnt: 총 처리 건수
|
||||
- successCnt: 성공 건수
|
||||
- timeoutCnt: Timeout 오류 건수
|
||||
- systemErrCnt: 시스템 오류 건수
|
||||
- bizErrCnt: 업무 오류 건수
|
||||
- seq900TimeoutCnt: 로그시퀀스900 Timeout 건수
|
||||
- seq900SystemErrCnt: 로그시퀀스900 시스템 오류 건수
|
||||
- seq900BizErrCnt: 로그시퀀스900 업무 오류 건수
|
||||
|
||||
### 응답시간 메트릭 (ms)
|
||||
- avgRespTime: 평균 응답시간
|
||||
- minRespTime: 최소 응답시간
|
||||
- maxRespTime: 최대 응답시간
|
||||
- p50RespTime: 50 백분위 응답시간
|
||||
- p95RespTime: 95 백분위 응답시간
|
||||
|
||||
## Multi-tenancy
|
||||
|
||||
API Gateway 통계는 `APIGW` 스키마에 저장됩니다.
|
||||
Controller에서 `DataSourceContextHolder`를 사용하여 스키마를 전환합니다.
|
||||
|
||||
```java
|
||||
DataSourceContextHolder.setDataSourceType(
|
||||
DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW));
|
||||
```
|
||||
|
||||
## 검색 조건
|
||||
|
||||
- 조회기간 (시작~종료)
|
||||
- API명 (like 검색)
|
||||
- Gateway 인스턴스 ID
|
||||
- 업무구분코드 (like 검색)
|
||||
- 클라이언트 ID (like 검색)
|
||||
|
||||
## 기술 스택
|
||||
|
||||
- JPA + QueryDSL
|
||||
- MapStruct (Entity ↔ UI 매핑)
|
||||
- Spring MVC (ResponseEntity)
|
||||
- jqGrid (목록 화면)
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.eactive.ext.kjb.statistics.mapping;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
|
||||
import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsHour;
|
||||
import com.eactive.eai.rms.data.entity.onl.kjb.statistics.ApiStatsMinute;
|
||||
import com.eactive.ext.kjb.statistics.ui.ApiStatsUI;
|
||||
|
||||
@Mapper(config = BaseMapperConfig.class)
|
||||
public interface ApiStatsUIMapper {
|
||||
|
||||
DateTimeFormatter MINUTE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
DateTimeFormatter HOUR_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00");
|
||||
|
||||
@Mapping(source = "statTime", target = "statTime", qualifiedByName = "formatMinuteTime")
|
||||
ApiStatsUI toVo(ApiStatsMinute entity);
|
||||
|
||||
@Mapping(source = "statTime", target = "statTime", qualifiedByName = "formatHourTime")
|
||||
ApiStatsUI toVo(ApiStatsHour entity);
|
||||
|
||||
@Named("formatMinuteTime")
|
||||
default String formatMinuteTime(LocalDateTime dateTime) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
}
|
||||
return dateTime.format(MINUTE_FORMATTER);
|
||||
}
|
||||
|
||||
@Named("formatHourTime")
|
||||
default String formatHourTime(LocalDateTime dateTime) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
}
|
||||
return dateTime.format(HOUR_FORMATTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.eactive.ext.kjb.statistics;
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.ext.kjb.statistics.ui;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* API 통계 차트 데이터 DTO (시간대별 집계)
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ApiStatsChartUI {
|
||||
private String statTime;
|
||||
|
||||
// 건수 메트릭 (SUM)
|
||||
private Long totalCnt;
|
||||
private Long successCnt;
|
||||
private Long timeoutCnt;
|
||||
private Long systemErrCnt;
|
||||
private Long bizErrCnt;
|
||||
|
||||
// 응답시간 메트릭 (AVG)
|
||||
private BigDecimal avgRespTime;
|
||||
private BigDecimal p50RespTime;
|
||||
private BigDecimal p95RespTime;
|
||||
|
||||
// QueryDSL Projections용 생성자
|
||||
public ApiStatsChartUI(LocalDateTime statTime, Long totalCnt, Long successCnt,
|
||||
Long timeoutCnt, Long systemErrCnt, Long bizErrCnt,
|
||||
Double avgRespTime, Double p50RespTime, Double p95RespTime) {
|
||||
this.statTime = statTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
|
||||
this.totalCnt = totalCnt != null ? totalCnt : 0L;
|
||||
this.successCnt = successCnt != null ? successCnt : 0L;
|
||||
this.timeoutCnt = timeoutCnt != null ? timeoutCnt : 0L;
|
||||
this.systemErrCnt = systemErrCnt != null ? systemErrCnt : 0L;
|
||||
this.bizErrCnt = bizErrCnt != null ? bizErrCnt : 0L;
|
||||
this.avgRespTime = avgRespTime != null ? BigDecimal.valueOf(avgRespTime) : BigDecimal.ZERO;
|
||||
this.p50RespTime = p50RespTime != null ? BigDecimal.valueOf(p50RespTime) : BigDecimal.ZERO;
|
||||
this.p95RespTime = p95RespTime != null ? BigDecimal.valueOf(p95RespTime) : BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.eactive.ext.kjb.statistics.ui;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* API 통계 검색조건 DTO
|
||||
*/
|
||||
@Data
|
||||
public class ApiStatsSearch {
|
||||
private String searchStartDateTime;
|
||||
private String searchEndDateTime;
|
||||
private String searchApiName;
|
||||
private String searchGwInstanceId;
|
||||
private String searchBizDivCode;
|
||||
private String searchClientId;
|
||||
private String searchInboundAdapter;
|
||||
private String searchOutboundAdapter;
|
||||
|
||||
/** 파싱된 시작시간 */
|
||||
private LocalDateTime parsedStartDateTime;
|
||||
/** 파싱된 종료시간 */
|
||||
private LocalDateTime parsedEndDateTime;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.eactive.ext.kjb.statistics.ui;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* API 통계 UI DTO (분단위/시간별 공통)
|
||||
*/
|
||||
@Data
|
||||
public class ApiStatsUI {
|
||||
private String statTime;
|
||||
private String apiName;
|
||||
private String gwInstanceId;
|
||||
private String bizDivCode;
|
||||
private String clientId;
|
||||
private String inboundAdapter;
|
||||
private String outboundAdapter;
|
||||
|
||||
// 건수 메트릭
|
||||
private Long totalCnt;
|
||||
private Long successCnt;
|
||||
private Long timeoutCnt;
|
||||
private Long systemErrCnt;
|
||||
private Long bizErrCnt;
|
||||
private Long seq900TimeoutCnt;
|
||||
private Long seq900SystemErrCnt;
|
||||
private Long seq900BizErrCnt;
|
||||
|
||||
// 응답시간 메트릭
|
||||
private BigDecimal avgRespTime;
|
||||
private BigDecimal minRespTime;
|
||||
private BigDecimal maxRespTime;
|
||||
private BigDecimal p50RespTime;
|
||||
private BigDecimal p95RespTime;
|
||||
}
|
||||
Reference in New Issue
Block a user