Skip to content

[Server] Implement Server Lite Mode (gRPC Ingest + WS Broadcast) #6

@varev-dev

Description

@varev-dev

Goal

Implement a Server Lite Mode that accepts agent metric batches over existing gRPC ingest and immediately broadcasts normalized live updates to connected dashboard clients over WebSocket.

Scope of work

  • Keep gRPC ingest endpoint compatible with current protocol.
  • Validate incoming batches using existing core invariants:
    • len(timestamps) == len(values)
    • strictly increasing timestamps per TimeSeries
    • metric name format and basic batch limits.
  • Track latest in-memory state per agent/metric needed for live dashboard.
  • Expose WebSocket endpoint for live stream broadcast to UI clients.
  • Broadcast events to all subscribed clients with minimal transformation (agent id, metric name, labels, timestamp, value).
  • Handle disconnect/reconnect gracefully for both agents and WS clients.
  • Add observability hooks/logging for ingest throughput, connected WS clients, and dropped/invalid messages.

Acceptance criteria

  1. Agent can complete handshake and stream metric batches to server.
  2. Server responds with ack and correct sequence numbers.
  3. Invalid batches are rejected/logged and do not crash the process.
  4. At least one WS client can connect and receive live metric updates within acceptable real-time delay.
  5. Multiple concurrent WS clients receive the same stream reliably.
  6. When no WS clients are connected, ingest remains stable (no blocking/backpressure failure).
  7. Basic tests cover:
    • gRPC ingest,
    • WS broadcast,
    • validation failures.

Deliverables

  • Ingest-to-broadcast pipeline implementation.
  • WebSocket live endpoint contract and message schema documentation.
  • Unit/integration tests.
  • Update to server README/docs with:
    • how to run the server,
    • endpoint list,
    • known limitations (no persistence/history).

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions