observability-and-instrumentation
यह क्या करती है
यह skill बताती है कि आपका कोड चलते समय क्या कर रहा है। यह आपके कोड में 'signals' (जैसे logs और measurements) जोड़ती है, ताकि आप समस्याओं को देख और पहचान सकें।
कब इस्तेमाल करें
- ✓जब आप लोगों के लिए इस्तेमाल होने वाला कोई नया feature बना रहे हों।
- ✓जब production में कोई समस्या आए और आपको पता न हो कि क्यों आ रही है।
- ✓जब कोई गड़बड़ होने पर आपको सूचित करने वाले alerts सेट करने हों।
Skill का लिंक
https://github.com/addyosmani/agent-skills/blob/main/skills/observability-and-instrumentation/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“किसी खास customer की payment क्यों फेल हुई, यह मैं कैसे जान सकता हूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप अपने कोड में ऐसे निर्देश जोड़ते हैं जो सिस्टम के काम के बारे में जानकारी (logs, metrics, traces) बनाते हैं। यह जानकारी सुराग की तरह काम करती है, जिससे सिस्टम के व्यवहार को समझने में मदद मिलती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Observability and Instrumentation
Overview
Code you can't observe is code you can't operate. Observability is the ability to answer "what is the system doing and why?" from the outside, using the telemetry the code emits. Instrumentation is not a post-launch add-on — it's written alongside the feature, the same way tests are. If a feature ships without telemetry, the first user-reported bug becomes archaeology instead of a query.
When to Use
- Building any feature that will run in production
- Adding a new service, endpoint, background job, or external integration
- A production incident took too long to diagnose ("we couldn't tell what happened")
- Setting up or reviewing alerting rules
- Reviewing a PR that adds I/O, retries, queues, or cross-service calls
NOT for:
- Diagnosing a failure happening right now — use the
debugging-and-error-recoveryskill (observability is what makes that skill fast next time) - Profiling and optimizing measured slowness — use the
performance-optimizationskill - Launch-day monitoring checklists and rollback triggers — see the
shipping-and-launchskill; this skill covers the instrumentation that feeds them
Process
1. Define "working" before instrumenting
Telemetry without a question is noise. Before adding any instrumentation, write down 2–4 questions an on-call engineer will ask about this feature:
FEATURE: checkout payment retry
QUESTIONS ON-CALL WILL ASK:
1. What fraction of payments succeed on first attempt vs after retry?
2. When a payment fails permanently, why? (provider error? timeout? validation?)
3. Is the payment provider slower than usual?
→ Every signal below must help answer one of these.
If you can't name the questions, you're not ready to instrument — you'll log everything and learn nothing.
2. Pick the right signal for each question
| Signal | Answers | Cost profile | Example |
|---|---|---|---|
| Structured log | "What happened in this specific case?" | Per-event; grows with traffic | payment_failed with provider error code |
| Metric | "How often / how fast, in aggregate?" | Fixed per series; cheap to query | p99 latency of provider calls |
| Trace | "Where did time go across services?" | Per-request; usually sampled | One slow checkout, broken down by hop |
Rule of thumb: metrics tell you that something is wrong, traces tell you where, logs tell you why.
3. Structured logging
Log events, not prose. Every log line is a JSON object with a stable event name and machine-readable fields:
// BAD: string interpolation — unqueryable, inconsistent
logger.info(`Payment ${id} failed for user ${userId} after ${n} retries`);
// GOOD: stable event name + structured fields
logger.warn({
event: 'payment_failed',
paymentId: id,
provider: 'stripe',
errorCode: err.code,
attempt: n,
}, 'payment failed');
Log levels — use them consistently:
| Level | Meaning | On-call action |
|---|---|---|
error |
Invariant broken; someone may need to act | Investigate |
warn |
Degraded but handled (retry succeeded, fallback used) | Watch for trends |
info |
Significant business event (order placed, job finished) | None |
debug |
Diagnostic detail | Off in production by default |
Correlation IDs are mandatory. Generate (or accept) a request ID at the system boundary and attach it to every log line, span, and outbound call. Without it, you cannot reconstruct a single request from interleaved logs:
// Express: child logger per request, ID propagated downstream
app.use((req, res, next) => {
req.id = req.headers['x-request-id'] ?? crypto.randomUUID();
req.log = logger.child({ requestId: req.id });
res.setHeader('x-request-id', req.id);
next();
});
When several entry points write to one log, name the entry point. A correlation ID identifies a run; it does not say which code path started it. The same job reached by a scheduler, by a replay endpoint, and by a manual CLI run produces interchangeable lines in one sink, so attributing a line falls back to elimination — cross-reading the scheduler's history, the process table, a deploy log — and that argument holds only as long as those external records happen to still exist. Stamp the entry point where the run starts, next to the correlation ID, and propagate both the same way:
// One helper for every entry point: the run's own logger carries both fields.
…
अक्सर पूछे जाने वाले सवाल
'logs', 'metrics' और 'traces' क्या हैं?
Logs किसी खास घटना के रिकॉर्ड होते हैं। Metrics समय के साथ डेटा का सार होते हैं (जैसे प्रति घंटे कितनी errors आईं)। Traces दिखाते हैं कि कोई request अलग-अलग services से होकर कैसे गुज़री।
मैं इसे कोड पूरा होने के बाद ही क्यों नहीं जोड़ सकता?
कोड लिखते समय यह जानकारी जोड़ना कहीं आसान और ज़्यादा असरदार होता है। बाद में जोड़ना ऐसा है जैसे बिना किसी सुराग के रहस्य सुलझाने की कोशिश करना।
'correlation IDs' क्या हैं?
ये यूनिक पहचान नंबर होते हैं जो किसी एक काम या request से जुड़ी सारी जानकारी (logs, metrics, traces) को आपस में जोड़ते हैं, भले ही वे अलग-अलग समय पर या सिस्टम के अलग-अलग हिस्सों में बनी हों।
जानकारी
लेखक का मूल विवरण
Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.
repo: addyosmani/agent-skills
लोकप्रियता
- GitHub स्टार
- 107k
- रैंकिंग में स्थान
- #777
- लाइसेंस
- MIT
- अपडेट की गई
- 13/10/2026
कमेंट
- …
इस repository की और skills
api-and-interface-design
107kअच्छी तरह परिभाषित APIs और interfaces डिज़ाइन करने में मदद करता है। सॉफ्टवेयर के अलग-अलग हिस्से आपस में कैसे बात करेंगे, यह तय करते समय उपयोगी है।
browser-testing-with-devtools
107kआपके एजेंट को असली browsers में सीधे code टेस्ट करने में मदद करता है। जिस माहौल में चीज़ इस्तेमाल होगी, वहाँ वह कैसे चलती है यह जाँचने और errors व performance की समस्याएँ ढूंढने के लिए उपयोगी है।
ci-cd-and-automation
107kआपके AI एजेंट को दोहराए जाने वाले काम अपने-आप करना, प्रोजेक्ट्स शिप करना और इंफ्रास्ट्रक्चर मैनेज करना सिखाता है।
code-review-and-quality
107kकई पहलुओं पर detailed code reviews करता है। नए changes merge करने से पहले quality सुनिश्चित करने और आगे की समस्याएँ रोकने के लिए उपयोगी है।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।