redis/go-redis · error
failed to create connection create time histogram: %w
Error message
failed to create connection create time histogram: %w
What it means
Returned by createRecorder when dbconv.NewClientConnectionCreateTime fails to create the db.client.connection.create_time histogram. Init aborts initialization and no metrics are registered. As with all recorder errors, the root cause is a MeterProvider that refuses instrument creation.
Source
Thrown at extra/redisotel-native/redisotel.go:223
connectionCount, err = meter.Int64UpDownCounter(
dbconv.ClientConnectionCount{}.Name(),
metric.WithDescription(dbconv.ClientConnectionCount{}.Description()),
metric.WithUnit(dbconv.ClientConnectionCount{}.Unit()),
)
if err != nil {
return nil, fmt.Errorf("failed to create connection count metric: %w", err)
}
var connectionCreateTimeOpts []metric.Float64HistogramOption
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)View on GitHub (pinned to c5cad058c7)
Solutions
- Check BucketsConnectionCreateTime: boundaries must be strictly increasing positive values when HistogramAggregationExplicitBucket is set
- Use HistogramAggregationDefault (drop the explicit-bucket option) if boundaries are not required
- Ensure the MeterProvider is live (not Shutdown) before calling Init
- Unwrap the error to find the SDK's specific complaint and consult the otel SDK docs
- Update go.opentelemetry.io/otel to a version compatible with the dbconv package in use
Example fix
// before
cfg.HistogramAggregation = redisotel.HistogramAggregationExplicitBucket
cfg.BucketsConnectionCreateTime = []float64{} // empty boundaries
// after
cfg.HistogramAggregation = redisotel.HistogramAggregationExplicitBucket
cfg.BucketsConnectionCreateTime = []float64{0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1} Defensive patterns
Strategy: validation
Validate before calling
func validBuckets(b []float64) bool {
for i := range b {
if b[i] <= 0 || (i > 0 && b[i] <= b[i-1]) { return false }
}
return true
}
if cfg.HistogramAggregation == redisotel.HistogramAggregationExplicitBucket && !validBuckets(cfg.BucketsConnectionCreateTime) {
cfg.HistogramAggregation = redisotel.HistogramAggregationDefault
} Try / catch
if err := obs.Init(cfg); err != nil {
if strings.Contains(err.Error(), "connection create time histogram") {
cfg.HistogramAggregation = redisotel.HistogramAggregationDefault
}
} Prevention
- Validate explicit bucket boundaries before enabling HistogramAggregationExplicitBucket
- Keep otel SDK and dbconv versions in sync
- Log Init errors at startup
- Verify the provider is live before Init
When it happens
Trigger: Init with MetricGroupFlagConnectionBasic enabled, HistogramAggregationExplicitBucket configured, and a MeterProvider that is shut down, misconfigured, or rejects the explicit bucket boundaries supplied in BucketsConnectionCreateTime.
Common situations: Custom histogram aggregations with empty or non-monotonic bucket boundaries; provider shutdown before Init in graceful-shutdown code paths; SDK upgrade changing bucket-validation rules.
Related errors
- failed to create connection wait 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 redis/go-redis@c5cad058c7 (2026-09-01).
Data as JSON: /api/errors/7568bedb4afd90d5.
Report an issue: GitHub.