feat: enhance file upload process with temporary file handling, improved error management, and metrics logging

This commit is contained in:
MythEclipse
2026-05-22 00:29:54 +07:00
parent fd5eb98586
commit 56b929ffb1
7 changed files with 176 additions and 75 deletions
+12 -9
View File
@@ -109,14 +109,17 @@ class MetricsCollector {
export const metricsCollector = new MetricsCollector();
// Log metrics every 5 minutes
setInterval(() => {
const snapshot = metricsCollector.getSnapshot();
logger.info('Metrics snapshot', {
uploadLatency: snapshot.uploadLatency,
uploadThroughput: snapshot.uploadThroughput.toFixed(2),
errorRate: snapshot.errorRate.toFixed(2),
cacheHitRate: snapshot.cacheHitRate.toFixed(2),
});
}, 5 * 60 * 1000);
setInterval(
() => {
const snapshot = metricsCollector.getSnapshot();
logger.info('Metrics snapshot', {
uploadLatency: snapshot.uploadLatency,
uploadThroughput: snapshot.uploadThroughput.toFixed(2),
errorRate: snapshot.errorRate.toFixed(2),
cacheHitRate: snapshot.cacheHitRate.toFixed(2),
});
},
5 * 60 * 1000,
);
export { MetricsCollector };