Skip to content

Commit

Permalink
Add driver.docker counter metric for OOM Killer events
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus Vazquez committed Apr 19, 2018
1 parent a516dcd commit 3010cca
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
shelpers "github.com/hashicorp/nomad/helper/stats"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/mitchellh/mapstructure"
"github.com/armon/go-metrics"
)

var (
Expand Down Expand Up @@ -1924,6 +1925,22 @@ func (h *DockerHandle) run() {
h.logger.Printf("[ERR] driver.docker: failed to inspect container %s: %v", h.containerID, ierr)
} else if container.State.OOMKilled {
werr = fmt.Errorf("OOM Killed")
labels := []metrics.Label {
{
Name: "Image",
Value: h.Image,
},
{
Name: "ImageID",
Value: h.ImageID,
},
{
Name: "ContainerID",
Value: h.containerID,
},

}
metrics.IncrCounterWithLabels([]string{"driver", "docker","oom"},1,labels)
}

close(h.doneCh)
Expand Down

0 comments on commit 3010cca

Please sign in to comment.