ruvnet/ruflo/tree/main/plugins/ruflo-observability
ruflo-observability
结构化日志、分布式追踪和指标,用于将代理群活动与应用遥测关联起来。作为 mod(ADR-445):对其工具和 /observe-mod 采用只收紧的防护,并提供控制台显示的状态文件
关于这个 mod
结构化日志、分布式追踪和指标,用于将代理群活动与应用遥测关联起来。
实现兼容 OpenTelemetry 的结构化日志(带关联 ID)、具有父子 span 层级的分布式追踪,以及指标收集(计数器、仪表和直方图)。它会把群组代理活动与应用层遥测关联起来,并检测延迟、错误率和资源使用量中的异常。
安装:claude --plugin-dir plugins/ruflo-observability
作为 mod(ADR-445 模式,hooks/register.ts),它不会联网、不会启动进程,也不会调用模型,却会加入以下内容:
- Guard(只收紧,默认开启):拒绝写入包含机密、美国 SSN 或带空格支付卡号的遥测记忆(span、日志、标签)。拒绝原因只指出规则,绝不显示值。
- /observe-mod:本地
status和scan <text>(机密检查,规则与 Guard 相同)。 - 状态文件 .claude-flow/observe-mod/status.json,在会话开始和计数器变化时写入。
包含 observability-engineer 代理、observe-trace 和 observe-metrics 技能,以及 observe trace/metrics/logs/dashboard/correlate 命令。使用 claude plugin validate plugins/ruflo-observability、claude plugin test plugins/ruflo-observability 和 bash plugins/ruflo-observability/scripts/smoke.sh 验证。采用 MIT 授权。
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add ruvnet/ruflo claude plugin install ruflo-observability
原文 / README
ruflo-observability
Structured logging, distributed tracing, and metrics -- correlate agent swarm activity with application telemetry.
Overview
Implements OpenTelemetry-compatible structured logging with correlation IDs, distributed tracing with parent-child span hierarchies, and metrics collection (counters, gauges, histograms). Correlates swarm agent activity with application-level telemetry and detects anomalies in latency, error rates, and resource usage.
Installation
claude --plugin-dir plugins/ruflo-observability
Agents
| Agent | Model | Role |
|-------|-------|------|
| observability-engineer | sonnet | Structured logging, distributed tracing, metrics collection, agent-application telemetry correlation |
Skills
Skills are auto-invoked via the Skill tool when their description matches the task (progressive disclosure). For an explicit CLI surface use the /observe slash command below.
| Skill | Argument hint | Description |
|-------|---------------|-------------|
| observe-trace | <task-id> | Trace agent execution by collecting spans and building a trace tree |
| observe-metrics | [--period 1h] | Aggregate and display system metrics with anomaly detection |
Commands (5 subcommands)
observe trace <task-id> # Trace agent execution with span tree
observe metrics [--period 1h] # View aggregated metrics (p50, p95, p99)
observe logs [--level error] # Filter structured logs by level
observe dashboard # Combined health dashboard
observe correlate <agent-id> # Correlate all telemetry for an agent
Key Metrics
| Metric | Type | Description |
|--------|------|-------------|
| agent_task_duration_seconds | Histogram | Time to complete agent tasks |
| agent_token_usage | Counter | Tokens consumed per agent/model |
| agent_active_count | Gauge | Currently active agents |
| agent_error_rate | Counter | Errors per agent |
| swarm_span_duration_ms | Histogram | Span durations for tracing |
| memory_operations_total | Counter | AgentDB read/write counts |
Trace Hierarchy
[root] swarm-task
[child] agent-spawn (agent=architect)
[child] agent-spawn (agent=coder)
[child] file-read (path=src/auth.ts)
[child] file-write (path=src/auth.ts)
[child] agent-spawn (agent=tester)
[child] test-run (suite=auth)
Log Format
JSON structured logs with timestamp, level, message, correlationId, agentId, taskId, spanId, traceId, duration_ms, and metadata.
Compatibility
- CLI: pinned to
@claude-flow/cliv3.6 major+minor. - Verification:
bash plugins/ruflo-observability/scripts/smoke.shis the contract.
Namespace coordination
This plugin owns the observability AgentDB namespace (base-name exception per ruflo-agentdb ADR-0001 §"Namespace convention", same precedent as federation and migrations). Reserved namespaces (pattern, claude-memories, default) MUST NOT be shadowed.
observability is accessed via memory_* tools (namespace-routed). Stores spans, metric snapshots, and log entries.
Routing note: Earlier versions of these skills used
agentdb_hierarchical-recallwith namespace argument — that tool family routes by tier and ignores namespace strings. ADR-0001 fixed the skills to usememory_*for namespaced reads and documented the dual pattern-store path for metric snapshots.
Verification
bash plugins/ruflo-observability/scripts/smoke.sh
# Expected: "10 passed, 0 failed"
Architecture Decisions
Related Plugins
ruflo-agentdb— namespace convention owner; defines the routing rules ADR-0001 fixes a violation ofruflo-cost-tracker-- Token usage metrics feed into cost attributionruflo-iot-cognitum-- Reuses Z-score anomaly detection for telemetry patternsruflo-market-data-- Data feed health and ingestion latency monitoring
License
MIT
As a mod
Function-hook mod (ADR-445 pattern, hooks/register.ts). It adds, with no network, no process spawning and no model call:
- Guard (tighten-only, default on): refuses a memory write of telemetry (spans, logs, labels) that holds a secret, a US SSN or a spaced payment-card number (13-digit epoch timestamps are fine). The deny reason names the rule, never the value.
/observe-mod: localstatusandscan <text>(secret check, same rules as the guard).- Status file
.claude-flow/observe-mod/status.json({version:1, updatedMs, guard, checked, blocked, ...}), written at session start and when counters change.
Per-prompt context is deliberately not added: this plugin has nothing worth attaching to every prompt.
| Option | Default | Effect |
|---|---|---|
| guard | on | refuse the calls above |
Test: claude plugin validate plugins/ruflo-observability, claude plugin test plugins/ruflo-observability, bash plugins/ruflo-observability/scripts/smoke.sh.
