From 8ca21d2600f6cab552d22055cc9fd067f2d49d68 Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Tue, 21 Oct 2025 13:56:06 +0200 Subject: [PATCH 1/2] chore(redisotel): use metric.WithAttributeSet to avoid copy (#3552) In order to improve performance replace `WithAttributes` with `WithAttributeSet`. This avoids the slice allocation and copy that is done in `WithAttributes`. For more information see https://github.com/open-telemetry/opentelemetry-go/blob/v1.38.0/metric/instrument.go#L357-L376 --- extra/redisotel/metrics.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/redisotel/metrics.go b/extra/redisotel/metrics.go index 3a3c96a3..7fe55452 100644 --- a/extra/redisotel/metrics.go +++ b/extra/redisotel/metrics.go @@ -275,7 +275,7 @@ func (mh *metricsHook) DialHook(hook redis.DialHook) redis.DialHook { attrs = append(attrs, mh.attrs...) attrs = append(attrs, statusAttr(err)) - mh.createTime.Record(ctx, milliseconds(dur), metric.WithAttributes(attrs...)) + mh.createTime.Record(ctx, milliseconds(dur), metric.WithAttributeSet(attribute.NewSet(attrs...))) return conn, err } } @@ -293,7 +293,7 @@ func (mh *metricsHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook { attrs = append(attrs, attribute.String("type", "command")) attrs = append(attrs, statusAttr(err)) - mh.useTime.Record(ctx, milliseconds(dur), metric.WithAttributes(attrs...)) + mh.useTime.Record(ctx, milliseconds(dur), metric.WithAttributeSet(attribute.NewSet(attrs...))) return err } @@ -314,7 +314,7 @@ func (mh *metricsHook) ProcessPipelineHook( attrs = append(attrs, attribute.String("type", "pipeline")) attrs = append(attrs, statusAttr(err)) - mh.useTime.Record(ctx, milliseconds(dur), metric.WithAttributes(attrs...)) + mh.useTime.Record(ctx, milliseconds(dur), metric.WithAttributeSet(attribute.NewSet(attrs...))) return err } From 14a88145407e75dbff07471afe7fead8ea26a0cf Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 21 Oct 2025 17:33:58 +0530 Subject: [PATCH 2/2] chore(docs): explain why MaxRetries is disabled for ClusterClient (#3551) Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com> --- osscluster.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osscluster.go b/osscluster.go index f32d9063..7925d2c6 100644 --- a/osscluster.go +++ b/osscluster.go @@ -77,6 +77,10 @@ type ClusterOptions struct { CredentialsProviderContext func(ctx context.Context) (username string, password string, err error) StreamingCredentialsProvider auth.StreamingCredentialsProvider + // MaxRetries is the maximum number of retries before giving up. + // For ClusterClient, retries are disabled by default (set to -1), + // because the cluster client handles all kinds of retries internally. + // This is intentional and differs from the standalone Options default. MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration