Skip to content

Commit

Permalink
add durationSeconds to error log
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhengl committed Oct 24, 2024
1 parent 31a960a commit 24fdc84
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/zoekt-sourcegraph-indexserver/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ func (s *Server) merge(mergeCmd func(args ...string) *exec.Cmd) {

err := cmd.Run()

metricShardMergingDuration.WithLabelValues(strconv.FormatBool(err != nil)).Observe(time.Since(start).Seconds())
durationSeconds := time.Since(start).Seconds()
metricShardMergingDuration.WithLabelValues(strconv.FormatBool(err != nil)).Observe(durationSeconds)
if err != nil {
log.Printf("error merging shards: stdout=%s, stderr=%s, err=%s", stdoutBuf.String(), stderrBuf.String(), err)
log.Printf("error merging shards: stdout=%s, stderr=%s, durationSeconds=%.2f err=%s", stdoutBuf.String(), stderrBuf.String(), durationSeconds, err)
return
}

log.Printf("finished merging: shard=%s durationSeconds=%.2f", stdoutBuf.String(), time.Since(start).Seconds())
log.Printf("finished merging: shard=%s durationSeconds=%.2f", stdoutBuf.String(), durationSeconds)

next = true
})
Expand Down

0 comments on commit 24fdc84

Please sign in to comment.