diff options
author | Nathan Louie <nathan.louie@10gen.com> | 2018-08-01 15:47:57 -0400 |
---|---|---|
committer | Nathan Louie <nathan.louie@10gen.com> | 2018-08-09 11:09:19 -0400 |
commit | e75f7fa2231cbd78d82923393de84d72702f9bcf (patch) | |
tree | a561da380e5ecc632aa8eac6fb5ab44f64300a5c /src/mongo/db/stats | |
parent | d88e328fe5cb0a9d2ac46173853102389f205e1e (diff) | |
download | mongo-e75f7fa2231cbd78d82923393de84d72702f9bcf.tar.gz |
SERVER-35159 Track transactions latency and add to serverStatus output
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r-- | src/mongo/db/stats/top.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/stats/top.h | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp index 155f122fef5..5f6b5c2e7a0 100644 --- a/src/mongo/db/stats/top.cpp +++ b/src/mongo/db/stats/top.cpp @@ -220,6 +220,11 @@ void Top::appendGlobalLatencyStats(bool includeHistograms, BSONObjBuilder* build _globalHistogramStats.append(includeHistograms, builder); } +void Top::incrementGlobalTransactionLatencyStats(uint64_t latency) { + stdx::lock_guard<SimpleMutex> guard(_lock); + _globalHistogramStats.increment(latency, Command::ReadWriteType::kTransaction); +} + void Top::_incrementHistogram(OperationContext* opCtx, long long latency, OperationLatencyHistogram* histogram, diff --git a/src/mongo/db/stats/top.h b/src/mongo/db/stats/top.h index 6dc2cf7f8a3..edcc72778b7 100644 --- a/src/mongo/db/stats/top.h +++ b/src/mongo/db/stats/top.h @@ -112,13 +112,18 @@ public: void appendLatencyStats(StringData ns, bool includeHistograms, BSONObjBuilder* builder); /** - * Increments the global histogram. + * Increments the global histogram only if the operation came from a user. */ void incrementGlobalLatencyStats(OperationContext* opCtx, uint64_t latency, Command::ReadWriteType readWriteType); /** + * Increments the global transactions histogram. + */ + void incrementGlobalTransactionLatencyStats(uint64_t latency); + + /** * Appends the global latency statistics. */ void appendGlobalLatencyStats(bool includeHistograms, BSONObjBuilder* builder); |