Skip to content

Commit 5aafee5

Browse files
committed
Add ConnectionCount and DriverTitle for monitoring commands
1 parent 046b92a commit 5aafee5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Connection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,9 @@ private static function lookupVersion(): string
361361
return self::$version = 'error';
362362
}
363363
}
364+
365+
public function getDriverTitle()
366+
{
367+
return 'MongoDB';
368+
}
364369
}

src/Schema/Builder.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,14 @@ protected function getAllCollections()
289289

290290
return $collections;
291291
}
292+
293+
public function getConnectionsCount()
294+
{
295+
$status = $this->connection
296+
->getMongoDB()
297+
->command(['serverStatus' => 1])
298+
->toArray();
299+
300+
return $status[0]['connections']['current'];
301+
}
292302
}

0 commit comments

Comments
 (0)