mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Report number of trace sessions created metric
PiperOrigin-RevId: 526157216
This commit is contained in:
committed by
gVisor bot
parent
df1f4cbd9f
commit
0ce094b9a3
@@ -35,6 +35,7 @@ go_library(
|
||||
"//pkg/fd",
|
||||
"//pkg/gohacks",
|
||||
"//pkg/log",
|
||||
"//pkg/metric",
|
||||
"//pkg/sentry/arch",
|
||||
"//pkg/sentry/kernel/time",
|
||||
"//pkg/sentry/seccheck/points:points_go_proto",
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
"gvisor.dev/gvisor/pkg/fd"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/metric"
|
||||
)
|
||||
|
||||
// DefaultSessionName is the name of the only session that can exist in the
|
||||
@@ -32,6 +33,8 @@ var (
|
||||
sessions = make(map[string]*State)
|
||||
)
|
||||
|
||||
var sessionCounter = metric.MustCreateNewUint64Metric("/trace/sessions_created", false /* sync */, "Counts the number of trace sessions created.")
|
||||
|
||||
// SessionConfig describes a new session configuration. A session consists of a
|
||||
// set of points to be enabled and sinks where the points are sent to.
|
||||
type SessionConfig struct {
|
||||
@@ -136,6 +139,7 @@ func Create(conf *SessionConfig, force bool) error {
|
||||
}
|
||||
|
||||
sessions[conf.Name] = state
|
||||
sessionCounter.Increment()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user