fix(redisotel): correct metrics.DialHook attrs (#2331)

This commit is contained in:
Scott 2022-12-23 04:40:07 -08:00 committed by GitHub
parent f70c952806
commit 7c4b924350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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
}
}