go-redis/redis · error

failed to create connection relaxed timeout metric: %w

Error message

failed to create connection relaxed timeout metric: %w

What it means

Returned by createRecorder (redisotel.go:233) when meter.Int64UpDownCounter fails to create the 'redis.client.connection.relaxed_timeout' instrument. Only checked when MetricGroupConnectionBasic is enabled.

Source

Thrown at extra/redisotel-native/redisotel.go:233

		if cfg.histAggregation == HistogramAggregationExplicitBucket {
			connectionCreateTimeOpts = append(connectionCreateTimeOpts,
				metric.WithExplicitBucketBoundaries(cfg.bucketsConnectionCreateTime...),
			)
		}
		var connectionCreateTimeConv dbconv.ClientConnectionCreateTime
		connectionCreateTimeConv, err = dbconv.NewClientConnectionCreateTime(meter, connectionCreateTimeOpts...)
		if err != nil {
			return nil, fmt.Errorf("failed to create connection create time histogram: %w", err)
		}
		connectionCreateTime = connectionCreateTimeConv.Inst()

		connectionRelaxedTimeout, err = meter.Int64UpDownCounter(
			MetricConnectionRelaxedTimeout,
			metric.WithDescription("How many times the connection timeout has been increased/decreased (after a server maintenance notification)"),
			metric.WithUnit("{relaxation}"),
		)
		if err != nil {
			return nil, fmt.Errorf("failed to create connection relaxed timeout metric: %w", err)
		}

		connectionHandoff, err = meter.Int64Counter(
			MetricConnectionHandoff,
			metric.WithDescription("Connections that have been handed off to another node (e.g after a MOVING notification)"),
		)
		if err != nil {
			return nil, fmt.Errorf("failed to create connection handoff metric: %w", err)
		}
	}

	var clientErrors metric.Int64Counter
	var maintenanceNotifications metric.Int64Counter

	if cfg.isMetricGroupEnabled(MetricGroupResiliency) {
		clientErrors, err = meter.Int64Counter(
			MetricClientErrors,
			metric.WithDescription("Number of errors handled by the Redis client"),

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Reconcile any other registration of 'redis.client.connection.relaxed_timeout' so instrument type and metadata match
  2. Ensure no conflicting redisotel versions are imported transitively
  3. Verify the MeterProvider is functional

Example fix

// before - mixed redisotel versions create conflicting metadata
// (v1 registered it with unit "{relaxation}", v2 without)

// after - pin a single redisotel version in go.mod
go get github.com/redis/go-redis/extra/redisotel-native@v9.x.x
Defensive patterns

Strategy: try-catch

Try / catch

if err := obs.Init(cfg); err != nil {
    if strings.Contains(err.Error(), "connection relaxed timeout metric") {
        log.Error("conflict on 'redis.client.connection.relaxed_timeout'; reconcile metadata")
    }
}

Prevention

When it happens

Trigger: Calling Init with MetricGroupFlagConnectionBasic enabled, and the OTel SDK rejects the UpDownCounter creation for the relaxed-timeout metric.

Common situations: Another instrumentation library or a different go-redis version registered the same instrument name with conflicting metadata; SDK version incompatibility.

Related errors


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/12b64c0963f77d66.json. Report an issue: GitHub.