@@ -12,6 +12,7 @@ internal sealed class RedisMetrics
1212 //private readonly Counter<long> _completedAsynchronously;
1313 //private readonly Counter<long> _completedSynchronously;
1414 //private readonly Counter<long> _failedSynchronously;
15+ private readonly Counter < long > _nonPreferredEndpointCount ;
1516
1617 public static readonly RedisMetrics Instance = new RedisMetrics ( ) ;
1718
@@ -20,28 +21,41 @@ public RedisMetrics()
2021 _meter = new Meter ( "StackExchange.Redis" ) ;
2122
2223 _operationCount = _meter . CreateCounter < long > (
23- "operation-count" ,
24+ "redis- operation-count" ,
2425 description : "The number of operations performed." ) ;
2526
2627 //_completedAsynchronously = _meter.CreateCounter<long>(
27- // "completed-asynchronously",
28+ // "redis- completed-asynchronously",
2829 // description: "The number of operations that have been completed asynchronously.");
2930
3031 //_completedSynchronously = _meter.CreateCounter<long>(
31- // "completed-synchronously",
32+ // "redis- completed-synchronously",
3233 // description: "The number of operations that have been completed synchronously.");
3334
3435 //_failedSynchronously = _meter.CreateCounter<long>(
35- // "failed-synchronously",
36+ // "redis- failed-synchronously",
3637 // 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." ) ;
3742 }
3843
39- public void IncrementOpCount ( string connectionName )
44+ public void IncrementOperationCount ( string endpoint )
4045 {
4146 if ( _operationCount . Enabled )
4247 {
4348 _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 ) ) ;
4559 }
4660 }
4761}
0 commit comments