Skip to content

Commit

Permalink
useTime duration calculation (#2651)
Browse files Browse the repository at this point in the history
Co-authored-by: tzehaoo <[email protected]>
Co-authored-by: ofekshenawa <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent e8ad794 commit 7acc0cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extra/redisotel/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ func (mh *metricsHook) DialHook(hook redis.DialHook) redis.DialHook {

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

dur := time.Since(start)

attrs := make([]attribute.KeyValue, 0, len(mh.attrs)+1)
attrs = append(attrs, mh.attrs...)
attrs = append(attrs, statusAttr(err))

mh.createTime.Record(ctx, milliseconds(time.Since(start)), metric.WithAttributes(attrs...))
mh.createTime.Record(ctx, milliseconds(dur), metric.WithAttributes(attrs...))
return conn, err
}
}
Expand Down

0 comments on commit 7acc0cd

Please sign in to comment.