forked from draganm/missing-container-metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprometheus.go
43 lines (37 loc) · 890 Bytes
/
prometheus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import "github.com/prometheus/client_golang/prometheus"
var labelNames = []string{
// "container_id",
// "container_short_id",
// "docker_container_id",
"name",
// "image_id",
"pod",
"namespace",
}
var containerRestarts = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "container_restarts",
Help: "Number of restarts of a docker container",
},
labelNames,
)
var containerOOMs = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "container_ooms",
Help: "Number of OOM kills of a docker container",
},
labelNames,
)
var containerLastExitCode = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "container_last_exit_code",
Help: "Last exit code of the container",
},
labelNames,
)
func init() {
prometheus.MustRegister(containerRestarts)
prometheus.MustRegister(containerOOMs)
prometheus.MustRegister(containerLastExitCode)
}