tenacity retry observability

    1

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

    $10

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+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

    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.

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

    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.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.

    Read-only analysis; no direct source modification. Skips Python 2, notebooks, and generated code (*_pb2.py). Requires Tenacity as the retry library.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 months ago

    Software
    Python

    Permissions

    No special permissions declared or detected

    Listed2 months ago
    Updated1 month ago

    What's inside

    Frequently Asked Questions

    This skill identifies "silent" Tenacity retries that lack monitoring and generates structured telemetry hooks to track failure rates and PII-safe logging without exposing sensitive data.

    It is compatible with any AI agent capable of file-system access or code analysis, such as GitHub Copilot, Cursor, or custom LangChain agents, focusing on Python environments using the Tenacity library.

    You receive the core analysis logic for detecting retry vulnerabilities, templates for structured telemetry modules (Prometheus/OpenTelemetry), and pre-configured alerting rule drafts for your metrics stack.

    No, the skill uses AST-safe analysis to generate non-breaking patches and separate telemetry modules, ensuring your existing retry logic remains intact while adding the necessary visibility.

    The skill performs a security-first audit of your retry hooks to ensure that raw exception messages, which often contain tokens or emails, are filtered before being sent to your logging provider.

    While optimized for modern Python 3 environments, it supports standard observability protocols including StatsD, Prometheus, and OpenTelemetry, adapting its output to your detected libraries.

    New in DevOps & Cloud