File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,13 @@ optional<facade::ErrorReply> CommandId::Validate(CmdArgList tail_args) const {
219
219
return nullopt ;
220
220
}
221
221
222
+ void CommandId::ResetStats (unsigned thread_index) {
223
+ command_stats_[thread_index] = {0 , 0 };
224
+ if (hdr_histogram* h = latency_histogram_; h != nullptr ) {
225
+ hdr_reset (h);
226
+ }
227
+ }
228
+
222
229
hdr_histogram* CommandId::LatencyHist () const {
223
230
return latency_histogram_;
224
231
}
Original file line number Diff line number Diff line change @@ -170,9 +170,7 @@ class CommandId : public facade::CommandId {
170
170
return (last_key_ != first_key_) || (opt_mask_ & CO::VARIADIC_KEYS);
171
171
}
172
172
173
- void ResetStats (unsigned thread_index) {
174
- command_stats_[thread_index] = {0 , 0 };
175
- }
173
+ void ResetStats (unsigned thread_index);
176
174
177
175
CmdCallStats GetStats (unsigned thread_index) const {
178
176
return command_stats_[thread_index];
Original file line number Diff line number Diff line change @@ -236,6 +236,14 @@ async def test_latency_stats(async_client: aioredis.Redis):
236
236
assert key in latency_stats
237
237
assert latency_stats [key ].keys () == {"p50" , "p99" , "p99.9" }
238
238
239
+ await async_client .config_resetstat ()
240
+ latency_stats = await async_client .info ("LATENCYSTATS" )
241
+ # Only stats for the `config resetstat` command should remain in stats
242
+ assert (
243
+ len (latency_stats ) == 1 and "latency_percentiles_usec_config" in latency_stats ,
244
+ f"unexpected latency stats after reset: { latency_stats } " ,
245
+ )
246
+
239
247
240
248
async def test_latency_stats_disabled_by_default (async_client : aioredis .Redis ):
241
249
for _ in range (100 ):
You can’t perform that action at this time.
0 commit comments