go-redis/redis · error
failed to create connection wait time histogram: %w
Error message
failed to create connection wait time histogram: %w
What it means
Returned by createRecorder (redisotel.go:282) when dbconv.NewClientConnectionWaitTime fails to create the 'db.client.connection.wait_time' Float64Histogram. Only checked when MetricGroupConnectionAdvanced is enabled.
Source
Thrown at extra/redisotel-native/redisotel.go:282
return nil, fmt.Errorf("failed to create maintenance notifications metric: %w", err)
}
}
var connectionWaitTime metric.Float64Histogram
var connectionClosed metric.Int64Counter
var connectionPendingReqs metric.Int64UpDownCounter // OTel semconv: UpDownCounter
if cfg.isMetricGroupEnabled(MetricGroupConnectionAdvanced) {
var connectionWaitTimeOpts []metric.Float64HistogramOption
if cfg.histAggregation == HistogramAggregationExplicitBucket {
connectionWaitTimeOpts = append(connectionWaitTimeOpts,
metric.WithExplicitBucketBoundaries(cfg.bucketsConnectionWaitTime...),
)
}
var connectionWaitTimeConv dbconv.ClientConnectionWaitTime
connectionWaitTimeConv, err = dbconv.NewClientConnectionWaitTime(meter, connectionWaitTimeOpts...)
if err != nil {
return nil, fmt.Errorf("failed to create connection wait time histogram: %w", err)
}
connectionWaitTime = connectionWaitTimeConv.Inst()
connectionClosed, err = meter.Int64Counter(
MetricConnectionClosed,
metric.WithDescription("The number of connections that have been closed"),
metric.WithUnit("{connection}"),
)
if err != nil {
return nil, fmt.Errorf("failed to create connection closed metric: %w", err)
}
connectionPendingReqs, err = meter.Int64UpDownCounter(
dbconv.ClientConnectionPendingRequests{}.Name(),
metric.WithDescription(dbconv.ClientConnectionPendingRequests{}.Description()),
metric.WithUnit(dbconv.ClientConnectionPendingRequests{}.Unit()),
)
if err != nil {View on GitHub (pinned to 36d97525cd)
Solutions
- Search for other registrations of 'db.client.connection.wait_time' and reconcile metadata
- Validate cfg.BucketsConnectionWaitTime contains monotonically increasing positive floats
- Verify OTel SDK compatibility
Example fix
// before - bucket boundaries invalid
cfg.BucketsConnectionWaitTime = []float64{0}
// after - valid positive monotonically increasing bounds
cfg.BucketsConnectionWaitTime = []float64{0.001, 0.01, 0.1, 1.0} Defensive patterns
Strategy: try-catch
Validate before calling
// Validate connection wait time bucket boundaries
for i := 1; i < len(cfg.BucketsConnectionWaitTime); i++ {
if cfg.BucketsConnectionWaitTime[i] <= cfg.BucketsConnectionWaitTime[i-1] {
return fmt.Errorf("invalid bucket boundaries")
}
} Try / catch
if err := obs.Init(cfg); err != nil {
if strings.Contains(err.Error(), "connection wait time histogram") {
log.Error("conflict on 'db.client.connection.wait_time' or invalid bucket boundaries")
}
} Prevention
- Ensure no other library registers 'db.client.connection.wait_time' with conflicting metadata
- Validate histogram bucket boundaries are monotonically increasing
- Use a compatible OTel SDK version
When it happens
Trigger: Calling Init with MetricGroupFlagConnectionAdvanced enabled, and the OTel SDK rejects the histogram creation.
Common situations: Another library registered 'db.client.connection.wait_time' with conflicting unit or description; malformed cfg.BucketsConnectionWaitTime boundary values.
Related errors
- failed to create connection create time histogram: %w
- failed to create operation duration histogram: %w
- failed to create connection count metric: %w
- failed to create connection relaxed timeout metric: %w
- failed to create connection handoff metric: %w
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/50edce3fddbc3236.json.
Report an issue: GitHub.