observability-and-instrumentation 是什么?
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.
以上为来源原文,中文用途说明尚待整理。
怎么接入你的 Agent?
- 定位完整 Skill 目录
打开本项目来源,核对
SKILL.md及其引用的脚本和资料。 - 交给你正在用的 Agent
在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。
- 确认识别,再做具体任务
让 Agent 回报安装目录和识别到的名称
observability-and-instrumentation,然后告诉 Agent 你的任务和实际输入,让它先核对触发条件。
展开并复制给 Codex 的安装指令
安装并检查 observability-and-instrumentation
请在 Codex 的当前工作环境中安装并检查 observability-and-instrumentation 这个 Skill。
项目身份:addyosmani/agent-skills / observability-and-instrumentation
来源:https://github.com/addyosmani/agent-skills/blob/8c99fa36d90068c82d547f7c12a9d67a3e95f4ee/skills/observability-and-instrumentation/SKILL.md
已定位的源文件:skills/observability-and-instrumentation/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Claude Code 的安装指令
安装并检查 observability-and-instrumentation
请在 Claude Code 的当前工作环境中安装并检查 observability-and-instrumentation 这个 Skill。
项目身份:addyosmani/agent-skills / observability-and-instrumentation
来源:https://github.com/addyosmani/agent-skills/blob/8c99fa36d90068c82d547f7c12a9d67a3e95f4ee/skills/observability-and-instrumentation/SKILL.md
已定位的源文件:skills/observability-and-instrumentation/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Cursor 的安装指令
安装并检查 observability-and-instrumentation
请在 Cursor Agent 的当前工作环境中安装并检查 observability-and-instrumentation 这个 Skill。
项目身份:addyosmani/agent-skills / observability-and-instrumentation
来源:https://github.com/addyosmani/agent-skills/blob/8c99fa36d90068c82d547f7c12a9d67a3e95f4ee/skills/observability-and-instrumentation/SKILL.md
已定位的源文件:skills/observability-and-instrumentation/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 当前 Agent 的安装指令
安装并检查 observability-and-instrumentation
请在 当前 Agent 的当前工作环境中安装并检查 observability-and-instrumentation 这个 Skill。
项目身份:addyosmani/agent-skills / observability-and-instrumentation
来源:https://github.com/addyosmani/agent-skills/blob/8c99fa36d90068c82d547f7c12a9d67a3e95f4ee/skills/observability-and-instrumentation/SKILL.md
已定位的源文件:skills/observability-and-instrumentation/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。来源原文与资料状态
- 源文件
- 已保存 SKILL.md,抓取于 2026-11-21T19:32:09.269Z
- 中文使用说明
- 尚待整理,保留英文来源内容
- 安装与任务测试
- 本站未执行安装或任务测试
- 来源复核
- 已保留来源记录;当前完整用法未逐项人工复核
展开 SKILL.md 原文、章节与历史收录资料
skills/observability-and-instrumentation/SKILL.md · 抓取时间 2026-11-21T19:32:09.269Z
以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。
抓取成功不代表已完成安装或任务测试。
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.
查看源文件章节 / Source sections
- 原文:Observability and Instrumentation
- 原文:Overview
- 原文:When to Use
- 原文:Process
- 原文:1. Define "working" before instrumenting
- 原文:2. Pick the right signal for each question
- 原文:3. Structured logging
- 原文:4. Metrics
- 原文:5. Distributed tracing
- 原文:6. Alerting
- 原文:Writing Runbooks
- 原文:7. Verify the telemetry itself
- 原文:Common Rationalizations
- 原文:Red Flags
- 原文:Verification
原文: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-recovery` skill (observability is what makes that skill fast next time) - Profiling and optimizing measured slowness — use the `performance-optimization` skill - Launch-day monitoring checklists and rollback triggers — see the `shipping-and-launch` skill; this skill covers the instrumentation that feeds them
原文: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: ```typescript // 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: ```typescript // 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:
本段为节选,完整内容见源文件。
原文:4. Metrics
For request-driven services, instrument **RED** on every endpoint and every external dependency: **R**ate (requests/sec), **E**rrors (failure rate), **D**uration (latency histogram, not average). For resources (queues, pools, hosts), use **USE**: **U**tilization, **S**aturation, **E**rrors. As with tracing, the vendor-neutral path is the OpenTelemetry metrics API (same SDK and context as step 5). The example below uses Prometheus' `prom-client` — one common backend choice, not the only one; the RED/USE and cardinality rules are identical either way. ```typescript import { Histogram } from 'prom-client'; const httpDuration = new Histogram({ name: 'http_request_duration_seconds', help: 'HTTP request duration', labelNames: ['method', 'route', 'status_class'], // '2xx', not '200' buckets: [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5], }); ``` **Cardinality is the failure mode.** Every unique label combination is a separate time series. Labels must come from small, fixed sets (route template, status class, provider name). Never use user IDs, raw URLs, error messages, or other unbounded values as labels — that belongs in logs and traces. ``` OK as label: route="/api/tasks/:id" status_class="5xx" provider="stripe" NEVER a label: user_id, email, request_id, full URL, error message text ``` Track averages never, percentiles always: an average hides the 1% of users having a terrible time. Use histograms and read p50/p95/p99.
文件 SHA256:e7fcb0820306d46268de9594d676ad98e35040858926c412b7000faa52a61f87
仓库许可证记录:MIT;repository-license-recorded-scope-unverified,查看来源。
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.
历史收录数据
| 来源仓库 | addyosmani/agent-skills |
|---|---|
| Skill源路径 | skills/observability-and-instrumentation/SKILL.md |
安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。
