package collector import ( "context" "mfd-monitor-agent/internal/snapshot" "mfd-monitor-agent/internal/status" ) // namedCollector binds a stable collector name to a collection function. type namedCollector struct { name string fn func(context.Context, *status.HostStatus) error } // Name returns the collector name used in snapshot error records. func (c namedCollector) Name() string { return c.name } // Collect runs the wrapped collection function. func (c namedCollector) Collect(ctx context.Context, out *status.HostStatus) error { return c.fn(ctx, out) } // New returns the default collector set for the current platform. func New(hostID string) []snapshot.Collector { return []snapshot.Collector{ namedCollector{name: "system", fn: func(ctx context.Context, out *status.HostStatus) error { return collectSystem(ctx, hostID, out) }}, namedCollector{name: "network", fn: collectNetwork}, namedCollector{name: "resource", fn: collectResource}, namedCollector{name: "process", fn: collectProcesses}, namedCollector{name: "socket", fn: collectSockets}, } }