File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class AdminHandler extends Handler
29
29
const OPTION_DETAILS = 'details ' ;
30
30
31
31
/**
32
- * Get the server's storage engine
32
+ * Get the server's storage engine
33
33
*
34
34
* This will throw if the engine data cannot be retrieved
35
35
*
@@ -43,6 +43,22 @@ public function getEngine()
43
43
$ response = $ this ->getConnection ()->get (Urls::URL_ENGINE );
44
44
return $ response ->getJson ();
45
45
}
46
+
47
+ /**
48
+ * Get the server's storage engine statistics
49
+ *
50
+ * This will throw if the engine data cannot be retrieved
51
+ *
52
+ * @throws Exception
53
+ *
54
+ * @return mixed - an object returning the engine statistics
55
+ * @since 3.8
56
+ */
57
+ public function getEngineStats ()
58
+ {
59
+ $ response = $ this ->getConnection ()->get (Urls::URL_ENGINE_STATS );
60
+ return $ response ->getJson ();
61
+ }
46
62
47
63
/**
48
64
* Get the server version
Original file line number Diff line number Diff line change @@ -177,6 +177,11 @@ abstract class Urls
177
177
* URL for storage engine
178
178
*/
179
179
const URL_ENGINE = '/_api/engine ' ;
180
+
181
+ /**
182
+ * URL for storage engine stats
183
+ */
184
+ const URL_ENGINE_STATS = '/_api/engine/stats ' ;
180
185
181
186
/**
182
187
* URL for admin version
Original file line number Diff line number Diff line change @@ -21,6 +21,30 @@ public function setUp()
21
21
$ this ->connection = getConnection ();
22
22
$ this ->adminHandler = new AdminHandler ($ this ->connection );
23
23
}
24
+
25
+
26
+ /**
27
+ * Test if we can get the storage engine
28
+ */
29
+ public function testEngine ()
30
+ {
31
+ $ result = $ this ->adminHandler ->getEngine ();
32
+ static ::assertEquals ("rocksdb " , $ result ["name " ]);
33
+ static ::assertTrue (isset ($ result ["supports " ]));
34
+ }
35
+
36
+
37
+ /**
38
+ * Test if we can get the storage engine statistics
39
+ */
40
+ public function testEngineStats ()
41
+ {
42
+ $ result = $ this ->adminHandler ->getEngineStats ();
43
+ static ::assertTrue (is_array ($ result ));
44
+ static ::assertTrue (isset ($ result ["cache.limit " ]));
45
+ static ::assertTrue (isset ($ result ["cache.allocated " ]));
46
+ static ::assertTrue (isset ($ result ["columnFamilies " ]));
47
+ }
24
48
25
49
26
50
/**
You can’t perform that action at this time.
0 commit comments