一键导入
observability
Observability — forge doctor, Grafana dashboards, querying logs/traces/metrics.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Observability — forge doctor, Grafana dashboards, querying logs/traces/metrics.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Visual-design discipline for forge frontends — brief the work before building (never invent an aesthetic without user input), declare the design system before coding, lean on the component library, use restrained color/type systems, never hand-draw complex SVGs, and verify visually before declaring done.
Write Next.js frontends — generated hooks, component library, Tailwind v4, visual verification, and Connect RPC clients.
Outbound boundary translators. One adapter per third-party system / queue / storage backend; narrow interface, vendor-neutral callers.
Write Connect RPC handlers — proto-driven codegen, the thin-translation handler pattern (validate, extract auth, convert proto↔internal, call service, wrap errors via `svcerr.Wrap`), middleware, and testing. Business logic lives in `internal/handlers/<svc>/contract.go`, never in handlers.
Forge project conventions and architecture — project structure, generated vs hand-written code, the generate pipeline, proto annotations, contracts, wiring, and naming.
Use-case orchestrators that compose two or more adapters/services. Deps are interfaces only — designed for unit tests with all-mock collaborators.
| name | observability |
| description | Observability — forge doctor, Grafana dashboards, querying logs/traces/metrics. |
Every Forge project ships with a full observability stack running locally via Docker Compose (Grafana LGTM: Grafana, Prometheus, Tempo, Loki, Pyroscope). No external services needed.
Verify the entire observability pipeline is working:
forge doctor # Check everything
forge doctor --signal traces # Check only traces
forge doctor --signal metrics # Check only Prometheus
forge doctor --signal logs # Check only Loki
forge doctor --signal profiles # Check only profiling
forge doctor --json # Machine-readable output
forge doctor --verbose # Show evidence for passing checks
Doctor checks: Docker containers running, app health endpoint, pprof endpoint, Prometheus targets up, Tempo traces ingested, Loki log streams present, Pyroscope profiles available.
Run forge doctor after forge up --env=dev to verify the pipeline is healthy before investigating issues.
forge doctor verifies the telemetry pipeline, NOT app-flow correctness. It (like forge smoke) is green when containers, endpoints, and signal ingestion are healthy — it can be green while the actual app flow is broken (e.g. a cross-cluster dial failing). To prove an app-flow invariant holds, use a declarative, exit-coded app-health assertion (model: a project doctor:<flow> task) plus a full forge test e2e. Doctor tells you observability works; it does not certify the app does.
Grafana's port is dynamically assigned. Find it with:
docker compose ps # Look for the lgtm container's port mapping
forge doctor # Also shows the Grafana URL
Two dashboards are auto-provisioned:
In Grafana → Explore → Loki, use LogQL:
{container=~".*app.*"} | json | level="error"
{container=~".*app.*"} | json | procedure="/services.users.v1.UsersService/Create"
{container=~".*app.*"} | json | trace_id="abc123"
Logs are structured JSON with consistent attribute keys (procedure, request_id, trace_id, duration_ms, user_id, status, code). Emit the same attribute keys from your own log sites so dashboards stay queryable.
In Grafana → Explore → Tempo, search by:
trace_id value to jump to the trace)Trace IDs are automatically injected into every log line, connecting logs to traces.
In Grafana → Explore → Prometheus, use PromQL:
go_goroutines # goroutine count per service
up # scrape targets status
rate(http_request_duration_seconds_count[5m]) # request rate
forge doctor after forge up --env=dev to verify observability before investigating issues.docker compose ps or forge doctor to find it.alloy-config.alloy and dashboard files are regenerated by forge generate — do not hand-edit.logevents.go helpers for structured log events — do not create ad-hoc attribute keys.