It basically refers to the limitation in the usage units. It optimizes the performance. The limit are tracked based on two levels:
- Script level
- API level
The remaining usage limits of a script can be retrieved using the method Script.getRemainingUsage(). But for that, there should be runtime module to get the currently running script. Below is the code or that. Then after getting the result, it can be logged in the execution log.
let obj = runtime.getCurrentScript();
log.debug('Remaining unit use', obj.getRemainingUsage());
In the above code, the current script object is taken using the runtime module and stored in a variable. Then the variable is used to get the remaining usage of that script. I applied it to the user event type script and the result was 1000.