Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3a11fc1

Browse files
committed
Add ConnectionCount and DriverTitle for monitoring commands
1 parent 046b92a commit 3a11fc1

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
@@ -5,6 +5,7 @@
55
namespace MongoDB\Laravel\Schema;
66

77
use Closure;
8+
use Illuminate\Database\Connection;
89
use MongoDB\Model\CollectionInfo;
910
use MongoDB\Model\IndexInfo;
1011

@@ -289,4 +290,13 @@ protected function getAllCollections()
289290

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /