55
66namespace Garnet . server
77{
8- internal struct NullGarnetSessionMetrics : IMetrics
9- {
10- public void Add ( IMetrics metrics ) { }
11-
12- public void Reset ( ) { }
13-
14- public void incr_total_net_input_bytes ( ulong bytes ) { }
15-
16- public ulong get_total_net_input_bytes ( ) => 0 ;
17-
18- public void incr_total_net_output_bytes ( ulong bytes ) { }
19-
20- public ulong get_total_net_output_bytes ( ) => 0 ;
21-
22- public void incr_total_commands_processed ( ulong cmds ) { }
23-
24- public ulong get_total_commands_processed ( ) => 0 ;
25-
26- public void incr_total_pending ( ulong count = 1 ) { }
27-
28- public ulong get_total_pending ( ) => 0 ;
29-
30- public void incr_total_found ( ulong count = 1 ) { }
31-
32- public ulong get_total_found ( ) => 0 ;
33-
34- public void incr_total_notfound ( ulong count = 1 ) { }
35-
36- public ulong get_total_notfound ( ) => 0 ;
37-
38- public void incr_total_cluster_commands_processed ( ulong count = 1 ) { }
39-
40- public ulong get_total_cluster_commands_processed ( ) => 0 ;
41-
42- public void add_total_write_commands_processed ( ulong count ) { }
43-
44- public void incr_total_write_commands_processed ( byte cmd ) { }
45-
46- public ulong get_total_write_commands_processed ( ) => 0 ;
47-
48- public void add_total_read_commands_processed ( ulong count ) { }
49-
50- public void incr_total_read_commands_processed ( byte cmd ) { }
51-
52- public ulong get_total_read_commands_processed ( ) => 0 ;
53-
54- public static void incr_total_number_resp_server_session_exceptions ( ulong count ) { }
55-
56- public static ulong get_total_number_resp_server_session_exceptions ( ) => 0 ;
57- }
58-
598 /// <summary>
609 /// Performance Metrics Emitted from ServerSessionBase
6110 /// </summary>
@@ -106,11 +55,21 @@ public class GarnetSessionMetrics
10655 /// </summary>
10756 public ulong total_read_commands_processed ;
10857
58+ /// <summary>
59+ /// Keep track of transaction commands received.
60+ /// </summary>
61+ public ulong total_transactions_commands_received ;
62+
10963 /// <summary>
11064 /// Keep track of total number of exceptions triggered in try consume for all resp server sessions
11165 /// </summary>
11266 public ulong total_number_resp_server_session_exceptions ;
11367
68+ /// <summary>
69+ /// Keep track of total number of transactions that were executed successfully.
70+ /// </summary>
71+ public ulong total_transaction_commands_execution_failed ;
72+
11473 /// <summary>
11574 /// GarnetSessionMetrics constructor
11675 /// </summary>
@@ -133,6 +92,8 @@ internal void Add(GarnetSessionMetrics add)
13392
13493 add_total_write_commands_processed ( add . get_total_write_commands_processed ( ) ) ;
13594 add_total_read_commands_processed ( add . get_total_read_commands_processed ( ) ) ;
95+ incr_total_transaction_commands_received ( add . get_total_transaction_commands_received ( ) ) ;
96+ incr_total_transaction_execution_failed ( add . get_total_transaction_commands_execution_failed ( ) ) ;
13697
13798 incr_total_number_resp_server_session_exceptions ( add . get_total_number_resp_server_session_exceptions ( ) ) ;
13899 }
@@ -151,6 +112,8 @@ internal void Reset()
151112 total_cluster_commands_processed = 0 ;
152113 total_write_commands_processed = 0 ;
153114 total_read_commands_processed = 0 ;
115+ total_transactions_commands_received = 0 ;
116+ total_transaction_commands_execution_failed = 0 ;
154117 total_number_resp_server_session_exceptions = 0 ;
155118 }
156119
@@ -266,13 +229,41 @@ internal void Reset()
266229 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
267230 public void add_total_read_commands_processed ( ulong count ) => total_read_commands_processed += count ;
268231
232+ /// <summary>
233+ /// Increment total_transactions_commands_received
234+ /// </summary>
235+ /// <param name="count"></param>
236+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
237+ public void incr_total_transaction_commands_received ( ulong count = 1 ) => total_transactions_commands_received += count ;
238+
239+ /// <summary>
240+ /// Increment total_transaction_commands_execution_failed
241+ /// </summary>
242+ /// <param name="count"></param>
243+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
244+ public void incr_total_transaction_execution_failed ( ulong count = 1 ) => total_transaction_commands_execution_failed += count ;
245+
269246 /// <summary>
270247 /// Get total_read_commands_processed
271248 /// </summary>
272249 /// <returns></returns>
273250 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
274251 public ulong get_total_read_commands_processed ( ) => total_read_commands_processed ;
275252
253+ /// <summary>
254+ /// Get total_transactions_commands_received
255+ /// </summary>
256+ /// <returns></returns>
257+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
258+ public ulong get_total_transaction_commands_received ( ) => total_transactions_commands_received ;
259+
260+ /// <summary>
261+ /// Get total_transaction_commands_execution_failed
262+ /// </summary>
263+ /// <returns></returns>
264+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
265+ public ulong get_total_transaction_commands_execution_failed ( ) => total_transaction_commands_execution_failed ;
266+
276267 /// <summary>
277268 /// Increment total_number_resp_server_session_exceptions
278269 /// </summary>
0 commit comments