-
Notifications
You must be signed in to change notification settings - Fork 46
/
metrics.go
67 lines (63 loc) · 1.77 KB
/
metrics.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package controllers
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"sigs.k8s.io/controller-runtime/pkg/metrics"
)
const (
ActiveServerStatus = "active"
StandingByServerStatus = "standingby"
InitializingServerStatus = "initializing"
PendingServerStatus = "pending"
)
var (
registry = promauto.With(metrics.Registry)
GameServersCreatedCounter = registry.NewCounterVec(
prometheus.CounterOpts{
Namespace: "thundernetes",
Name: "gameservers_created_total",
Help: "Number of GameServers created",
},
[]string{"BuildName"},
)
GameServersSessionEndedCounter = registry.NewCounterVec(
prometheus.CounterOpts{
Namespace: "thundernetes",
Name: "gameservers_sessionended_total",
Help: "Number of GameServer sessions ended",
},
[]string{"BuildName"},
)
GameServersCrashedCounter = registry.NewCounterVec(
prometheus.CounterOpts{
Namespace: "thundernetes",
Name: "gameservers_crashed_total",
Help: "Number of GameServers sessions crashed",
},
[]string{"BuildName"},
)
GameServersDeletedCounter = registry.NewCounterVec(
prometheus.CounterOpts{
Namespace: "thundernetes",
Name: "gameservers_deleted_total",
Help: "Number of GameServers deleted",
},
[]string{"BuildName"},
)
CurrentGameServerGauge = registry.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "thundernetes",
Name: "gameservers_current_state",
Help: "Gameserver gauges by state",
},
[]string{"BuildName", "state"},
)
AllocationsCounter = registry.NewCounterVec(
prometheus.CounterOpts{
Namespace: "thundernetes",
Name: "allocations_total",
Help: "Number of GameServers allocations",
},
[]string{"BuildName"},
)
)