2021-10-04 18:28:07 +02:00
|
|
|
package headscale
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
|
|
)
|
|
|
|
|
|
|
|
const prometheusNamespace = "headscale"
|
|
|
|
|
|
|
|
var (
|
2023-05-01 16:52:03 +02:00
|
|
|
// This is a high cardinality metric (user x nodes), we might want to make this
|
2021-10-04 18:28:07 +02:00
|
|
|
// configurable/opt-in in the future.
|
|
|
|
lastStateUpdate = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
|
|
|
Namespace: prometheusNamespace,
|
|
|
|
Name: "last_update_seconds",
|
2023-05-01 16:52:03 +02:00
|
|
|
Help: "Time stamp in unix time when a node or headscale was updated",
|
|
|
|
}, []string{"user", "nodes"})
|
2021-10-04 18:28:07 +02:00
|
|
|
|
2023-05-01 16:52:03 +02:00
|
|
|
nodeRegistrations = promauto.NewCounterVec(prometheus.CounterOpts{
|
2021-10-04 18:28:07 +02:00
|
|
|
Namespace: prometheusNamespace,
|
2023-05-01 16:52:03 +02:00
|
|
|
Name: "node_registrations_total",
|
|
|
|
Help: "The total amount of registered node attempts",
|
2023-01-17 17:43:44 +01:00
|
|
|
}, []string{"action", "auth", "status", "user"})
|
2021-10-04 18:28:07 +02:00
|
|
|
|
|
|
|
updateRequestsFromNode = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
|
|
Namespace: prometheusNamespace,
|
|
|
|
Name: "update_request_from_node_total",
|
|
|
|
Help: "The number of updates requested by a node/update function",
|
2023-05-01 16:52:03 +02:00
|
|
|
}, []string{"user", "node", "state"})
|
2021-10-05 23:59:15 +02:00
|
|
|
updateRequestsSentToNode = promauto.NewCounterVec(prometheus.CounterOpts{
|
2021-10-04 18:28:07 +02:00
|
|
|
Namespace: prometheusNamespace,
|
2021-10-05 23:59:15 +02:00
|
|
|
Name: "update_request_sent_to_node_total",
|
2021-10-04 18:28:07 +02:00
|
|
|
Help: "The number of calls/messages issued on a specific nodes update channel",
|
2023-05-01 16:52:03 +02:00
|
|
|
}, []string{"user", "node", "status"})
|
2021-11-13 09:36:45 +01:00
|
|
|
// TODO(kradalby): This is very debugging, we might want to remove it.
|
2021-10-04 18:28:07 +02:00
|
|
|
updateRequestsReceivedOnChannel = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
|
|
Namespace: prometheusNamespace,
|
|
|
|
Name: "update_request_received_on_channel_total",
|
|
|
|
Help: "The number of update requests received on an update channel",
|
2023-05-01 16:52:03 +02:00
|
|
|
}, []string{"user", "node"})
|
2021-10-04 18:28:07 +02:00
|
|
|
)
|