Skip to content

Add noop-monitor backend for convos connection monitoring - #1

Draft
qeggleston wants to merge 1 commit into
mainfrom
noop-monitor-daemon
Draft

Add noop-monitor backend for convos connection monitoring#1
qeggleston wants to merge 1 commit into
mainfrom
noop-monitor-daemon

Conversation

@qeggleston

Copy link
Copy Markdown

Summary

Daemon (Go) side of the convos streaming connection monitor. Adds a noop-monitor backend to examples/streaming-daemon-go that receives a handed-off client socket, holds it open sending nothing but periodic : ping keepalives, and lets us read connection volume / concurrency / duration straight from the daemon's Prometheus metrics. No LLM, Redis, message data, or per-user logging.

Companion to the Etsyweb Api_Member_Conversations_StreamingMonitor endpoint (separate PR) which sets the handoff headers. Implements the daemon plan in convos-streaming-noop-daemon-plan.md.

What's included

  • backends/noop_monitor.goNoopMonitor backend. Self-registers via init(); routed to by X-Handoff-Data {"backend":"noop-monitor"}. Ping loop detects client disconnect via write failure; ctx cancellation distinguishes max_lifetime (deadline) from shutdown. A client disconnect returns (0, nil) — it's normal, not an error.
  • Metricsnoop_monitor_active{source} (gauge) and noop_monitor_closed_total{source,reason} (counter), on top of the built-in daemon_* connection metrics. The client-influenced source label is clamped to {detail, message_list, other} to bound Prometheus cardinality.
  • backends/backend.goHandoffData gains Source and ConnectionID.
  • config/config.goNoopMonitorConfig{ping_interval_ms} (default 25000) + validation.
  • DocsREADME.md + config/example.yaml.
  • Testsbackends/noop_monitor_test.go: client_disconnect / shutdown / max_lifetime reason paths, ping write, gauge/counter movement, source normalization.

Verification

make fmt, make vet, make build, and make test (go test -race ./...) all pass.

Out of scope (separate rollout steps per the plan)

Dedicated convos-streaming-monitor.service systemd instance, chef recipe, and the :9091 Prometheus scrape target.

🤖 Generated with Claude Code

Adds a streaming-daemon backend that holds a handed-off client
connection open, sending only periodic `: ping` SSE keepalives and
recording connection volume/concurrency/duration in Prometheus. No LLM,
Redis, message data, or per-user logging — the daemon side of the convos
streaming connection monitor.

- backends/noop_monitor.go: NoopMonitor backend (registers via init,
  selected by handoff `{"backend":"noop-monitor"}`). Ping loop detects
  client disconnect via write failure; ctx cancel distinguishes
  max_lifetime (deadline) from shutdown. Exposes noop_monitor_active
  gauge and noop_monitor_closed_total counter, labeled by source/reason.
  The client-influenced source label is clamped to {detail,message_list,
  other} to bound metric cardinality.
- backends/backend.go: HandoffData gains Source and ConnectionID.
- config: NoopMonitorConfig{ping_interval_ms} (default 25000) + validation.
- README/example.yaml: document the backend.

Deployment (dedicated systemd instance, chef, :9091 Prometheus scrape)
is a separate rollout step per the daemon plan.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant