feat(phase-5-3): 모니터링 강화
logger.ts, metrics.ts, /api/metrics 추가 Version: e3bcb4ae
This commit is contained in:
@@ -106,12 +106,24 @@ export class CircuitBreaker {
|
||||
* Get circuit statistics
|
||||
*/
|
||||
getStats() {
|
||||
const lastFailure = this.failures.length > 0
|
||||
? this.failures[this.failures.length - 1]
|
||||
: null;
|
||||
|
||||
return {
|
||||
state: this.state,
|
||||
successCount: this.successCount,
|
||||
failureCount: this.failureCount,
|
||||
recentFailures: this.failures.length,
|
||||
openedAt: this.openedAt,
|
||||
failures: this.failures.length,
|
||||
lastFailureTime: lastFailure ? new Date(lastFailure.timestamp) : undefined,
|
||||
stats: {
|
||||
totalRequests: this.successCount + this.failureCount,
|
||||
totalFailures: this.failureCount,
|
||||
totalSuccesses: this.successCount,
|
||||
},
|
||||
config: {
|
||||
failureThreshold: this.failureThreshold,
|
||||
resetTimeoutMs: this.resetTimeoutMs,
|
||||
monitoringWindowMs: this.monitoringWindowMs,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user