package sessionmetrics import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ) type Operation string const ( Validation Operation = "validation" CurrentLogout Operation = "current_logout" AllLogout Operation = "all_logout" ) type Outcome string const ( Active Outcome = "active" Succeeded Outcome = "succeeded" AlreadyInactive Outcome = "already_inactive" MissingIdentity Outcome = "missing_identity" StorageError Outcome = "storage_error" ) var lifecycle = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "sendico", Subsystem: "auth", Name: "session_lifecycle_total", Help: "Session validation and logout outcomes.", }, []string{"operation", "outcome"}) func Observe(operation Operation, outcome Outcome) { lifecycle.WithLabelValues(string(operation), string(outcome)).Inc() }