Skip to content

statistics are empty #517

@setop

Description

@setop

I needed to know how many retries a function made.

I used the example in the doc (v9.0.0):

from tenacity import *

@retry(stop=stop_after_attempt(3))
def raise_my_exception():
    raise Exception("Fail")

try:
    raise_my_exception()
except Exception as e:
    print(e)
    pass

print(raise_my_exception.retry.statistics)

when executing:

RetryError[<Future at 0x7ffb5b7902d0 state=finished raised Exception>]
{}

statistics are empty

I was expecting

{ "attempt_number" : 3 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions