fix(monitoring): stop allocating route metrics to domains when no request data exists
This commit is contained in:
@@ -806,20 +806,7 @@ export class MetricsManager {
|
||||
const tp = throughputByRoute.get(routeName) || { in: 0, out: 0 };
|
||||
const routeTotal = routeTotalRequests.get(routeName) || 0;
|
||||
|
||||
// Proportional share based on actual request counts
|
||||
// Fall back to equal split only when no request data exists
|
||||
let share: number;
|
||||
if (routeTotal > 0 && domainReqs > 0) {
|
||||
share = domainReqs / routeTotal;
|
||||
} else {
|
||||
// Count how many resolved domains share this route
|
||||
let domainsInRoute = 0;
|
||||
for (const [, routes] of domainToRoutes) {
|
||||
if (routes.includes(routeName)) domainsInRoute++;
|
||||
}
|
||||
share = 1 / Math.max(domainsInRoute, 1);
|
||||
}
|
||||
|
||||
const share = routeTotal > 0 ? domainReqs / routeTotal : 0;
|
||||
totalConns += conns * share;
|
||||
totalIn += tp.in * share;
|
||||
totalOut += tp.out * share;
|
||||
|
||||
Reference in New Issue
Block a user