Skip to content

Commit

Permalink
Removed backup field fix
Browse files Browse the repository at this point in the history
  • Loading branch information
igoristic committed Feb 18, 2021
1 parent 30156e8 commit bbea2d8
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ export class QuotaMetric extends Metric {
const quota = get(bucket, 'quota.value');
const deltaUsageDerivNormalizedValue = get(bucket, 'usage_deriv.normalized_value');
const periodsDerivNormalizedValue = get(bucket, 'periods_deriv.normalized_value');
const backupMetricDerivNormalizedValue = get(bucket, 'metric_deriv.normalized_value');

if (deltaUsageDerivNormalizedValue && periodsDerivNormalizedValue && quota > 0) {
// if throttling is configured
const factor =
deltaUsageDerivNormalizedValue / (periodsDerivNormalizedValue * quota * 1000); // convert quota from microseconds to nanoseconds by multiplying 1000
return factor * 100; // convert factor to percentage
}
// if throttling is NOT configured, show the backup field or nothing. The user should see that something is not configured correctly
return backupMetricDerivNormalizedValue || null;
// if throttling is NOT configured, show nothing. The user should see that something is not configured correctly
return null;
};
}
}

0 comments on commit bbea2d8

Please sign in to comment.