2023-05-10 09:24:05 +02:00
|
|
|
package hscontrol
|
2021-10-04 16:28:07 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
2024-05-24 09:15:34 +01:00
|
|
|
"tailscale.com/envknob"
|
2021-10-04 16:28:07 +00:00
|
|
|
)
|
|
|
|
|
|
2024-05-24 09:15:34 +01:00
|
|
|
var debugHighCardinalityMetrics = envknob.Bool("HEADSCALE_DEBUG_HIGH_CARDINALITY_METRICS")
|
|
|
|
|
|
|
|
|
|
var mapResponseLastSentSeconds *prometheus.GaugeVec
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
if debugHighCardinalityMetrics {
|
|
|
|
|
mapResponseLastSentSeconds = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
|
|
|
|
Namespace: prometheusNamespace,
|
|
|
|
|
Name: "mapresponse_last_sent_seconds",
|
|
|
|
|
Help: "last sent metric to node.id",
|
|
|
|
|
}, []string{"type", "id"})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-04 16:28:07 +00:00
|
|
|
const prometheusNamespace = "headscale"
|
|
|
|
|
|
|
|
|
|
var (
|
2024-04-21 18:28:17 +02:00
|
|
|
mapResponseSent = promauto.NewCounterVec(prometheus.CounterOpts{
|
2021-10-04 16:28:07 +00:00
|
|
|
Namespace: prometheusNamespace,
|
2024-04-21 18:28:17 +02:00
|
|
|
Name: "mapresponse_sent_total",
|
|
|
|
|
Help: "total count of mapresponses sent to clients",
|
|
|
|
|
}, []string{"status", "type"})
|
|
|
|
|
mapResponseEndpointUpdates = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
|
|
|
Namespace: prometheusNamespace,
|
|
|
|
|
Name: "mapresponse_endpoint_updates_total",
|
|
|
|
|
Help: "total count of endpoint updates received",
|
|
|
|
|
}, []string{"status"})
|
2024-05-24 09:15:34 +01:00
|
|
|
mapResponseEnded = promauto.NewCounterVec(prometheus.CounterOpts{
|
2024-04-21 18:28:17 +02:00
|
|
|
Namespace: prometheusNamespace,
|
2024-05-24 09:15:34 +01:00
|
|
|
Name: "mapresponse_ended_total",
|
|
|
|
|
Help: "total count of new mapsessions ended",
|
2024-04-21 18:28:17 +02:00
|
|
|
}, []string{"reason"})
|
2021-10-04 16:28:07 +00:00
|
|
|
)
|