Observability 标志

Observability

社区
nitinjain999
observability

Instrument services with structured logging, Prometheus metrics, and OpenTelemetry tracing. Build Grafana dashboards, write Prometheus alerting rules, run k6 load tests, and plan infrastructure capacity.

Add to TypingMind

概览

发布者nitinjain999
代码仓库platform-skills
技能名称observability
星标数
71
复刻数
14
附带文件
仅含指令
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 nitinjain999 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Observability AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/nitinjain999/platform-skills/tree/main/plugins/platform-skills/skills/observability
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nitinjain999/platform-skills.git /tmp/platform-skills
mkdir -p .claude/skills
cp -r /tmp/platform-skills/plugins/platform-skills/skills/observability .claude/skills/observability
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Observability,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Observability。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Observability 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Set up or improve observability for a service or platform component.


Interactive Wizard (fires when no arguments are provided)

When invoked with no arguments, ask before proceeding:

Q1 — Mode?

What do you need?
  1. instrument — add structured logs, Prometheus metrics, and OTel tracing to a service
  2. dashboard  — create a Grafana RED/USE dashboard for a service
  3. alert      — write Prometheus alerting rules for a service
  4. slo        — define SLIs, error budgets, and SLO burn-rate alerts
  5. loadtest   — write and run a k6 load test
  6. capacity   — estimate resource requirements and HPA configuration

Enter 1–6 or mode name:

Q2 — Context (after mode selected):

  • instrument: What language/framework and which metrics/tracing backend (Prometheus, Datadog, Jaeger, Tempo)?
  • dashboard: Service name and which signal to lead with — request-based (RED) or resource-based (USE)?
  • alert: Service name and what SLIs matter most — error rate, latency, availability?
  • slo: Service name, expected availability target (e.g. 99.9%), and current p95 latency baseline:
  • loadtest: Target endpoint, expected peak RPS, and SLO thresholds (p95 latency, max error rate):
  • capacity: Expected peak RPS, measured p99 latency at current load, and memory per pod:

Mode: instrument

Add the three pillars — logs, metrics, traces — to a service.

Steps:

  1. Ask for: language/framework, existing logging library (if any), metrics backend (Prometheus / Datadog / CloudWatch), tracing backend (Jaeger / Tempo / OTLP)
  2. Add structured JSON logging with correlation IDs (Pino for Node.js, structlog for Python)
  3. Instrument RED metrics: http_requests_total counter, http_request_duration_seconds histogram, per route and status
  4. Add OpenTelemetry tracing with span attributes on critical paths
  5. Expose /metrics scrape endpoint (Prometheus) or configure push exporter
  6. Add /healthz and /readyz health check endpoints
  7. Document what NOT to log (passwords, tokens, PII)

Reference: references/observability.md → Structured Logging, Prometheus Metrics, OpenTelemetry Tracing

→ Next: Run /platform-skills:observability alert to write alerting rules for the metrics just added, then /platform-skills:observability slo to wrap them in an error budget.

Mode: dashboard

Create a Grafana dashboard for a service.

Steps:

  1. Choose method: RED (request-based services) or USE (resource-based infrastructure)
  2. Define panels: request rate, error rate %, p50/p95/p99 latency, active connections, queue depth
  3. Set meaningful Y-axis units (req/s, ms, %)
  4. Add threshold lines at SLO boundaries
  5. Configure template variables for environment and service filtering

Reference: references/observability.md → Grafana Dashboards

→ Next: Run /platform-skills:observability slo to add SLO burn-rate alerts and an error budget panel to this dashboard.

Mode: alert

Write Prometheus alerting rules for a service.

Steps:

  1. Identify SLIs: error rate, latency percentiles, availability
  2. Write alert expressions using rate() over 5m windows
  3. Set for: duration ≥ 1m to suppress transient noise
  4. Add severity label (critical / warning) and runbook annotation to every alert
  5. Validate: no alert fires on healthy baseline, alert fires on injected fault

Alert design rules:

  • Page on symptoms (error rate, latency), not causes (CPU %)
  • Every alert needs a runbook URL
  • Derive SLO burn-rate alerts from error budget, not raw thresholds

Reference: references/observability.md → Alerting Rules

Security posture and CVE alerts from Kubescape's exporter (kubescape_controls_total_*, kubescape_vulnerabilities_*; failing scans show only in the scanner's logs, not in these metrics) → /platform-skills:kubescape-operator metrics.

→ Next: Run /platform-skills:observability slo to promote these symptom alerts to proper SLO burn-rate alerts backed by an error budget.

Mode: loadtest

Write and run a k6 load test.

Steps:

  1. Ask for: target endpoint, expected peak RPS, SLO thresholds (p95 latency, error rate)
  2. Write ramp-up → steady-state → ramp-down stages
  3. Set thresholds matching the SLO
  4. Add check() assertions on status code and response time

Version check: k6 --version — must be ≥ 1.0.0. k6 v0.x and v1.x have incompatible JavaScript API syntax. Upgrade: brew install k6 (macOS) or see https://grafana.com/docs/k6/latest/set-up/install-k6/ for other platforms.

  1. Run: k6 run --out json=results.json load-test.js
  2. Interpret results: p95/p99 latency, error rate, throughput achieved vs. thresholds

