Skip to content

Commit 7acc0cd

Browse files
taytzehaotzehaooofekshenawa
authored
useTime duration calculation (#2651)
Co-authored-by: tzehaoo <[email protected]> Co-authored-by: ofekshenawa <[email protected]>
1 parent e8ad794 commit 7acc0cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: extra/redisotel/metrics.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ func (mh *metricsHook) DialHook(hook redis.DialHook) redis.DialHook {
193193

194194
conn, err := hook(ctx, network, addr)
195195

196+
dur := time.Since(start)
197+
196198
attrs := make([]attribute.KeyValue, 0, len(mh.attrs)+1)
197199
attrs = append(attrs, mh.attrs...)
198200
attrs = append(attrs, statusAttr(err))
199201

200-
mh.createTime.Record(ctx, milliseconds(time.Since(start)), metric.WithAttributes(attrs...))
202+
mh.createTime.Record(ctx, milliseconds(dur), metric.WithAttributes(attrs...))
201203
return conn, err
202204
}
203205
}

0 commit comments

Comments
 (0)