diff options
author | Nayana Bidari <nybidari@google.com> | 2021-04-26 17:35:16 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-26 17:37:29 -0700 |
commit | 5b207fe7834d9c6541bd99bf75e3dfeebce2d9d5 (patch) | |
tree | 7783dbac4f1189e065412745701724336527b79a | |
parent | 509f5aa57fa079d113411f10fc26d9f8432ec511 (diff) |
Remove metrics: fallback, vsyscallCount and partialResult
The newly added Weirdness metric with fields should be used instead of them.
Simple query for weirdness metric: http://shortn/_DGNk0z2Up6
PiperOrigin-RevId: 370578132
-rw-r--r-- | pkg/metric/metric.go | 6 | ||||
-rw-r--r-- | pkg/sentry/kernel/task_syscall.go | 3 | ||||
-rw-r--r-- | pkg/sentry/syscalls/linux/error.go | 4 | ||||
-rw-r--r-- | pkg/sentry/time/calibrated_clock.go | 8 |
4 files changed, 5 insertions, 16 deletions
diff --git a/pkg/metric/metric.go b/pkg/metric/metric.go index c23a1b52c..e822fe77d 100644 --- a/pkg/metric/metric.go +++ b/pkg/metric/metric.go @@ -37,7 +37,7 @@ var ( ErrInitializationDone = errors.New("metric cannot be created after initialization is complete") // WeirdnessMetric is a metric with fields created to track the number - // of weird occurrences such as clock fallback, partial_result and + // of weird occurrences such as time fallback, partial_result and // vsyscall count. WeirdnessMetric *Uint64Metric ) @@ -392,9 +392,9 @@ func CreateSentryMetrics() { return } - WeirdnessMetric = MustCreateNewUint64Metric("/weirdness", true /* sync */, "Increment for weird occurrences of problems such as clock fallback, partial result and vsyscalls invoked in the sandbox", + WeirdnessMetric = MustCreateNewUint64Metric("/weirdness", true /* sync */, "Increment for weird occurrences of problems such as time fallback, partial result and vsyscalls invoked in the sandbox", Field{ name: "weirdness_type", - allowedValues: []string{"fallback", "partial_result", "vsyscall_count"}, + allowedValues: []string{"time_fallback", "partial_result", "vsyscall_count"}, }) } diff --git a/pkg/sentry/kernel/task_syscall.go b/pkg/sentry/kernel/task_syscall.go index 36855e3ec..601fc0d3a 100644 --- a/pkg/sentry/kernel/task_syscall.go +++ b/pkg/sentry/kernel/task_syscall.go @@ -30,8 +30,6 @@ import ( "gvisor.dev/gvisor/pkg/syserror" ) -var vsyscallCount = metric.MustCreateNewUint64Metric("/kernel/vsyscall_count", false /* sync */, "Number of times vsyscalls were invoked by the application") - // SyscallRestartBlock represents the restart block for a syscall restartable // with a custom function. It encapsulates the state required to restart a // syscall across a S/R. @@ -284,7 +282,6 @@ func (*runSyscallExit) execute(t *Task) taskRunState { // indicated by an execution fault at address addr. doVsyscall returns the // task's next run state. func (t *Task) doVsyscall(addr hostarch.Addr, sysno uintptr) taskRunState { - vsyscallCount.Increment() metric.WeirdnessMetric.Increment("vsyscall_count") // Grab the caller up front, to make sure there's a sensible stack. diff --git a/pkg/sentry/syscalls/linux/error.go b/pkg/sentry/syscalls/linux/error.go index c668e81ac..6eabfd219 100644 --- a/pkg/sentry/syscalls/linux/error.go +++ b/pkg/sentry/syscalls/linux/error.go @@ -29,8 +29,7 @@ import ( ) var ( - partialResultMetric = metric.MustCreateNewUint64Metric("/syscalls/partial_result", true /* sync */, "Whether or not a partial result has occurred for this sandbox.") - partialResultOnce sync.Once + partialResultOnce sync.Once ) // incrementPartialResultMetric increments PartialResultMetric by calling @@ -38,7 +37,6 @@ var ( // us to pass a function which does not take any arguments, whereas Increment() // takes a variadic number of arguments. func incrementPartialResultMetric() { - partialResultMetric.Increment() metric.WeirdnessMetric.Increment("partial_result") } diff --git a/pkg/sentry/time/calibrated_clock.go b/pkg/sentry/time/calibrated_clock.go index 94f98d746..39bf1e0de 100644 --- a/pkg/sentry/time/calibrated_clock.go +++ b/pkg/sentry/time/calibrated_clock.go @@ -25,11 +25,6 @@ import ( "gvisor.dev/gvisor/pkg/syserror" ) -// fallbackMetric tracks failed updates. It is not sync, as it is not critical -// that all occurrences are captured and CalibratedClock may fallback many -// times. -var fallbackMetric = metric.MustCreateNewUint64Metric("/time/fallback", false /* sync */, "Incremented when a clock falls back to system calls due to a failed update") - // CalibratedClock implements a clock that tracks a reference clock. // // Users should call Update at regular intervals of around approxUpdateInterval @@ -102,8 +97,7 @@ func (c *CalibratedClock) resetLocked(str string, v ...interface{}) { c.Warningf(str+" Resetting clock; time may jump.", v...) c.ready = false c.ref.Reset() - fallbackMetric.Increment() - metric.WeirdnessMetric.Increment("fallback") + metric.WeirdnessMetric.Increment("time_fallback") } // updateParams updates the timekeeping parameters based on the passed |