- Home
- Skills
- DevOps & Cloud
- tenacity retry observability
tenacity retry observability
Detects silent Tenacity retries and generates safe, structured telemetry hooks and metrics.
$10
Works with the AI Agents you already use
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
| ID | Severity | Location | Issue |
|---|---|---|---|
| OBS-1-a2b3 | Critical | services/api/clients/db.py:42 | No exhaustion callback; failures are silent until crash. |
| OBS-1-c4d5 | High | services/api/ext/stripe.py:12 | Missing before_sleep hook; flapping is invisible. |
| OBS-2-e6f7 | Medium | services/api/utils/http.py:88 | Unsafe 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
- Review the generated patches in
./output/patches/to apply hooks todb.pyandstripe.py. - Deploy the
retry_totalmetric to your Prometheus dashboard to monitor dependency stability. - Update
http.pyto 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_sleepandretry_error_callbackhooks 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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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