{"id":"b1352362fa6e2b8e","repo":"go-redis/redis","slug":"failed-to-create-connection-handoff-metric-w","errorCode":null,"errorMessage":"failed to create connection handoff metric: %w","messagePattern":"failed to create connection handoff metric: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extra/redisotel-native/redisotel.go","lineNumber":241,"sourceCode":"\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)\n\t\t}\n\t}\n\n\tvar clientErrors metric.Int64Counter\n\tvar maintenanceNotifications metric.Int64Counter\n\n\tif cfg.isMetricGroupEnabled(MetricGroupResiliency) {\n\t\tclientErrors, err = meter.Int64Counter(\n\t\t\tMetricClientErrors,\n\t\t\tmetric.WithDescription(\"Number of errors handled by the Redis client\"),\n\t\t\tmetric.WithUnit(\"{error}\"),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create client errors metric: %w\", err)\n\t\t}\n\n\t\tmaintenanceNotifications, err = meter.Int64Counter(\n\t\t\tMetricMaintenanceNotifications,","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/extra/redisotel-native/redisotel.go#L223-L259","documentation":"Returned by createRecorder (redisotel.go:241) when meter.Int64Counter fails to create the 'redis.client.connection.handoff' instrument. Only checked when MetricGroupConnectionBasic is enabled.","triggerScenarios":"Calling Init with MetricGroupFlagConnectionBasic enabled, and the OTel SDK rejects the Counter creation.","commonSituations":"Another library or redisotel version registered 'redis.client.connection.handoff' with a conflicting instrument type (e.g., UpDownCounter) or different description; SDK incompatibility.","solutions":["Search for other registrations of 'redis.client.connection.handoff' and ensure they use Int64Counter with matching description","Resolve transitive dependency conflicts between redisotel versions","Verify the MeterProvider is valid"],"exampleFix":"// before - conflicting type from another integration\nmeter.Int64UpDownCounter(\"redis.client.connection.handoff\")\n\n// after - match redisotel's Int64Counter type\nmeter.Int64Counter(\"redis.client.connection.handoff\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := obs.Init(cfg); err != nil {\n    if strings.Contains(err.Error(), \"connection handoff metric\") {\n        log.Error(\"conflict on 'redis.client.connection.handoff'; ensure Int64Counter type match\")\n    }\n}","preventionTips":["Ensure no other library registers 'redis.client.connection.handoff' as a different instrument type","Resolve transitive redisotel version conflicts","Verify the MeterProvider is valid"],"tags":["otel","redisotel-native","metrics","connection","counter"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}