observe-metrics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Observe Metrics

观测指标

Aggregate counters, gauges, and histograms from the observability namespace and flag anomalies.
聚合来自可观测性命名空间的计数器、仪表盘和直方图,并标记异常。

When to use

使用场景

When you need a snapshot of system health -- task completion rates, error rates, active agent counts, memory usage, and token consumption. Useful for monitoring swarm performance and detecting degradation.
当你需要系统健康状况的快照时——任务完成率、错误率、活跃Agent数量、内存使用情况和令牌消耗情况。这对于监控集群性能和检测性能下降非常有用。

Steps

步骤

  1. Retrieve metrics -- call
    mcp__claude-flow__agentdb_hierarchical-recall
    to fetch metric records from the
    observability
    namespace for the specified period (default: 1 hour)
  2. Aggregate -- compute:
    • Counters: sum totals (tasks_completed, errors, token_usage)
    • Gauges: current values (active_agents, memory_usage_bytes)
    • Histograms: p50, p95, p99 (task_duration_ms, span_duration_ms)
  3. Compute baselines -- search for historical patterns via
    mcp__claude-flow__agentdb_pattern-search
    to establish baseline values for each metric
  4. Flag anomalies -- mark metrics deviating >2 standard deviations from baseline with direction (above/below) and severity
  5. Store patterns -- call
    mcp__claude-flow__agentdb_pattern-store
    to record current metric snapshot for future baseline comparison
  6. Report -- display: metric name, current value, baseline, deviation, trend (up/down/stable), anomaly flag; overall health score (green/yellow/red)
  1. 获取指标——调用
    mcp__claude-flow__agentdb_hierarchical-recall
    observability
    命名空间获取指定时间段(默认:1小时)的指标记录
  2. 聚合计算——计算:
    • 计数器:总和(已完成任务数、错误数、令牌使用量)
    • 仪表盘:当前值(活跃Agent数、内存使用字节数)
    • 直方图:p50、p95、p99分位数(任务持续时间毫秒、跨度持续时间毫秒)
  3. 计算基线——通过
    mcp__claude-flow__agentdb_pattern-search
    搜索历史模式,为每个指标建立基线值
  4. 标记异常——将偏离基线超过2个标准差的指标标记出来,并标注方向(高于/低于)和严重程度
  5. 存储模式——调用
    mcp__claude-flow__agentdb_pattern-store
    记录当前指标快照,用于未来基线对比
  6. 生成报告——显示:指标名称、当前值、基线值、偏差、趋势(上升/下降/稳定)、异常标记;整体健康评分(绿色/黄色/红色)

CLI alternative

CLI替代方案

bash
npx @claude-flow/cli@latest memory search --query "system metrics for last hour" --namespace observability
bash
npx @claude-flow/cli@latest memory search --query "system metrics for last hour" --namespace observability