Getting the run cost and duration
You can get the cost and duration of the current including retries of the same run.In Trigger.dev cloud we do not include time between attempts, before your code executes, or waits
towards the compute cost or duration.
Getting the run cost and duration from your backend
You can use runs.retrieve() to get a single run or runs.list() to get a list of runs. The response will includecostInCents baseCostInCents and durationMs fields.
single run
multiple runs
Getting the cost and duration of a block of code
You can also wrap code withusage.measure to get the cost and duration of that block of code:
run function, our lifecycle hooks (like onStart, onFailure, onSuccess, etc.), or any function you’re calling from the run function. It won’t work for code that’s not executed using Trigger.dev.
