diff options
author | Eliot Horowitz <eliot@10gen.com> | 2014-05-05 23:36:42 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2014-05-06 12:06:58 -0400 |
commit | e404acb525bb23a7f75c54e93f124a5141083503 (patch) | |
tree | a705ba87bb71d8bd77e2ab5a86a823f4db6d3e26 /src/mongo/db/commands/server_status.h | |
parent | aa170e9550ae7b88ae129e90d083d6f9373ce1da (diff) | |
download | mongo-e404acb525bb23a7f75c54e93f124a5141083503.tar.gz |
SERVER-13640: split up ServerStatus into a library
Diffstat (limited to 'src/mongo/db/commands/server_status.h')
-rw-r--r-- | src/mongo/db/commands/server_status.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/mongo/db/commands/server_status.h b/src/mongo/db/commands/server_status.h index ade476ec064..b6313f28eba 100644 --- a/src/mongo/db/commands/server_status.h +++ b/src/mongo/db/commands/server_status.h @@ -91,56 +91,5 @@ namespace mongo { const OpCounters* _counters; }; - class ServerStatusMetric { - public: - /** - * @param name is a dotted path of a counter name - * if name starts with . its treated as a path from the serverStatus root - * otherwise it will live under the "counters" namespace - * so foo.bar would be serverStatus().counters.foo.bar - */ - ServerStatusMetric(const string& name); - virtual ~ServerStatusMetric(){} - - string getMetricName() const { return _name; } - - virtual void appendAtLeaf( BSONObjBuilder& b ) const = 0; - - protected: - static string _parseLeafName( const string& name ); - - const string _name; - const string _leafName; - }; - - /** - * usage - * - * declared once - * Counter counter; - * ServerStatusMetricField myAwesomeCounterDisplay( "path.to.counter", &counter ); - * - * call - * counter.hit(); - * - * will show up in db.serverStatus().metrics.path.to.counter - */ - template< typename T > - class ServerStatusMetricField : public ServerStatusMetric { - public: - ServerStatusMetricField( const string& name, const T* t ) - : ServerStatusMetric(name), _t(t) { - } - - const T* get() { return _t; } - - virtual void appendAtLeaf( BSONObjBuilder& b ) const { - b.append( _leafName, *_t ); - } - - private: - const T* _t; - }; - } |