Skip to content

Commit

Permalink
Merge pull request #464 from bartoval/fix_services_metrics
Browse files Browse the repository at this point in the history
Fix services metrics
  • Loading branch information
bartoval authored Sep 19, 2024
2 parents 3fc6c15 + 84f1e36 commit 8a5c23a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/pages/shared/Metrics/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,28 @@ export const MetricsController = {
destProcess: sourceProcess
};

const isService = !!service && !sourceSite && !destSite && !sourceProcess && !destProcess;
const isServiceWIthoutSelecedResources = !!service && !sourceSite && !destSite && !sourceProcess && !destProcess;
const isSameSite = !!sourceSite && !!destSite && sourceSite === destSite;

try {
const [sourceToDestByteRateTx, destToSourceByteRateRx, destToSourceByteRateTx, sourceToDestByteRateRx] =
await Promise.all([
// Outgoing byte rate: Data sent from the source to the destination
isService || isSameSite ? [] : PrometheusApi.fetchByteRateByDirectionInTimeRange(params),
isServiceWIthoutSelecedResources || (!service && isSameSite)
? []
: PrometheusApi.fetchByteRateByDirectionInTimeRange(params),
// Incoming byte rate: Data received at the destination from the source
isService || isSameSite ? [] : PrometheusApi.fetchByteRateByDirectionInTimeRange(params, true),
isServiceWIthoutSelecedResources || (!service && isSameSite)
? []
: PrometheusApi.fetchByteRateByDirectionInTimeRange(params, true),
// Outgoing byte rate from the other side: Data sent from the destination to the source
PrometheusApi.fetchByteRateByDirectionInTimeRange(invertedParams),
!isServiceWIthoutSelecedResources && service
? []
: PrometheusApi.fetchByteRateByDirectionInTimeRange(invertedParams),
// Incoming byte rate from the other side: Data received at the source from the destination
PrometheusApi.fetchByteRateByDirectionInTimeRange(invertedParams, true)
!isServiceWIthoutSelecedResources && service
? []
: PrometheusApi.fetchByteRateByDirectionInTimeRange(invertedParams, true)
]);

return {
Expand Down

0 comments on commit 8a5c23a

Please sign in to comment.