tenacity retry observability

    1

    Detects silent Tenacity retries and generates safe, structured telemetry hooks and metrics.

    $10

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    tenacity retry observability

    Example session with this skill installed

    Scan ./services/api for Tenacity retries that aren't logged. We use structlog and have prometheus_client installed.

    • Read your context and instructions
    • Compiled the tenacity retry observability
    • Generated the document

    Processed 14 files in ./services/api. Found 3 retry sites lacking observability and 1 site logging unsafe exception details.

    Tenacity Observability Audit

    IDSeverityLocationIssue
    OBS-1-a2b3Criticalservices/api/clients/db.py:42No exhaustion callback; failures are silent until crash.
    OBS-1-c4d5Highservices/api/ext/stripe.py:12Missing before_sleep hook; flapping is invisible.
    OBS-2-e6f7Mediumservices/api/utils/http.py:88Unsafe logging of raw exception may leak Auth headers.

    Recommended Hooks (output/retry_hooks.py)

    import structlog
    from prometheus_client import Counter
    
    logger = structlog.get_logger(__name__)
    RETRY_COUNT = Counter("retry_total", "Total retries", ["fn_name", "exc_type"])
    
    def log_retry(retry_state):
        fn_name = getattr(retry_state.fn, "__qualname__", "unknown")
        exc = retry_state.outcome.exception()
        exc_type = type(exc).__name__ if exc else "None"
        
        RETRY_COUNT.labels(fn_name=fn_name, exc_type=exc_type).inc()
        
        logger.warning("retrying_request",
            retry_fn=fn_name,
            retry_attempt=retry_state.attempt_number,
            retry_sleep_s=round(retry_state.next_action.sleep, 3),
            retry_exc_type=exc_type
        )
    
    def log_exhausted(retry_state):
        logger.error("retries_exhausted",
            retry_fn=getattr(retry_state.fn, "__qualname__", "unknown"),
            retry_attempts=retry_state.attempt_number
        )
        return retry_state.outcome.result()
    

    Next steps

    1. Review the generated patches in ./output/patches/ to apply hooks to db.py and stripe.py.
    2. Deploy the retry_total metric to your Prometheus dashboard to monitor dependency stability.
    3. Update http.py to use structured attributes instead of logging the full exception object.

    tenacity-retry-observability.pdf

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Standardize retry telemetry across multiple Python microservices.Identify and fix PII leaks in existing retry log messages.Add Prometheus metrics to Tenacity decorators without manual boilerplate.Ensure every exhausted retry triggers a high-severity ERROR log.

    About this skill

    The problem

    Silent retries mask production issues. You cannot tell when a dependency is flapping until the entire process crashes, and generic logging often leaks PII or secrets through raw exception messages.

    What it does

    • Identifies Tenacity retry decorators lacking visibility hooks or exhaustion callbacks.
    • Flags unsafe logging practices that might expose tokens, emails, or sensitive URLs.
    • Generates a telemetry module with structured logging and metrics hooks tailored to your stack.
    • Produces per-site patches to wire up before_sleep and retry_error_callback hooks safely.
    • Drafts alerting rules for retry rates and exhaustion events based on your existing observability tools.

    Frameworks & tools

    Python, Tenacity, Prometheus, StatsD, OpenTelemetry, Structlog.

    Why this beats prompting it yourself

    Generic prompts often suggest hooks that accidentally log sensitive args or kwargs. This skill uses AST-safe analysis to ensure telemetry is structured, avoids PII leakage, and integrates directly with your detected metrics libraries without adding new dependencies.

    Use cases

    • Hardening production services against silent dependency failures.
    • Auditing legacy codebases for PII leaks in retry logs.
    • Implementing standardized retry metrics across a microservices architecture.

    Known limitations

    Analysis is read-only and will not modify your source code directly. It skips Python 2 files and generated code like Protobuf definitions.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 14 days ago

    • Passed all security checks, Safe to install

    Listed14 days ago

    What's inside

    Frequently Asked Questions