Skip to content

Commit

Permalink
fix(agent/sensor): 🐛 don't add nonexistent agent workers to worker list
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jan 11, 2025
1 parent f6f32fd commit 3d35099
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ func Run(ctx context.Context) error {
// Initialize and gather OS sensor and event workers.
sensorWorkers, eventWorkers := setupOSWorkers(ctx)
// Initialize and add connection latency sensor worker.
sensorWorkers = append(sensorWorkers, agentsensor.NewConnectionLatencySensorWorker())
if worker := agentsensor.NewConnectionLatencySensorWorker(); worker != nil {
sensorWorkers = append(sensorWorkers, worker)
}
// Initialize and add external IP address sensor worker.
sensorWorkers = append(sensorWorkers, agentsensor.NewExternalIPUpdaterWorker(ctx))
if worker := agentsensor.NewExternalIPUpdaterWorker(ctx); worker != nil {
sensorWorkers = append(sensorWorkers, worker)
}
// Initialize and add external version sensor worker.
sensorWorkers = append(sensorWorkers, agentsensor.NewVersionWorker())
if worker := agentsensor.NewVersionWorker(); worker != nil {
sensorWorkers = append(sensorWorkers, worker)
}

// Initialize and add the script worker.
scriptsWorkers, err := scripts.NewScriptsWorker(ctx)
Expand Down

0 comments on commit 3d35099

Please sign in to comment.