File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,15 @@ import (
8
8
"github.com/factorysh/microdensity/task"
9
9
"github.com/factorysh/microdensity/volumes"
10
10
"github.com/google/uuid"
11
+ "github.com/prometheus/client_golang/prometheus"
12
+ "github.com/prometheus/client_golang/prometheus/promauto"
13
+ )
14
+
15
+ var (
16
+ serviceRun = promauto .NewCounterVec (prometheus.CounterOpts {
17
+ Name : "run_total" ,
18
+ Help : "Total tasks run" ,
19
+ }, []string {"service" , "project" })
11
20
)
12
21
13
22
// Context is a run context, with a STDOUT and a STDERR
@@ -86,6 +95,8 @@ func (r *Runner) Run(t *task.Task) (int, error) {
86
95
if ! found {
87
96
return 0 , fmt .Errorf ("task with id `%s` not found in runner" , t .Id )
88
97
}
89
-
98
+ defer serviceRun .With (prometheus.Labels {
99
+ "service" : t .Service ,
100
+ "project" : t .Project }).Inc ()
90
101
return ctx .run .Run (ctx .Stdout , ctx .Stderr )
91
102
}
You can’t perform that action at this time.
0 commit comments