summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.cpp
diff options
context:
space:
mode:
authorVarun Ravichandran <varun.ravichandran@mongodb.com>2021-04-01 03:31:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-30 21:06:36 +0000
commitc1213e2bbfb379d3defdc08a48067a350e84027c (patch)
tree96dd8a62b4924c11cdbfefc8227b9301e35c4cf6 /src/mongo/db/curop.cpp
parent272b9e0bd2425ae15766b198de0f6a1a522bf8d3 (diff)
downloadmongo-c1213e2bbfb379d3defdc08a48067a350e84027c.tar.gz
SERVER-46412: Track, log, and profile user cache acquisition stats in CurOp
Diffstat (limited to 'src/mongo/db/curop.cpp')
-rw-r--r--src/mongo/db/curop.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index 6a2e0aead94..29e63a3a1e9 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -936,6 +936,14 @@ string OpDebug::report(OperationContext* opCtx, const SingleThreadedLockStats* l
s << " locks:" << locks.obj().toString();
}
+ auto userCacheAcquisitionStats = curop.getReadOnlyUserCacheAcquisitionStats();
+ if (userCacheAcquisitionStats->shouldReport()) {
+ StringBuilder userCacheAcquisitionStatsBuilder;
+ userCacheAcquisitionStats->toString(&userCacheAcquisitionStatsBuilder,
+ opCtx->getServiceContext()->getTickSource());
+ s << " authorization:" << userCacheAcquisitionStatsBuilder.str();
+ }
+
BSONObj flowControlObj = makeFlowControlObject(flowControlStats);
if (flowControlObj.nFields() > 0) {
s << " flowControl:" << flowControlObj.toString();
@@ -1107,6 +1115,14 @@ void OpDebug::report(OperationContext* opCtx,
pAttrs->add("locks", locks.obj());
}
+ auto userCacheAcquisitionStats = curop.getReadOnlyUserCacheAcquisitionStats();
+ if (userCacheAcquisitionStats->shouldReport()) {
+ BSONObjBuilder userCacheAcquisitionStatsBuilder;
+ userCacheAcquisitionStats->report(&userCacheAcquisitionStatsBuilder,
+ opCtx->getServiceContext()->getTickSource());
+ pAttrs->add("authorization", userCacheAcquisitionStatsBuilder.obj());
+ }
+
BSONObj flowControlObj = makeFlowControlObject(flowControlStats);
if (flowControlObj.nFields() > 0) {
pAttrs->add("flowControl", flowControlObj);
@@ -1231,6 +1247,15 @@ void OpDebug::append(OperationContext* opCtx,
}
{
+ auto userCacheAcquisitionStats = curop.getReadOnlyUserCacheAcquisitionStats();
+ if (userCacheAcquisitionStats->shouldReport()) {
+ BSONObjBuilder userCacheAcquisitionStatsBuilder(b.subobjStart("authorization"));
+ userCacheAcquisitionStats->report(&userCacheAcquisitionStatsBuilder,
+ opCtx->getServiceContext()->getTickSource());
+ }
+ }
+
+ {
BSONObj flowControlMetrics = makeFlowControlObject(flowControlStats);
BSONObjBuilder flowControlBuilder(b.subobjStart("flowControl"));
flowControlBuilder.appendElements(flowControlMetrics);
@@ -1488,6 +1513,15 @@ std::function<BSONObj(ProfileFilter::Args)> OpDebug::appendStaged(StringSet requ
}
});
+ addIfNeeded("authorization", [](auto field, auto args, auto& b) {
+ auto userCacheAcquisitionStats = args.curop.getReadOnlyUserCacheAcquisitionStats();
+ if (userCacheAcquisitionStats->shouldReport()) {
+ BSONObjBuilder userCacheAcquisitionStatsBuilder(b.subobjStart(field));
+ userCacheAcquisitionStats->report(&userCacheAcquisitionStatsBuilder,
+ args.opCtx->getServiceContext()->getTickSource());
+ }
+ });
+
addIfNeeded("flowControl", [](auto field, auto args, auto& b) {
BSONObj flowControlMetrics =
makeFlowControlObject(args.opCtx->lockState()->getFlowControlStats());