go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

Logger and metrics must not be global but per client

Open oakad opened this issue 3 years ago • 0 comments

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).

oakad avatar Nov 19 '20 03:11 oakad