redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
19.65k stars 2.32k forks source link

Add cmd.FullName in metrics attributes #2872

Open 2011aad opened 5 months ago

2011aad commented 5 months ago

Issue tracker is used for reporting bugs and discussing new features. Please use stackoverflow for supporting issues.

Adding a cmd name attribute is useful for monitoring application accessing redis, because different kinds of cmd may perform differently.

Expected Behavior

Expect adding cmd name (get/set/del etc.) in metrics attributes.

Current Behavior

Currently, only type:command attribute is added to the metrics.

Possible Implementation

Add the following code in ProcessHook function of metricsHook.

attrs = append(attrs, attribute.String("cmd", cmd.FullName()))