Merge branch 'perf/lag': dashboard lag fixes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # client/src/components/Sagi/PetSprite.tsx # client/src/components/Sagi/useSagiBrain.ts
This commit is contained in:
@@ -2118,6 +2118,7 @@ Response `Content-Type: text/plain; version=0.0.4; charset=utf-8`.
|
||||
| `agenthub_build_info` | gauge | `version` | Always `1`; dashboard version rides on the label |
|
||||
| `agenthub_process_uptime_seconds` | gauge | — | Server process uptime |
|
||||
| `agenthub_process_resident_memory_bytes` | gauge | — | Server process RSS |
|
||||
| `agenthub_event_loop_delay_seconds` | gauge | `quantile` (`0.5`, `0.99`, `1` = max) | Event-loop delay over the last minute — how long requests, hooks and terminal echo waited (a laggy terminal shows here) |
|
||||
| `agenthub_sessions` | gauge | `status` (`active`/`completed`/`error`/`abandoned`) | Sessions by status |
|
||||
| `agenthub_agents` | gauge | `status` (`working`/`waiting`/`completed`/`error`) | Agents by status |
|
||||
| `agenthub_events_total` | counter | — | Total events recorded |
|
||||
|
||||
+2
-2
@@ -182,7 +182,7 @@ npm run install-hooks
|
||||
> (Escape hatch for running Claude Code *inside* the same container:
|
||||
> `AGENTHUB_ALLOW_CONTAINER_HOOKS=1 npm run install-hooks`.)
|
||||
|
||||
For each of the eight hook types it adds one entry to `~/.claude/settings.json` that runs the handler with the type as its argument; the five tool/turn hooks (`PreToolUse`, `PostToolUse`, `Stop`, `SubagentStop`, `Notification`) carry `"matcher": "*"`. Entries that are not AgentHub's are left alone. There is nothing else to install — Claude Code runs `scripts/hook-handler.js` directly.
|
||||
For each of the eight hook types it adds one entry to `~/.claude/settings.json` that runs the handler with the type as its argument; the five tool/turn hooks (`PreToolUse`, `PostToolUse`, `Stop`, `SubagentStop`, `Notification`) carry `"matcher": "*"`. `PreToolUse` and `PostToolUse` also carry `"async": true` (`ASYNC_HOOKS` in `scripts/install-hooks.js`, and the same in `.claude-plugin/plugin.json`): they fire around every tool call, and Claude Code waits for a synchronous hook before going on — each a Node start of 0.1–0.2 s, so ~0.4 s added to every tool call. The handler only reports (it prints nothing and decides nothing), so nothing is lost by not waiting; the rarer hooks stay synchronous so a turn's start and end reach the dashboard in order. Entries that are not AgentHub's are left alone. There is nothing else to install — Claude Code runs `scripts/hook-handler.js` directly.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -191,7 +191,7 @@ For each of the eight hook types it adds one entry to `~/.claude/settings.json`
|
||||
{
|
||||
"matcher": "*",
|
||||
"hooks": [
|
||||
{ "type": "command", "command": "node \"/path/to/agenthub/scripts/hook-handler.js\" PreToolUse" }
|
||||
{ "type": "command", "command": "node \"/path/to/agenthub/scripts/hook-handler.js\" PreToolUse", "async": true }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-1
@@ -24,7 +24,8 @@ as they are into an existing Grafana (Dashboards → New → Import).
|
||||
## Metrics used
|
||||
|
||||
`agenthub_up`, `agenthub_build_info{version}`, `agenthub_process_uptime_seconds`,
|
||||
`agenthub_process_resident_memory_bytes`, `agenthub_sessions{status}`,
|
||||
`agenthub_process_resident_memory_bytes`, `agenthub_event_loop_delay_seconds{quantile}`,
|
||||
`agenthub_sessions{status}`,
|
||||
`agenthub_agents{status}`, `agenthub_events_total`, `agenthub_websocket_clients`,
|
||||
`agenthub_remote_sources{enabled}`, `agenthub_tokens_total{kind}`.
|
||||
|
||||
|
||||
+3
-1
@@ -797,7 +797,9 @@ What a new machine still needs by hand after it:
|
||||
`PostToolUse` (both with `"matcher": "*"`), `Stop`, `SubagentStop`,
|
||||
`Notification`, `SessionStart`, `SessionEnd` and `UserPromptSubmit`, a
|
||||
`command` hook `/opt/agenthub/libexec/member-hook <Event>` with
|
||||
`"timeout": 5`.
|
||||
`"timeout": 5` — and `"async": true` on `PreToolUse` and `PostToolUse`, so
|
||||
Claude Code does not wait a Node start before and after every tool call.
|
||||
Re-running `install-system` rewrites a managed file it wrote itself.
|
||||
5. Any other daemon that must see every process (monitoring agents, for
|
||||
example) needs group `agenthub-proc`: `sudo usermod -aG agenthub-proc <it>`.
|
||||
6. A tool `agenthub server tools` reports as `ESHAREDLAYOUT` (a script in a
|
||||
|
||||
Reference in New Issue
Block a user