Jedore commented on code in PR #263:
URL: https://github.com/apache/skywalking-python/pull/263#discussion_r1059753601


##########
skywalking/plugins/sw_redis.py:
##########
@@ -35,16 +35,121 @@ def install():
 
     def _sw_send_command(this: Connection, *args, **kwargs):
         peer = f'{this.host}:{this.port}'
-        op = args[0]
+        cmd, key = args[0], args[1]
+
+        if cmd in OPERATIONS_WRITE:
+            op = 'write'
+        elif cmd in OPERATIONS_READ:
+            op = 'read'
+        else:
+            op = ''
+
         context = get_context()
-        with context.new_exit_span(op=f'Redis/{op}' or '/', peer=peer, 
component=Component.Redis) as span:
+        with context.new_exit_span(op=f'Redis/{cmd}' or '/', peer=peer, 
component=Component.Redis) as span:
             span.layer = Layer.Cache
 
             res = _send_command(this, *args, **kwargs)
-            span.tag(TagDbType('Redis'))
-            span.tag(TagDbInstance(this.db))
-            span.tag(TagDbStatement(op))
+            span.tag(TagCacheType('Redis'))
+            span.tag(TagCacheKey(key))
+            span.tag(TagCacheCmd(cmd))
+            span.tag(TagCacheOp(op))
 
             return res
 
     Connection.send_command = _sw_send_command
+
+
+OPERATIONS_WRITE = set({'GETSET',

Review Comment:
   > Is there a place where you get this complete set of supported commands for 
redis-py? I mean in case there are updates to supported commands we need a 
reference list to update the two sets. (if you have a url please simply add a 
comment to the url)
   
   Thanks, the commands in 
https://github.com/apache/skywalking-java/blob/main/apm-sniffer/apm-sdk-plugin/jedis-plugins/jedis-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v4/JedisPluginConfig.java#L52
  by [#10211](https://github.com/apache/skywalking/discussions/10211)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to