diff options
Diffstat (limited to 'src/mongo/db/pipeline/document_source_operation_metrics.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_operation_metrics.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_operation_metrics.cpp b/src/mongo/db/pipeline/document_source_operation_metrics.cpp index 5855894bf3b..548a7b3679b 100644 --- a/src/mongo/db/pipeline/document_source_operation_metrics.cpp +++ b/src/mongo/db/pipeline/document_source_operation_metrics.cpp @@ -53,6 +53,7 @@ const char* DocumentSourceOperationMetrics::getSourceName() const { namespace { static constexpr StringData kClearMetrics = "clearMetrics"_sd; static constexpr StringData kDatabaseName = "db"_sd; +static constexpr StringData kLocalTimeFieldName = "localTime"_sd; } // namespace DocumentSource::GetNextResult DocumentSourceOperationMetrics::doGetNext() { @@ -63,9 +64,11 @@ DocumentSource::GetNextResult DocumentSourceOperationMetrics::doGetNext() { } return ResourceConsumption::get(pExpCtx->opCtx).getDbMetrics(); }(); + auto localTime = jsTime(); // fetch current time to include in all metrics documents for (auto& [dbName, metrics] : dbMetrics) { BSONObjBuilder builder; builder.append(kDatabaseName, dbName); + builder.appendDate(kLocalTimeFieldName, localTime); metrics.toBson(&builder); _operationMetrics.push_back(builder.obj()); } |