mirror of
https://github.com/juanfont/headscale.git
synced 2026-05-24 02:58:42 +09:00
Two cleanups in the same package boundary:
policy/v2.Policy.compileFilterRules and compileFilterRulesForNode
returned (rules, error) where the error was always nil. Drop the
error return and the dead error handling at 15 call sites in the
compat tests.
Delete code with no callers:
hscontrol/metrics.go
prometheusMiddleware + respWriterProm — custom HTTP timer
middleware that was never registered. /metrics stays mounted
via debug.go and noise.go; mapresponse_* counters keep emitting.
httpDuration and httpCounter — backing metrics for the deleted
middleware.
hscontrol/policy/v2/filter.go
resolvedAddrsToPrincipals — superseded by ipSetToPrincipals.
ipSetToPrefixStringList — superseded by inline prefix
formatting at the surviving callers.
hscontrol/policy/v2/tailscale_{acl,grants}_data_compat_test.go
setupACLCompatNodes / setupGrantsCompatNodes — the data-driven
tests switched to per-scenario topology reconstruction.
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package hscontrol
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
"tailscale.com/envknob"
|
|
)
|
|
|
|
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"})
|
|
}
|
|
}
|
|
|
|
const prometheusNamespace = "headscale"
|
|
|
|
var (
|
|
mapResponseSent = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
Namespace: prometheusNamespace,
|
|
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"})
|
|
mapResponseEnded = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
Namespace: prometheusNamespace,
|
|
Name: "mapresponse_ended_total",
|
|
Help: "total count of new mapsessions ended",
|
|
}, []string{"reason"})
|
|
)
|