go-redis
go-redis copied to clipboard
Logger and metrics must not be global but per client
Some applications require several redis clients and may otherwise have complex logical structure. Thus, logging and metrics must be associated with the client rather than just sit in global scope.
In the current implementation "scoped" logging can be achieved by virtue of specially crafted context object, but this is less than ideal, because it requires additional attention to hierarchy of context objects.
The recently introduced metrics are hopeless outright, being in global scope and thus implicitly shared across all client instances.
Structured logging frameworks, such as "go.uber.org/zap", offer a convenient way to derive nested loggers out of a common ancestor (client -> pool related or command related).