Sync DNS2 production changes - removed obsolete test suite and refactored structure

This commit is contained in:
Krystie
2026-03-23 10:47:15 +01:00
parent 1ac50918ab
commit d76644d948
288 changed files with 8965 additions and 15731 deletions

View File

@@ -111,7 +111,7 @@ class HealthChecker extends EventEmitter {
responseTime,
statusCode: result.statusCode,
message: result.message,
details: result.details,
details: result.details
};
// Track consecutive failures for exponential backoff
@@ -136,7 +136,7 @@ class HealthChecker extends EventEmitter {
timestamp: new Date().toISOString(),
status: 'down',
responseTime,
error: error.message,
error: error.message
};
this.recordStatus(serviceId, status);
@@ -170,7 +170,7 @@ class HealthChecker extends EventEmitter {
method,
timeout: config.timeout || 20000,
headers: config.headers || {},
rejectUnauthorized: false, // Trust internal CA certs (.sami TLD)
rejectUnauthorized: false // Trust internal CA certs (.sami TLD)
};
const req = protocol.request(options, (res) => {
@@ -189,8 +189,8 @@ class HealthChecker extends EventEmitter {
message: healthy ? 'Service is healthy' : 'Service check failed',
details: {
headers: res.headers,
bodyLength: data.length,
},
bodyLength: data.length
}
});
});
});
@@ -306,7 +306,7 @@ class HealthChecker extends EventEmitter {
const existing = this.incidents.find(i =>
i.serviceId === serviceId &&
i.type === type &&
i.status === 'open',
i.status === 'open'
);
if (existing) {
@@ -327,7 +327,7 @@ class HealthChecker extends EventEmitter {
createdAt: status.timestamp,
lastOccurrence: status.timestamp,
occurrences: 1,
details: status,
details: status
};
this.incidents.push(incident);
@@ -343,7 +343,7 @@ class HealthChecker extends EventEmitter {
const incident = this.incidents.find(i =>
i.serviceId === serviceId &&
i.type === type &&
i.status === 'open',
i.status === 'open'
);
if (incident) {
@@ -402,7 +402,7 @@ class HealthChecker extends EventEmitter {
const history = this.history[serviceId] || [];
return history.filter(h =>
new Date(h.timestamp).getTime() > cutoffTime,
new Date(h.timestamp).getTime() > cutoffTime
);
}
@@ -423,10 +423,10 @@ class HealthChecker extends EventEmitter {
name: config?.name || serviceId,
uptime: {
'24h': uptime24h,
'7d': uptime7d,
'7d': uptime7d
},
avgResponseTime,
sla: config?.sla,
sla: config?.sla
};
}
@@ -456,8 +456,8 @@ class HealthChecker extends EventEmitter {
min: Math.min(...responseTimes),
max: Math.max(...responseTimes),
p95: this.calculatePercentile(responseTimes, 95),
p99: this.calculatePercentile(responseTimes, 99),
},
p99: this.calculatePercentile(responseTimes, 99)
}
};
}
@@ -504,7 +504,7 @@ class HealthChecker extends EventEmitter {
slowResponseThreshold: config.slowResponseThreshold || 5000,
sla: config.sla,
headers: config.headers || {},
body: config.body,
body: config.body
};
this.saveConfig();
@@ -531,7 +531,7 @@ class HealthChecker extends EventEmitter {
for (const serviceId in this.history) {
this.history[serviceId] = this.history[serviceId].filter(h =>
new Date(h.timestamp).getTime() > cutoffTime,
new Date(h.timestamp).getTime() > cutoffTime
);
}
}