getLoadAverage gets system load average
(ctx context.Context)
| 397 | |
| 398 | // getLoadAverage gets system load average |
| 399 | func (d *Detector) getLoadAverage(ctx context.Context) []float64 { |
| 400 | loadAvg, err := load.AvgWithContext(ctx) |
| 401 | if err != nil { |
| 402 | d.logger.WithError(err).Warn("Failed to get load average") |
| 403 | return []float64{0, 0, 0} |
| 404 | } |
| 405 | |
| 406 | return []float64{loadAvg.Load1, loadAvg.Load5, loadAvg.Load15} |
| 407 | } |
| 408 | |
| 409 | // GetMachineID returns the system's machine ID using gopsutil |
| 410 | func (d *Detector) GetMachineID() string { |