Follow-up · depth 12
What metrics prove Decorators is healthy in prod?
What metrics prove Decorators is healthy in prod?
Answers use simple, clear English.
Quick interview answer
Prove Decorators is healthy with latency (p50/p95/p99), error/saturation rates, and queue/event-loop lag — not just CPU. Context: Mitigate first, then root-cause. Check symptoms against: Forgetting @wraps; decorator not returning wrapper function..
Detailed answer
Production health signals for Decorators: • Latency: p50/p95/p99 of the critical path that uses Decorators. • Errors: failure rate, timeouts, and retry storms. • Saturation: queue depth, event-loop delay, thread/pool utilization. • Business SLIs: request success and user-visible freshness where relevant. Trade-off lens: Pros: DRY cross-cutting logic; composable with stacking decorators. Cons: Stack order matters; debugging wrapped call stacks is harder. Explain thresholds + alerts, then how you triage. Parent context: Mitigate first, then root-cause. Check symptoms against: Forgetting @wraps; decorator not returning wrapper function..
Full explanation
Good answers name measurable signals and what “bad” looks like for Decorators. Decorators wrap functions: @decorator applies decorator(func). functools.wraps preserves __name__/__doc__. Common for logging, auth, caching, retries.
Follow-up questions
Only answered follow-ups are shown — click to open with full answers
Parent context — Decorators
Mitigate first, then root-cause. Check symptoms against: Forgetting @wraps; decorator not returning wrapper function..
View full parent question →