Skip to content

Files

Latest commit

a6deab6 · Apr 11, 2023

History

History
40 lines (29 loc) · 1.41 KB

faastjs.faastmoduleproxy.costsnapshot.md

File metadata and controls

40 lines (29 loc) · 1.41 KB
id title hide_title
faastjs.faastmoduleproxy.costsnapshot
FaastModuleProxy.costSnapshot() method
true

faastjs > FaastModuleProxy > costSnapshot

FaastModuleProxy.costSnapshot() method

Get a near real-time cost estimate of cloud function invocations.

Signature:

costSnapshot(): Promise<CostSnapshot>;

Returns:

Promise<CostSnapshot>

a Promise for a CostSnapshot.

Remarks

A cost snapshot provides a near real-time estimate of the costs of the cloud functions invoked. The cost estimate only includes the cost of successfully completed calls. Unsuccessful calls may lack the data required to provide cost information. Calls that are still in flight are not included in the cost snapshot. For this reason, it is typically a good idea to get a cost snapshot after awaiting the result of FaastModule.cleanup().

Code example:

const faastModule = await faast("aws", m);
try {
    // invoke cloud functions on faastModule.functions.*
} finally {
     await faastModule.cleanup();
     const costSnapshot = await faastModule.costSnapshot();
     console.log(costSnapshot);
}