diff --git a/NewLife.Redis/RedisClient.cs b/NewLife.Redis/RedisClient.cs
index 74b3f92..de37a37 100644
--- a/NewLife.Redis/RedisClient.cs
+++ b/NewLife.Redis/RedisClient.cs
@@ -1,4 +1,5 @@
-using System.Buffers;
+using System;
+using System.Buffers;
using System.Collections.Concurrent;
using System.Net.Security;
using System.Net.Sockets;
@@ -698,10 +699,24 @@ public class RedisClient : DisposeBase
var rs = ExecuteCommand(cmd, args);
if (rs == null) return default;
+ if (span != null && rs is Array ars) span.Value = ars.Length;
if (rs is TResult rs2) return rs2;
if (TryChangeType(rs, type, out var target))
{
+ // 埋点记录结果数值
+ if (span != null)
+ {
+ span.Value = target switch
+ {
+ Int32 n => n,
+ Int64 m => m,
+ String str => str.Length,
+ Array arr => arr.Length,
+ _ => 0,
+ };
+ }
+
//!!! 外部调用者可能需要直接使用内部申请的OwnerPacket,所以这里不释放
// 释放内部申请的OwnerPacket
if (type != typeof(IPacket) && type != typeof(IPacket[])) rs.TryDispose();
@@ -762,6 +777,7 @@ public class RedisClient : DisposeBase
try
{
var rs = ExecuteCommand(cmd, args);
+ if (span != null && rs is Array ars) span.Value = ars.Length;
if (rs is TResult rs2)
{
value = rs2;
@@ -774,6 +790,19 @@ public class RedisClient : DisposeBase
var type = typeof(TResult);
if (TryChangeType(rs, type, out var target))
{
+ // 埋点记录结果数值
+ if (span != null)
+ {
+ span.Value = target switch
+ {
+ Int32 n => n,
+ Int64 m => m,
+ String str => str.Length,
+ Array arr => arr.Length,
+ _ => 0,
+ };
+ }
+
//!!! 外部调用者可能需要直接使用内部申请的OwnerPacket,所以这里不释放
// 释放内部申请的OwnerPacket
if (type != typeof(IPacket) && type != typeof(IPacket[])) rs.TryDispose();
@@ -790,26 +819,26 @@ public class RedisClient : DisposeBase
}
}
- /// 异步执行命令。返回字符串、IPacket、IPacket[]
- /// 命令
- /// 参数数组
- /// 取消通知
- ///
- public virtual async Task