MCPcopy
hub / github.com/slimtoolkit/slim / processMonitoringResults

Method processMonitoringResults

pkg/app/sensor/controlled/controlled.go:231–259  ·  view source on GitHub ↗
(mon monitor.CompositeMonitor)

Source from the content-addressed store, hash-verified

229}
230
231func (s *Sensor) processMonitoringResults(mon monitor.CompositeMonitor) error {
232 // A bit of code duplication to avoid starting a goroutine
233 // for error event handling - keeping the control flow
234 // "single-threaded" keeps reasoning about the logic.
235 for _, err := range mon.DrainErrors() {
236 log.WithError(err).Warn("sensor: non-critical monitor error condition (drained)")
237 s.exe.PubEvent(event.Error, monitor.NonCriticalError(err).Error())
238 }
239
240 log.Info("sensor: composite monitor is done, checking status...")
241
242 report, err := mon.Status()
243 if err != nil {
244 log.WithError(err).Error("sensor: composite monitor failed")
245 return fmt.Errorf("composite monitor failed: %w", err)
246 }
247
248 if err := s.artifactor.Process(
249 mon.StartCommand(),
250 s.mountPoint,
251 report.PeReport,
252 report.FanReport,
253 report.PtReport,
254 ); err != nil {
255 log.WithError(err).Error("sensor: artifact.Process() failed")
256 return fmt.Errorf("saving reports failed: %w", err)
257 }
258 return nil // Clean exit
259}

Callers 1

runWithMonitorMethod · 0.95

Calls 8

NonCriticalErrorFunction · 0.92
DrainErrorsMethod · 0.65
PubEventMethod · 0.65
StatusMethod · 0.65
ProcessMethod · 0.65
StartCommandMethod · 0.65
ErrorMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected