From 7c4b92435024eef4429a30146fad28ec98085c5b Mon Sep 17 00:00:00 2001 From: Scott <118764248+scott20315@users.noreply.github.com> Date: Fri, 23 Dec 2022 04:40:07 -0800 Subject: [PATCH] fix(redisotel): correct metrics.DialHook attrs (#2331) --- extra/redisotel/metrics.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extra/redisotel/metrics.go b/extra/redisotel/metrics.go index 76f545b8..b41417b6 100644 --- a/extra/redisotel/metrics.go +++ b/extra/redisotel/metrics.go @@ -193,7 +193,11 @@ func (mh *metricsHook) DialHook(hook redis.DialHook) redis.DialHook { conn, err := hook(ctx, network, addr) - mh.createTime.Record(ctx, milliseconds(time.Since(start)), mh.attrs...) + 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)), attrs...) return conn, err } }