Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Wiedler <iwiedler@gitlab.com>2020-11-16 14:42:20 +0300
committerIgor Wiedler <iwiedler@gitlab.com>2020-11-16 14:42:20 +0300
commitfacfb0893b0cb88ff66b2847ec6f190d6210ad50 (patch)
treebe4303854e1d5c638b64d59e9d622ae0837e3280
parent0a73f6a6724b0d9d51ec8603bdccd85ff443ade9 (diff)
switch time.Time.Seconds()*1000 to .Milliseconds()milliseconds
-rw-r--r--internal/command/command.go18
-rw-r--r--internal/command/spawntoken.go2
-rw-r--r--internal/middleware/limithandler/metrics.go2
-rw-r--r--internal/middleware/sentryhandler/sentryhandler.go2
4 files changed, 12 insertions, 12 deletions
diff --git a/internal/command/command.go b/internal/command/command.go
index de3a91f3c..58555fe7d 100644
--- a/internal/command/command.go
+++ b/internal/command/command.go
@@ -415,9 +415,9 @@ func (c *Command) logProcessComplete(ctx context.Context, exitCode int) {
"path": cmd.Path,
"args": cmd.Args,
"command.exitCode": exitCode,
- "command.system_time_ms": systemTime.Seconds() * 1000,
- "command.user_time_ms": userTime.Seconds() * 1000,
- "command.real_time_ms": realTime.Seconds() * 1000,
+ "command.system_time_ms": systemTime.Milliseconds(),
+ "command.user_time_ms": userTime.Milliseconds(),
+ "command.real_time_ms": realTime.Milliseconds(),
})
rusage, ok := cmd.ProcessState.SysUsage().(*syscall.Rusage)
@@ -435,9 +435,9 @@ func (c *Command) logProcessComplete(ctx context.Context, exitCode int) {
stats := StatsFromContext(ctx)
stats.RecordSum("command.count", 1)
- stats.RecordSum("command.system_time_ms", int(systemTime.Seconds()*1000))
- stats.RecordSum("command.user_time_ms", int(userTime.Seconds()*1000))
- stats.RecordSum("command.real_time_ms", int(realTime.Seconds()*1000))
+ stats.RecordSum("command.system_time_ms", int(systemTime.Milliseconds()))
+ stats.RecordSum("command.user_time_ms", int(userTime.Milliseconds()))
+ stats.RecordSum("command.real_time_ms", int(realTime.Milliseconds()))
if ok {
stats.RecordMax("command.maxrss", int(rusage.Maxrss))
@@ -451,9 +451,9 @@ func (c *Command) logProcessComplete(ctx context.Context, exitCode int) {
c.span.LogKV(
"pid", cmd.ProcessState.Pid(),
"exit_code", exitCode,
- "system_time_ms", int(systemTime.Seconds()*1000),
- "user_time_ms", int(userTime.Seconds()*1000),
- "real_time_ms", int(realTime.Seconds()*1000),
+ "system_time_ms", int(systemTime.Milliseconds()),
+ "user_time_ms", int(userTime.Milliseconds()),
+ "real_time_ms", int(realTime.Milliseconds()),
)
if ok {
c.span.LogKV(
diff --git a/internal/command/spawntoken.go b/internal/command/spawntoken.go
index 623d686d8..72ab0536d 100644
--- a/internal/command/spawntoken.go
+++ b/internal/command/spawntoken.go
@@ -80,5 +80,5 @@ func logTime(ctx context.Context, start time.Time, msg string) {
return
}
- ctxlogrus.Extract(ctx).WithField("spawn_queue_ms", delta.Seconds()*1000).Info(msg)
+ ctxlogrus.Extract(ctx).WithField("spawn_queue_ms", delta.Milliseconds()).Info(msg)
}
diff --git a/internal/middleware/limithandler/metrics.go b/internal/middleware/limithandler/metrics.go
index 78c628cb9..bc64ba3c6 100644
--- a/internal/middleware/limithandler/metrics.go
+++ b/internal/middleware/limithandler/metrics.go
@@ -83,7 +83,7 @@ func (c *promMonitor) Enter(ctx context.Context, acquireTime time.Duration) {
if acquireTime > acquireDurationLogThreshold {
logger := ctxlogrus.Extract(ctx)
- logger.WithField("acquire_ms", acquireTime.Seconds()*1000).Info("Rate limit acquire wait")
+ logger.WithField("acquire_ms", acquireTime.Milliseconds()).Info("Rate limit acquire wait")
}
if c.histogram != nil {
diff --git a/internal/middleware/sentryhandler/sentryhandler.go b/internal/middleware/sentryhandler/sentryhandler.go
index 7766e14c5..2466f4944 100644
--- a/internal/middleware/sentryhandler/sentryhandler.go
+++ b/internal/middleware/sentryhandler/sentryhandler.go
@@ -100,7 +100,7 @@ func generateSentryEvent(ctx context.Context, method string, start time.Time, er
for k, v := range map[string]string{
"grpc.code": grpcErrorCode.String(),
"grpc.method": method,
- "grpc.time_ms": fmt.Sprintf("%.0f", time.Since(start).Seconds()*1000),
+ "grpc.time_ms": fmt.Sprintf("%d", time.Since(start).Milliseconds()),
"system": "grpc",
} {
event.Tags[k] = v