diff options
author | Igor Wiedler <iwiedler@gitlab.com> | 2022-04-19 10:44:34 +0300 |
---|---|---|
committer | Igor Wiedler <iwiedler@gitlab.com> | 2022-04-19 10:44:34 +0300 |
commit | 42a35ccb01806ef6b26cd1b43b0e203b03d6d259 (patch) | |
tree | 77fe1e74964420a756a7b91ebd2ed3aaa4f2b076 | |
parent | fa2d37aadad24b730c4d85caf43465864b8e1a5d (diff) |
Remove feature flag "command_stats_metrics", always enable featurecommand-stats-metrics-enable-default
-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 85178d995..4ca45a9e8 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" ) @@ -454,22 +453,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) |