1010
1111use Exception ;
1212use JsonException ;
13+ use PDO ;
1314use Predis \Client as Predis ;
1415use RobiNN \Pca \Config ;
1516use RobiNN \Pca \Dashboards \DashboardException ;
@@ -572,7 +573,7 @@ private function dbSelect(): string {
572573 */
573574 private function slowlog (): string {
574575 if (!$ this ->isCommandSupported ('SLOWLOG ' )) {
575- return $ this ->template ->render ('components/tabs ' , ['links ' => ['keys ' => 'Keys ' , 'slowlog ' => 'Slow Log ' ,], ]).
576+ return $ this ->template ->render ('components/tabs ' , ['links ' => ['keys ' => 'Keys ' , 'slowlog ' => 'Slow Log ' ,]]).
576577 'Slowlog is disabled on your server. ' ;
577578 }
578579
@@ -600,6 +601,15 @@ private function slowlog(): string {
600601 ]);
601602 }
602603
604+ private function metrics (): string {
605+ if (!in_array ('sqlite ' , PDO ::getAvailableDrivers (), true )) {
606+ return $ this ->template ->render ('components/tabs ' , ['links ' => ['keys ' => 'Keys ' , 'slowlog ' => 'Slow Log ' ,]]).
607+ 'Metrics are disabled because the PDO SQLite driver is not available. Install the sqlite3 extension for PHP. ' ;
608+ }
609+
610+ return $ this ->template ->render ('dashboards/redis/redis ' );
611+ }
612+
603613 /**
604614 * @throws Exception
605615 */
@@ -621,6 +631,10 @@ function (string $key, string $value, int $ttl): bool {
621631 return $ this ->slowlog ();
622632 }
623633
634+ if (Http::get ('tab ' ) === 'metrics ' ) {
635+ return $ this ->metrics ();
636+ }
637+
624638 $ keys = $ this ->getAllKeys ();
625639
626640 if (isset ($ _GET ['export_btn ' ])) {
0 commit comments