evalstate's picture
download
raw
1.02 kB
import { logger } from '../utils/logger.js';
class ApiMetricsCollector {
metrics = {
anonymous: 0,
authenticated: 0,
unauthorized: 0,
forbidden: 0,
};
recordCall(hasToken, status) {
logger.debug(`Recording API call: hasToken=${hasToken}, status=${status}`);
if (status === 200) {
if (hasToken) {
this.metrics.authenticated++;
}
else {
this.metrics.anonymous++;
}
}
else if (status === 401) {
this.metrics.unauthorized++;
}
else if (status === 403) {
this.metrics.forbidden++;
}
}
getMetrics() {
return { ...this.metrics };
}
resetMetrics() {
this.metrics = {
anonymous: 0,
authenticated: 0,
unauthorized: 0,
forbidden: 0,
};
}
}
export const apiMetrics = new ApiMetricsCollector();
//# sourceMappingURL=api-metrics.js.map

Xet Storage Details

Size:
1.02 kB
·
Xet hash:
f413e616b71274c62800aa58620d662931269007c80bd7c5ed867dd3f5dc200c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.