chore: refactor the imports (#2406)

This commit is contained in:
Kevin Wan
2022-09-17 20:06:23 +08:00
committed by GitHub
parent ae7f1aabdd
commit 1f6688e5c1
9 changed files with 8 additions and 18 deletions

View File

@@ -57,7 +57,7 @@ func (h hook) AfterProcess(ctx context.Context, cmd red.Cmder) error {
}
metricReqDur.Observe(int64(duration/time.Millisecond), cmd.Name())
if msg := errFormat(err); len(msg) > 0 {
if msg := formatError(err); len(msg) > 0 {
metricReqErr.Inc(cmd.Name(), msg)
}
@@ -104,14 +104,14 @@ func (h hook) AfterProcessPipeline(ctx context.Context, cmds []red.Cmder) error
}
metricReqDur.Observe(int64(duration/time.Millisecond), "Pipeline")
if msg := errFormat(batchError.Err()); len(msg) > 0 {
if msg := formatError(batchError.Err()); len(msg) > 0 {
metricReqErr.Inc("Pipeline", msg)
}
return nil
}
func errFormat(err error) string {
func formatError(err error) string {
if err == nil || err == red.Nil {
return ""
}