-
Notifications
You must be signed in to change notification settings - Fork 43
feat(v0.13): Native Event Stream Consumer — reference consumer for openclaw/openclaw#6467 #34
Copy link
Copy link
Open
Description
Overview
Blocked on upstream: openclaw/openclaw#6467
What ClawMetry Already Has
SSE infrastructure is in place (dashboard.py):
/api/logs-stream— SSE endpoint streaming log lines in real-time (line 9469)/api/health-stream— SSE endpoint for health check push (line 13304)- Concurrent client limiting via
_acquire_stream_slot/_release_stream_slot(lines 8480–8503) SSE_MAX_SECONDS = 300cap per connection (line 118)- JS
EventSourceconsumers for both streams (lines 4767, 5200) - OTLP/HTTP receiver at
/v1/metricsand/v1/traces— OpenClaw pushes telemetry to ClawMetry
What ClawMetry does NOT have: a client that connects outbound to the OpenClaw gateway's event stream socket. Current data flow is push-only (OpenClaw → ClawMetry via OTLP + log tail).
What Needs to Be Added When #6467 Ships
- Outbound socket client (Unix domain or TCP) that connects to the OpenClaw gateway event stream
- Parser for structured JSON event envelope:
agent.started,agent.step_started,agent.finished,tool.call,tool.output,tool.error,subagent.spawned,subagent.output,subagent.finished,llm.tokens,llm.reasoning - Route parsed events into existing
_otel_storebuckets where applicable (tokens →tokens, runs →runs) - Replace file-tail log watcher for events that the stream covers (retain JSONL fallback for older OpenClaw versions)
- Expose parsed events to Live Feed tab
Feedback for OpenClaw API Design (to post on openclaw/openclaw#6467)
call_idcorrelation:tool.call/tool.output/tool.errormust share a stablecall_idso ClawMetry can match a call to its output and error without threading stateparent_session_key:subagent.spawnedmust include the parent session key for tree reconstruction — ClawMetry needs this to render subagent hierarchy (current transcript reader infers depth from indentation only)- Separate reasoning token count:
llm.reasoningshould report thinking tokens separately from output tokens — the current OTLPopenclaw.tokensmetric has no reasoning field, so thinking cost is invisible
Acceptance Criteria
- Outbound event stream client connects to OpenClaw gateway socket
- All event types in catalog parsed and routed
- Live Feed tab powered by event stream (file-tail fallback retained)
-
call_idcorrelation working for tool timeline - Subagent tree rendered from
parent_session_key - Latency < 100ms from event to UI
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels