Replies: 3 comments 1 reply
-
ENRICO!?!?!? You here!? How long it's been? 20 years? 😅 Anyhow, I think this is subproblem of #21 but an important addition: there should be a plug before and after a retry. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I made it work for my case. In case anyone else needs this. import logging
import stamina
logger = logging.getLogger("stamina")
def log_retries(
attempt: int, idle_for: float, exc: Exception, name: str, args: tuple[object, ...], kwargs: dict[str, object]
) -> None:
logger.warning(
"stamina.retry_scheduled",
extra=dict(attempt=attempt, idle_for=idle_for, exc=repr(exc), origin=name),
)
stamina._instrumentation.INSTRUMENTS.append(log_retries) |
Beta Was this translation helpful? Give feedback.
0 replies
-
This has been fixed with #35 – the snippet won't work in stamina 23.1 and later. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to log retries similar to what is done in the tenacity documentation.
https://tenacity.readthedocs.io/en/latest/#before-and-after-retry-and-logging
Beta Was this translation helpful? Give feedback.
All reactions