Skip to content

Commit d310cd0

Browse files
committed
drop label
to be reintroduced later, for now it would require figuring out which arg is the actual command
1 parent 6e64232 commit d310cd0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

modules/git/command.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ var (
4141
// defaultCommandExecutionTimeout default command execution timeout duration
4242
defaultCommandExecutionTimeout = 360 * time.Second
4343

44-
reqInflightGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
44+
reqInflightGauge = promauto.NewGauge(prometheus.GaugeOpts{
4545
Namespace: "gitea",
4646
Subsystem: "git",
4747
Name: "active_commands",
4848
Help: "Number of active git subprocesses.",
49-
}, []string{gitOperation})
50-
// reqDurationHistogram tracks the time taken by http request
51-
reqDurationHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
49+
})
50+
// reqDurationHistogram tracks the time taken by git call
51+
reqDurationHistogram = promauto.NewHistogram(prometheus.HistogramOpts{
5252
Namespace: "gitea",
5353
Subsystem: "git",
5454
Name: "command_duration_seconds", // diverge from spec to store the unit in metric.
5555
Help: "Measures the time taken by git subprocesses",
5656
Buckets: []float64{0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300}, // based on dotnet buckets https://github.com/open-telemetry/semantic-conventions/issues/336
57-
}, []string{gitOperation})
57+
})
5858
)
5959

6060
// DefaultLocale is the default LC_ALL to run git commands in.
@@ -335,7 +335,7 @@ func (c *Command) run(ctx context.Context, skip int, opts *RunOpts) error {
335335
desc := fmt.Sprintf("git.Run(by:%s, repo:%s): %s", callerInfo, logArgSanitize(opts.Dir), cmdLogString)
336336
log.Debug("git.Command: %s", desc)
337337

338-
inflight := reqInflightGauge.WithLabelValues(c.args[0]) // add command type
338+
inflight := reqInflightGauge // add command type
339339
inflight.Inc()
340340
defer inflight.Dec()
341341

@@ -388,7 +388,7 @@ func (c *Command) run(ctx context.Context, skip int, opts *RunOpts) error {
388388
if elapsed > time.Second {
389389
log.Debug("slow git.Command.Run: %s (%s)", c, elapsed)
390390
}
391-
reqDurationHistogram.WithLabelValues(c.args[0]).Observe(elapsed.Seconds())
391+
reqDurationHistogram.Observe(elapsed.Seconds())
392392

393393
// We need to check if the context is canceled by the program on Windows.
394394
// This is because Windows does not have signal checking when terminating the process.

0 commit comments

Comments
 (0)