How to retrieve the duration of a task?

Hi there,

I’m wondering if there is a way to retrieve the duration of tasks? That is, can I retrieve the duration which is shown in the UI, programmatically? Explicitly: I’d like the total runtime of a task running successfully, from when it kicked off to when it completed successfully.

Looking into the data/state responses from

def my_flow():
    future = add_one.submit(1) # return PrefectFuture
    result = future.result() # return data
    state = future.get_state() # return the state as well 

I don’t see any mention of a “duration” or duration-like response – just a timestamp (which I believe gets updated as the PrefectFuture goes through it’s process)

Would writing my own hook be the way to go?

Thanks in advance for your help!