feat(collectors) basic implementation of boring collectors; sender via http(s) to hard coded api route

This commit is contained in:
2026-01-18 19:21:16 +00:00
parent e64f597fab
commit db6ed003f1
12 changed files with 611 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package sender
import (
"context"
"log"
"bugs.watch/agent/internal/aggregate"
)
// LoggingSender sends snapshots to the local log.
// This is a stand-in for HTTP or disk-backed senders.
type LoggingSender struct{}
func NewLoggingSender() *LoggingSender {
return &LoggingSender{}
}
func (s *LoggingSender) Send(ctx context.Context, snap aggregate.Snapshot) error {
select {
case <-ctx.Done():
// Context cancelled. Best effort: do not block shutdown.
return ctx.Err()
default:
log.Printf(
"SEND cpu=%.2f%% mem=%.2f%% disk=%.2f%% uptime=%ds",
snap.CPUAvg,
snap.MemAvg,
snap.DiskAvg,
snap.Uptime,
)
return nil
}
}