Reference: references/observability.md → Load Testing

Mode: capacity

Estimate resource requirements and HPA configuration for a service.

Steps:

  1. Gather: expected peak RPS, measured p99 latency, memory per pod at current load
  2. Apply formula: replicas = ceil((peak_rps × avg_latency_s) / target_concurrency_per_pod)
  3. Add 50% headroom for spikes
  4. Generate HPA manifest with CPU utilisation target ≤ 60%
  5. Set resource requests to measured baseline + 20%; set memory limit; omit CPU limit unless throttling is acceptable
  6. Define min/max replica bounds

Reference: references/observability.md → Capacity Planning

→ Next: After sizing, run /platform-skills:observability loadtest to validate the HPA triggers correctly under synthetic load.


Mode: slo

Define SLIs, set error budgets, and generate SLO burn-rate alerts from first principles.

Steps:

  1. Define SLIs — identify what "good" looks like for this service:

    • Availability: sum(rate(http_requests_total{status!~"5.."}[5m])) / sum(rate(http_requests_total[5m]))
    • Latency: histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) < 0.3
    • Choose one primary SLI per service; add a secondary only if the first doesn't capture the user journey
  2. Set the SLO target — start conservative, tighten over time:

    SLO:           99.9% availability over a 30-day rolling window
    Error budget:  0.1% = 43.2 minutes per 30 days
  3. Generate burn-rate alerts — multiwindow, multi-burn-rate (Google SRE Book approach):

    yaml
    # Fast burn — consumes 5% of monthly budget in 1h → page immediately
    - alert: SLOFastBurn
      expr: |
        (
          rate(http_requests_total{status=~"5.."}[1h])
          / rate(http_requests_total[1h])
        ) > (14.4 * 0.001)   # 14.4× burn rate exhausts budget in ~2 days
      for: 2m
      labels:
        severity: critical
      annotations:
        summary: "Fast error budget burn on {{ $labels.service }}"
        runbook: "https://runbooks.internal/slo-fast-burn"
    
    # Slow burn — consumes 10% of monthly budget in 6h → ticket
    - alert: SLOSlowBurn
      expr: |
        (
          rate(http_requests_total{status=~"5.."}[6h])
          / rate(http_requests_total[6h])
        ) > (6 * 0.001)      # 6× burn rate exhausts budget in ~5 days
      for: 15m
      labels:
        severity: warning
      annotations:
        summary: "Slow error budget burn on {{ $labels.service }}"
        runbook: "https://runbooks.internal/slo-slow-burn"
  4. Track remaining error budget — add to the Grafana dashboard:

    promql
    # Error budget remaining (%) over 30d
    1 - (
      sum(increase(http_requests_total{status=~"5.."}[30d]))
      / sum(increase(http_requests_total[30d]))
    ) / 0.001   # divide by error budget fraction (1 - SLO target)
  5. Error budget policy — state in writing what happens when the budget is depleted:

    • 50% remaining → normal feature velocity

    • 10–50% remaining → reliability improvements prioritised alongside features
    • <10% remaining → feature freeze; only reliability work until budget recovers

Key rules:

  • Alert on burn rate, not on raw error count — burn rate is predictive
  • The for: on fast burn should be short (1–2m); slow burn needs longer (10–15m)
  • Latency SLOs need histogram buckets aligned to the SLO threshold at chart creation time — you cannot retroactively add buckets

→ Next: Run /platform-skills:observability alert to add symptom-based alerts alongside SLO burn-rate alerts.


Common mistakes

  • Alerting on CPU% or memory% — these are causes, not symptoms. Alert on error rate and latency; let CPU/memory be dashboard panels only
  • Missing for: duration — without it, a single bad scrape triggers a page. Minimum 1m for slow alerts, 2m for fast SLO burn
  • Not defining SLOs before writing alerts — without an SLO, you don't know what threshold to alert at. Define the SLO first (slo mode), then write alerts
  • Histogram bucket boundaries misaligned with SLO — if your SLO is p95 < 300ms and you have no bucket at 0.3s, histogram_quantile interpolates inaccurately. Set le values at 0.1, 0.25, 0.3, 0.5, 1.0, 2.5
  • Labelling with high-cardinality dimensions — never use user_id, session_id, or request_id as Prometheus label values. Cardinality explodes memory usage
  • Alert fatigue from symptom + cause alerts — if you alert on both "error rate high" and "database connection pool exhausted", both fire simultaneously for the same incident. Alert on the symptom; include cause investigation in the runbook

常见问题

Observability AI 技能有什么作用?

Instrument services with structured logging, Prometheus metrics, and OpenTelemetry tracing. Build Grafana dashboards, write Prometheus alerting rules, run k6 load tests, and plan infrastructure capacity.

为什么在 TypingMind 中使用 Observability?

因为您只需安装一次,就能搭配任何模型使用。Observability 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Observability?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/nitinjain999/platform-skills/tree/main/plugins/platform-skills/skills/observability。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Observability?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Observability 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Observability 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Observability AI 技能免费吗?

是的。nitinjain999 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