- 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 tools 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
- 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
| 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.
tenacity-retry-observability.pdf
PDF · document
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
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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 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