summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Nawrocki <brett.nawrocki@mongodb.com>2022-07-14 16:45:51 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-15 17:38:49 +0000
commit8b3b4d4962648eac47fa577586e645ef2543e0fe (patch)
treedadb1932aa840f9005af907a39cae6815b9d57c9
parent299c4b3e46075a01ab8d0989bca5358a2b0603ae (diff)
downloadmongo-8b3b4d4962648eac47fa577586e645ef2543e0fe.tar.gz
SERVER-67110 Create Global Index Cumulative Metrics Field Name Provider
-rw-r--r--src/mongo/db/s/SConscript1
-rw-r--r--src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.cpp57
-rw-r--r--src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.h47
3 files changed, 105 insertions, 0 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index 10ef0496cdc..48754e95b22 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -59,6 +59,7 @@ env.Library(
'config_server_op_observer.cpp',
'global_index/global_index_entry.idl',
'global_index/global_index_inserter.cpp',
+ 'global_index_cumulative_metrics_field_name_provider.cpp',
'global_index_metrics.cpp',
'metadata_manager.cpp',
'migration_chunk_cloner_source_legacy.cpp',
diff --git a/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.cpp b/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.cpp
new file mode 100644
index 00000000000..01c5a5d6b19
--- /dev/null
+++ b/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.cpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/s/global_index_cumulative_metrics_field_name_provider.h"
+
+namespace mongo {
+
+namespace {
+using Provider = GlobalIndexCumulativeMetricsFieldNameProvider;
+constexpr auto kKeysWrittenFromScan = "keysWrittenFromScan";
+constexpr auto kBytesWrittenFromScan = "bytesWrittenFromScan";
+} // namespace
+
+namespace {
+// TODO: Delete when at least one state name getter has been implemented.
+constexpr auto kPlaceholder = "placeholder";
+} // namespace
+
+StringData Provider::getForDocumentsProcessed() const {
+ return kKeysWrittenFromScan;
+}
+
+StringData Provider::getForBytesWritten() const {
+ return kBytesWrittenFromScan;
+}
+
+StringData Provider::getForCountInstancesInRoleNameStateNStateName() const {
+ return kPlaceholder;
+}
+
+} // namespace mongo
diff --git a/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.h b/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.h
new file mode 100644
index 00000000000..dbd4a73bef7
--- /dev/null
+++ b/src/mongo/db/s/global_index_cumulative_metrics_field_name_provider.h
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/db/s/sharding_data_transform_cumulative_metrics_field_name_provider.h"
+
+namespace mongo {
+
+class GlobalIndexCumulativeMetricsFieldNameProvider
+ : public ShardingDataTransformCumulativeMetricsFieldNameProvider {
+public:
+ virtual StringData getForDocumentsProcessed() const override;
+ virtual StringData getForBytesWritten() const override;
+
+ // TODO: Replace this placeholder method with one method per global index role/state
+ // combination. See ReshardingCumulativeMetricsFieldNameProvider for an example implementation.
+ StringData getForCountInstancesInRoleNameStateNStateName() const;
+};
+
+} // namespace mongo