Report number of trace sessions created metric

PiperOrigin-RevId: 526157216
This commit is contained in:
Fabricio Voznika
2023-04-21 15:56:12 -07:00
committed by gVisor bot
parent df1f4cbd9f
commit 0ce094b9a3
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -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",
+4
View File
@@ -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
}