@@ -12,6 +12,7 @@ internal sealed class RedisMetrics
12
12
//private readonly Counter<long> _completedAsynchronously;
13
13
//private readonly Counter<long> _completedSynchronously;
14
14
//private readonly Counter<long> _failedSynchronously;
15
+ private readonly Counter < long > _nonPreferredEndpointCount ;
15
16
16
17
public static readonly RedisMetrics Instance = new RedisMetrics ( ) ;
17
18
@@ -20,28 +21,41 @@ public RedisMetrics()
20
21
_meter = new Meter ( "StackExchange.Redis" ) ;
21
22
22
23
_operationCount = _meter . CreateCounter < long > (
23
- "operation-count" ,
24
+ "redis- operation-count" ,
24
25
description : "The number of operations performed." ) ;
25
26
26
27
//_completedAsynchronously = _meter.CreateCounter<long>(
27
- // "completed-asynchronously",
28
+ // "redis- completed-asynchronously",
28
29
// description: "The number of operations that have been completed asynchronously.");
29
30
30
31
//_completedSynchronously = _meter.CreateCounter<long>(
31
- // "completed-synchronously",
32
+ // "redis- completed-synchronously",
32
33
// description: "The number of operations that have been completed synchronously.");
33
34
34
35
//_failedSynchronously = _meter.CreateCounter<long>(
35
- // "failed-synchronously",
36
+ // "redis- failed-synchronously",
36
37
// description: "The number of operations that failed to complete asynchronously.");
38
+
39
+ _nonPreferredEndpointCount = _meter . CreateCounter < long > (
40
+ "redis-non-preferred-endpoint-count" ,
41
+ description : "Indicates the total number of messages dispatched to a non-preferred endpoint, for example sent to a primary when the caller stated a preference of replica." ) ;
37
42
}
38
43
39
- public void IncrementOpCount ( string connectionName )
44
+ public void IncrementOperationCount ( string endpoint )
40
45
{
41
46
if ( _operationCount . Enabled )
42
47
{
43
48
_operationCount . Add ( 1 ,
44
- new KeyValuePair < string , object ? > ( "connection-name" , connectionName ) ) ;
49
+ new KeyValuePair < string , object ? > ( "endpoint" , endpoint ) ) ;
50
+ }
51
+ }
52
+
53
+ public void IncrementNonPreferredEndpointCount ( string endpoint )
54
+ {
55
+ if ( _nonPreferredEndpointCount . Enabled )
56
+ {
57
+ _nonPreferredEndpointCount . Add ( 1 ,
58
+ new KeyValuePair < string , object ? > ( "endpoint" , endpoint ) ) ;
45
59
}
46
60
}
47
61
}
0 commit comments