diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-29 14:00:41 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-04-29 14:00:41 +0300 |
commit | 364005ad128cce1d8e33d904daaef93acccdda46 (patch) | |
tree | 0fda25011e3206ce3302de1554877409b1ebb531 | |
parent | 2f53e4a59cfd71af097752c71ca8dcb5f6dcc56b (diff) | |
parent | 42a35ccb01806ef6b26cd1b43b0e203b03d6d259 (diff) |
Merge branch 'command-stats-metrics-enable-default' into 'master'
Remove feature flag "command_stats_metrics", always enable feature
See merge request gitlab-org/gitaly!4484
-rw-r--r-- | internal/command/command.go | 31 | ||||
-rw-r--r-- | internal/metadata/featureflag/ff_command_stats_metrics.go | 4 | ||||
-rw-r--r-- | internal/testhelper/testhelper.go | 3 |
3 files changed, 14 insertions, 24 deletions
diff --git a/internal/command/command.go b/internal/command/command.go index 6bd7c9856..283ee3d9f 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -20,7 +20,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/v14/internal/command/commandcounter" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/labkit/tracing" ) @@ -472,22 +471,20 @@ func (c *Command) logProcessComplete() { } } - if featureflag.CommandStatsMetrics.IsEnabled(ctx) { - service, method := methodFromContext(ctx) - cmdName := path.Base(c.cmd.Path) - if c.metricsCmd != "" { - cmdName = c.metricsCmd - } - cpuSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "system").Add(systemTime.Seconds()) - cpuSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "user").Add(userTime.Seconds()) - realSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(realTime.Seconds()) - if ok { - minorPageFaultsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Minflt)) - majorPageFaultsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Majflt)) - signalsReceivedTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Nsignals)) - contextSwitchesTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "voluntary").Add(float64(rusage.Nvcsw)) - contextSwitchesTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "nonvoluntary").Add(float64(rusage.Nivcsw)) - } + service, method := methodFromContext(ctx) + cmdName := path.Base(c.cmd.Path) + if c.metricsCmd != "" { + cmdName = c.metricsCmd + } + cpuSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "system").Add(systemTime.Seconds()) + cpuSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "user").Add(userTime.Seconds()) + realSecondsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(realTime.Seconds()) + if ok { + minorPageFaultsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Minflt)) + majorPageFaultsTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Majflt)) + signalsReceivedTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd).Add(float64(rusage.Nsignals)) + contextSwitchesTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "voluntary").Add(float64(rusage.Nvcsw)) + contextSwitchesTotal.WithLabelValues(service, method, cmdName, c.metricsSubCmd, "nonvoluntary").Add(float64(rusage.Nivcsw)) } c.span.LogKV( diff --git a/internal/metadata/featureflag/ff_command_stats_metrics.go b/internal/metadata/featureflag/ff_command_stats_metrics.go deleted file mode 100644 index a11206c52..000000000 --- a/internal/metadata/featureflag/ff_command_stats_metrics.go +++ /dev/null @@ -1,4 +0,0 @@ -package featureflag - -// CommandStatsMetrics tracks additional prometheus metrics for each shelled out command -var CommandStatsMetrics = NewFeatureFlag("command_stats_metrics", false) diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index f723aaf19..2e780398b 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -174,9 +174,6 @@ func ContextWithoutCancel(opts ...ContextOpt) context.Context { // ConcurrencyQueueMaxWait is in the codepath of every RPC call since it's in the limithandler // middleware. ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.ConcurrencyQueueMaxWait, true) - // CommandStatsMetrics is checked on every shelled out command, which may happen outside of - // RPC context. - ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.CommandStatsMetrics, true) for _, opt := range opts { ctx = opt(ctx) |