diff --git a/pkg/sentry/seccheck/BUILD b/pkg/sentry/seccheck/BUILD index 8c66bf19c..c772c4b0c 100644 --- a/pkg/sentry/seccheck/BUILD +++ b/pkg/sentry/seccheck/BUILD @@ -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", diff --git a/pkg/sentry/seccheck/config.go b/pkg/sentry/seccheck/config.go index 4e688f4e1..56c071edf 100644 --- a/pkg/sentry/seccheck/config.go +++ b/pkg/sentry/seccheck/config.go @@ -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 }