Skip to content

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

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

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

Conversation

@qeggleston

@qeggleston qeggleston commented Jul 23, 2026

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.

Companion to the Etsyweb Api_Member_Conversations_StreamingMonitor endpoint PR

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

Tested on development, see comments in companion Etsyweb PR for methods.

🤖 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>
@qeggleston
qeggleston marked this pull request as ready for review August 26, 2026 19:29
@qeggleston qeggleston closed this Aug 26, 2026
@qeggleston qeggleston reopened this Aug 27, 2026
ticker := time.NewTicker(n.pingInterval)
defer ticker.Stop()

loop:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt look like golang. Missing comment?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a label, on lines 82 and 87 it's used to specify what to break out of when we reach max connection lifetime or client disconnect. It's because if we just did normal "break" we'd just break out of select

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, make build passes without any issues

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.

2 participants