From 0dc375a32b24a65fd93e6d669aca05f7309f78df Mon Sep 17 00:00:00 2001 From: samantharitter Date: Fri, 14 Apr 2017 18:40:24 -0400 Subject: SERVER-28760 Add egress logging to DBConnectionPool --- src/mongo/client/connpool.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/mongo/client/connpool.h') diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index 4599a6fdf30..7ce7022390e 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -103,6 +103,13 @@ public: _maxPoolSize = maxPoolSize; } + /** + * Sets the socket timeout on this host, for reporting purposes only. + */ + void setSocketTimeout(double socketTimeout) { + _socketTimeout = socketTimeout; + } + int numAvailable() const { return (int)_pool.size(); } @@ -111,6 +118,13 @@ public: return _checkedOut; } + /** + * Returns the number of open connections in this pool. + */ + int openConnections() const { + return numInUse() + numAvailable(); + } + void createdOne(DBClientBase* base); long long numCreated() const { return _created; @@ -163,6 +177,7 @@ private: }; std::string _hostName; + double _socketTimeout; std::stack _pool; int64_t _created; @@ -223,6 +238,11 @@ public: return _maxPoolSize; } + /** + * Returns the number of connections to the given host pool. + */ + int openConnections(const std::string& ident, double socketTimeout); + /** * Sets the maximum number of connections pooled per-host. * -- cgit v1.2.1