mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Don't retrieve Driver Stats if unsupported
This PR makes us only try to collect stats once if the Driver doesn't support collecting stats. Fixes https://github.com/hashicorp/nomad/issues/1986
This commit is contained in:
@@ -1150,6 +1150,12 @@ func (r *TaskRunner) collectResourceUsageStats(stopCollection <-chan struct{}) {
|
||||
ru, err := r.handle.Stats()
|
||||
|
||||
if err != nil {
|
||||
// Check if the driver doesn't implement stats
|
||||
if err.Error() == driver.DriverStatsNotImplemented.Error() {
|
||||
r.logger.Printf("[DEBUG] client: driver for task %q in allocation %q doesn't support stats", r.task.Name, r.alloc.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// We do not log when the plugin is shutdown as this is simply a
|
||||
// race between the stopCollection channel being closed and calling
|
||||
// Stats on the handle.
|
||||
|
||||
Reference in New Issue
Block a user