It would be neat if you could import an SDK to control your Defang provisioned infrastructure from within your application.
For example something very loosely along these lines:
import defang from '@defang/sdk';
function myMonitoringService(){
const workerService = defang.getService('worker');
const instanceCount = workerService.getInstanceCount();
const customMetric = myPrivateFunctionThatGivesMeARelevantMetric();
if(customMetric > 0.8 && instanceCount < 10) {
workerService.setInstanceCount(instanceCount + 1);
}
if(customMetric < 0.4 && instanceCount > 2){
workerService.setInstanceCount(instanceCount - 1);
}
}
It would be neat if you could import an SDK to control your Defang provisioned infrastructure from within your application.
For example something very loosely along these lines: