From 0a6eaed50b83a35a687699aa5e871b80605c9f46 Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Thu, 22 Apr 2021 16:04:40 -0700 Subject: Add weirdness sentry metric. Weirdness metric contains fields to track the number of clock fallback, partial result and vsyscalls. This metric will avoid the overhead of having three different metrics (fallbackMetric, partialResultMetric, vsyscallCount). PiperOrigin-RevId: 369970218 --- pkg/metric/metric.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pkg/metric') diff --git a/pkg/metric/metric.go b/pkg/metric/metric.go index 2a2f0d611..c23a1b52c 100644 --- a/pkg/metric/metric.go +++ b/pkg/metric/metric.go @@ -35,6 +35,11 @@ var ( // ErrInitializationDone indicates that the caller tried to create a // new metric after initialization. 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 + // vsyscall count. + WeirdnessMetric *Uint64Metric ) // Uint64Metric encapsulates a uint64 that represents some kind of metric to be @@ -380,3 +385,16 @@ func EmitMetricUpdate() { eventchannel.Emit(&m) } + +// CreateSentryMetrics creates the sentry metrics during kernel initialization. +func CreateSentryMetrics() { + if WeirdnessMetric != nil { + return + } + + WeirdnessMetric = MustCreateNewUint64Metric("/weirdness", true /* sync */, "Increment for weird occurrences of problems such as clock fallback, partial result and vsyscalls invoked in the sandbox", + Field{ + name: "weirdness_type", + allowedValues: []string{"fallback", "partial_result", "vsyscall_count"}, + }) +} -- cgit v1.2.3