File tree 3 files changed +56
-0
lines changed
3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ import * as KEYS from '../commands/KEYS';
86
86
import * as LASTSAVE from '../commands/LASTSAVE' ;
87
87
import * as LATENCY_DOCTOR from '../commands/LATENCY_DOCTOR' ;
88
88
import * as LATENCY_GRAPH from '../commands/LATENCY_GRAPH' ;
89
+ import * as LATENCY_HISTORY from '../commands/LATENCY_HISTORY' ;
89
90
import * as LATENCY_LATEST from '../commands/LATENCY_LATEST' ;
90
91
import * as LOLWUT from '../commands/LOLWUT' ;
91
92
import * as MEMORY_DOCTOR from '../commands/MEMORY_DOCTOR' ;
@@ -298,6 +299,8 @@ export default {
298
299
latencyDoctor : LATENCY_DOCTOR ,
299
300
LATENCY_GRAPH ,
300
301
latencyGraph : LATENCY_GRAPH ,
302
+ LATENCY_HISTORY ,
303
+ latencyHistory : LATENCY_HISTORY ,
301
304
LATENCY_LATEST ,
302
305
latencyLatest : LATENCY_LATEST ,
303
306
LOLWUT ,
Original file line number Diff line number Diff line change
1
+ import { strict as assert } from 'assert' ;
2
+ import testUtils , { GLOBAL } from '../test-utils' ;
3
+ import { transformArguments } from './LATENCY_HISTORY' ;
4
+
5
+ describe ( 'LATENCY HISTORY' , ( ) => {
6
+ it ( 'transformArguments' , ( ) => {
7
+ assert . deepEqual (
8
+ transformArguments ( 'command' ) ,
9
+ [ 'LATENCY' , 'HISTORY' , 'command' ]
10
+ ) ;
11
+ } ) ;
12
+
13
+ testUtils . testWithClient ( 'client.latencyHistory' , async client => {
14
+ await Promise . all ( [
15
+ client . configSet ( 'latency-monitor-threshold' , '100' ) ,
16
+ client . sendCommand ( [ 'DEBUG' , 'SLEEP' , '1' ] )
17
+ ] ) ;
18
+
19
+ const latencyHisRes = await client . latencyHistory ( 'command' ) ;
20
+ assert . ok ( Array . isArray ( latencyHisRes ) ) ;
21
+ for ( const [ timestamp , latency ] of latencyHisRes ) {
22
+ assert . equal ( typeof timestamp , 'number' ) ;
23
+ assert . equal ( typeof latency , 'number' ) ;
24
+ }
25
+ } , GLOBAL . SERVERS . OPEN ) ;
26
+ } ) ;
Original file line number Diff line number Diff line change
1
+ export type EventType = (
2
+ 'active-defrag-cycle' |
3
+ 'aof-fsync-always' |
4
+ 'aof-stat' |
5
+ 'aof-rewrite-diff-write' |
6
+ 'aof-rename' |
7
+ 'aof-write' |
8
+ 'aof-write-active-child' |
9
+ 'aof-write-alone' |
10
+ 'aof-write-pending-fsync' |
11
+ 'command' |
12
+ 'expire-cycle' |
13
+ 'eviction-cycle' |
14
+ 'eviction-del' |
15
+ 'fast-command' |
16
+ 'fork' |
17
+ 'rdb-unlink-temp-file'
18
+ ) ;
19
+
20
+ export function transformArguments ( event : EventType ) {
21
+ return [ 'LATENCY' , 'HISTORY' , event ] ;
22
+ }
23
+
24
+ export declare function transformReply ( ) : Array < [
25
+ timestamp : number ,
26
+ latency : number ,
27
+ ] > ;
You can’t perform that action at this time.
0 commit comments