{"record":{"id":"7568bedb4afd90d5","repo":"redis/go-redis","slug":"failed-to-create-connection-create-time-histogram","errorCode":null,"errorMessage":"failed to create connection create time histogram: %w","messagePattern":"failed to create connection create time histogram: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extra/redisotel-native/redisotel.go","lineNumber":223,"sourceCode":"\t\tconnectionCount, err = meter.Int64UpDownCounter(\n\t\t\tdbconv.ClientConnectionCount{}.Name(),\n\t\t\tmetric.WithDescription(dbconv.ClientConnectionCount{}.Description()),\n\t\t\tmetric.WithUnit(dbconv.ClientConnectionCount{}.Unit()),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create connection count metric: %w\", err)\n\t\t}\n\n\t\tvar connectionCreateTimeOpts []metric.Float64HistogramOption\n\t\tif cfg.histAggregation == HistogramAggregationExplicitBucket {\n\t\t\tconnectionCreateTimeOpts = append(connectionCreateTimeOpts,\n\t\t\t\tmetric.WithExplicitBucketBoundaries(cfg.bucketsConnectionCreateTime...),\n\t\t\t)\n\t\t}\n\t\tvar connectionCreateTimeConv dbconv.ClientConnectionCreateTime\n\t\tconnectionCreateTimeConv, err = dbconv.NewClientConnectionCreateTime(meter, connectionCreateTimeOpts...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create connection create time histogram: %w\", err)\n\t\t}\n\t\tconnectionCreateTime = connectionCreateTimeConv.Inst()\n\n\t\tconnectionRelaxedTimeout, err = meter.Int64UpDownCounter(\n\t\t\tMetricConnectionRelaxedTimeout,\n\t\t\tmetric.WithDescription(\"How many times the connection timeout has been increased/decreased (after a server maintenance notification)\"),\n\t\t\tmetric.WithUnit(\"{relaxation}\"),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create connection relaxed timeout metric: %w\", err)\n\t\t}\n\n\t\tconnectionHandoff, err = meter.Int64Counter(\n\t\t\tMetricConnectionHandoff,\n\t\t\tmetric.WithDescription(\"Connections that have been handed off to another node (e.g after a MOVING notification)\"),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create connection handoff metric: %w\", err)","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/extra/redisotel-native/redisotel.go#L205-L241","documentation":"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.","triggerScenarios":"Init with MetricGroupFlagConnectionBasic enabled, HistogramAggregationExplicitBucket configured, and a MeterProvider that is shut down, misconfigured, or rejects the explicit bucket boundaries supplied in BucketsConnectionCreateTime.","commonSituations":"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.","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"],"exampleFix":"// before\ncfg.HistogramAggregation = redisotel.HistogramAggregationExplicitBucket\ncfg.BucketsConnectionCreateTime = []float64{} // empty boundaries\n// after\ncfg.HistogramAggregation = redisotel.HistogramAggregationExplicitBucket\ncfg.BucketsConnectionCreateTime = []float64{0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1}","handlingStrategy":"validation","validationCode":"func validBuckets(b []float64) bool {\n    for i := range b {\n        if b[i] <= 0 || (i > 0 && b[i] <= b[i-1]) { return false }\n    }\n    return true\n}\nif cfg.HistogramAggregation == redisotel.HistogramAggregationExplicitBucket && !validBuckets(cfg.BucketsConnectionCreateTime) {\n    cfg.HistogramAggregation = redisotel.HistogramAggregationDefault\n}","typeGuard":null,"tryCatchPattern":"if err := obs.Init(cfg); err != nil {\n    if strings.Contains(err.Error(), \"connection create time histogram\") {\n        cfg.HistogramAggregation = redisotel.HistogramAggregationDefault\n    }\n}","preventionTips":["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"],"tags":["opentelemetry","metrics","histogram","go"],"backgroundTag":"otel-instrument-creation-failed","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}