cosmos-explorer/src/Utils/AutoPilotUtils.ts
asier-isayas b5d7423849
Set default RU throughput for Production workload accounts to be 10k (#2070)
* assign default throughput based on workload type

* combined common logic

* fix unit tests

* add tests

* update tests

* npm run format

* Set default RU throughput for Production workload accounts to be 10k

* remove unused method

* refactor

---------

Co-authored-by: Asier Isayas <aisayas@microsoft.com>
2025-03-10 11:35:17 -04:00

30 lines
784 B
TypeScript

export const autoPilotThroughput1K = 1000;
export const autoPilotIncrementStep = 1000;
export const autoPilotThroughput4K = 4000;
export const autoPilotThroughput10K = 10000;
export function isValidAutoPilotThroughput(maxThroughput: number): boolean {
if (!maxThroughput) {
return false;
}
if (maxThroughput < autoPilotThroughput1K) {
return false;
}
if (maxThroughput % 1000) {
return false;
}
return true;
}
export function getMinRUsBasedOnUserInput(throughput: number): number {
return Math.round(throughput && throughput * 0.1);
}
export function getStorageBasedOnUserInput(throughput: number): number {
return Math.round(throughput && throughput * 0.01);
}
export function getAutoPilotHeaderText(): string {
return "Throughput (autoscale)";
}