통계 로그 추가
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.util.Logger;
|
||||||
import com.eactive.eai.custom.statistics.config.ApiStatsConfig;
|
import com.eactive.eai.custom.statistics.config.ApiStatsConfig;
|
||||||
import com.eactive.eai.custom.statistics.dto.HourStatsKey;
|
import com.eactive.eai.custom.statistics.dto.HourStatsKey;
|
||||||
import com.eactive.eai.custom.statistics.dto.MinuteStatsKey;
|
import com.eactive.eai.custom.statistics.dto.MinuteStatsKey;
|
||||||
@@ -22,9 +23,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
* - 거래 이벤트를 분/시간 단위로 메모리에 집계
|
* - 거래 이벤트를 분/시간 단위로 메모리에 집계
|
||||||
* - Thread-safe한 ConcurrentHashMap 사용
|
* - Thread-safe한 ConcurrentHashMap 사용
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@Service
|
@Service
|
||||||
public class ApiStatsCollector {
|
public class ApiStatsCollector {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||||
|
|
||||||
/** 최대 Aggregator 수 제한 (메모리 보호) */
|
/** 최대 Aggregator 수 제한 (메모리 보호) */
|
||||||
private static final int MAX_MINUTE_AGGREGATORS = 10000;
|
private static final int MAX_MINUTE_AGGREGATORS = 10000;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import javax.annotation.PreDestroy;
|
|||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.eactive.eai.common.util.Logger;
|
||||||
import com.eactive.eai.custom.statistics.collector.ApiStatsCollector;
|
import com.eactive.eai.custom.statistics.collector.ApiStatsCollector;
|
||||||
import com.eactive.eai.custom.statistics.config.ApiStatsConfig;
|
import com.eactive.eai.custom.statistics.config.ApiStatsConfig;
|
||||||
import com.eactive.eai.custom.statistics.persistence.ApiStatsHourLogger;
|
import com.eactive.eai.custom.statistics.persistence.ApiStatsHourLogger;
|
||||||
@@ -23,10 +24,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
* - 분단위: 매 분 5초에 실행하여 집계된 통계를 DB에 저장
|
* - 분단위: 매 분 5초에 실행하여 집계된 통계를 DB에 저장
|
||||||
* - 시간별: 매 시간 5분에 실행하여 집계된 통계를 DB에 저장
|
* - 시간별: 매 시간 5분에 실행하여 집계된 통계를 DB에 저장
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ApiStatsScheduler {
|
public class ApiStatsScheduler {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||||
|
|
||||||
private final ApiStatsCollector collector;
|
private final ApiStatsCollector collector;
|
||||||
private final ApiStatsMinuteLogger minuteLogger;
|
private final ApiStatsMinuteLogger minuteLogger;
|
||||||
|
|||||||
Reference in New Issue
Block a user