{"record":{"id":"852f32a9ce6063d5","repo":"redis/go-redis","slug":"redisotel-t-not-supported-852f32","errorCode":null,"errorMessage":"redisotel: %T not supported","messagePattern":"redisotel: %T not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extra/redisotel/tracing.go","lineNumber":49,"sourceCode":"\t\treturn nil\n\tcase *redis.ClusterClient:\n\t\trdb.OnNewNode(func(rdb *redis.Client) {\n\t\t\topt := rdb.Options()\n\t\t\topts = addServerAttributes(opts, opt.Addr)\n\t\t\tconnString := formatDBConnString(opt.Network, opt.Addr)\n\t\t\trdb.AddHook(newTracingHook(connString, opts...))\n\t\t})\n\t\treturn nil\n\tcase *redis.Ring:\n\t\trdb.OnNewNode(func(rdb *redis.Client) {\n\t\t\topt := rdb.Options()\n\t\t\topts = addServerAttributes(opts, opt.Addr)\n\t\t\tconnString := formatDBConnString(opt.Network, opt.Addr)\n\t\t\trdb.AddHook(newTracingHook(connString, opts...))\n\t\t})\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"redisotel: %T not supported\", rdb)\n\t}\n}\n\ntype tracingHook struct {\n\tconf *config\n\n\tspanOpts []trace.SpanStartOption\n}\n\nvar _ redis.Hook = (*tracingHook)(nil)\n\nfunc newTracingHook(connString string, opts ...TracingOption) *tracingHook {\n\tbaseOpts := make([]baseOption, len(opts))\n\tfor i, opt := range opts {\n\t\tbaseOpts[i] = opt\n\t}\n\tconf := newConfig(baseOpts...)\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/extra/redisotel/tracing.go#L31-L67","documentation":"redisotel.InstrumentTracing installs a tracing hook on the client and only supports *redis.Client, *redis.ClusterClient, and *redis.Ring. Any other concrete type — most notably *redis.FailoverClient (sentinel) or a custom UniversalClient — falls into the default case and returns '%T not supported'.","triggerScenarios":"Calling InstrumentTracing with a Sentinel failover client, a nil client, or a custom type implementing redis.UniversalClient.","commonSituations":"Sentinel-based deployments instrumented with redisotel; generic code taking redis.UniversalClient and instrumenting blindly; mocks in tests.","solutions":["Use one of the supported client types (Client, ClusterClient, Ring)","For failover, add the equivalent tracing hook manually or use a redisotel version that supports FailoverClient","Type-switch on redis.UniversalClient in your own code and instrument the underlying *redis.Client instances","Check rdb != nil before instrumenting"],"exampleFix":"// before\nvar rdb redis.UniversalClient = redis.NewFailoverClient(opt)\nredisotel.InstrumentTracing(rdb) // redisotel: *redis.FailoverClient not supported\n// after\nvar rdb redis.UniversalClient = redis.NewClient(&redis.Options{Addr: \"localhost:6379\"})\nredisotel.InstrumentTracing(rdb)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func tracingSupported(rdb redis.UniversalClient) bool {\n\tswitch rdb.(type) {\n\tcase *redis.Client, *redis.ClusterClient, *redis.Ring:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":"if err := redisotel.InstrumentTracing(rdb); err != nil {\n\tif strings.Contains(err.Error(), \"not supported\") {\n\t\tlog.Printf(\"tracing skipped for %T\", rdb)\n\t}\n}","preventionTips":["Instrument tracing right after client creation, before wrapping in interfaces","For failover clients, add newTracingHook manually via AddHook or use a supported client","Add a compile-time smoke test that instruments each client type used in the app"],"tags":["opentelemetry","tracing","unsupported-client","type-mismatch"],"backgroundTag":"unsupported-client-type","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}