From b593b9aece2adfbf7806f4673c25b327c8344d8f Mon Sep 17 00:00:00 2001 From: Saman Memaripour Date: Fri, 31 Oct 2025 09:30:17 -0400 Subject: [PATCH] SERVER-113183 Mark module boundaries for `observability` (#43349) GitOrigin-RevId: e810af1916caaedb1cde8d1e1b74bb50b2461daf --- modules_poc/modules.yaml | 4 ++++ .../db/connection_health_metrics_parameter.idl | 1 + src/mongo/db/not_primary_error_tracker.h | 5 +++-- src/mongo/db/operation_cpu_timer.h | 5 +++-- src/mongo/db/process_health/fault_manager.h | 3 ++- src/mongo/db/process_health/fault_manager_config.h | 13 +++++++++++-- .../db/process_health/fault_manager_test_suite.h | 9 +++++---- src/mongo/db/process_health/health_check_status.h | 5 +++-- src/mongo/db/process_health/health_observer.h | 3 ++- src/mongo/db/process_health/health_observer_base.h | 3 ++- .../process_health/health_observer_registration.h | 3 ++- src/mongo/executor/split_timer.h | 3 ++- src/mongo/otel/metrics/metrics_initialization.h | 5 +++-- src/mongo/otel/telemetry_context_holder.h | 3 ++- src/mongo/otel/telemetry_context_serialization.h | 6 +++--- src/mongo/otel/traces/bson_text_map_carrier.h | 3 ++- src/mongo/otel/traces/otel_test_fixture.h | 3 ++- src/mongo/otel/traces/span/span.h | 5 +++-- .../otel/traces/span/span_telemetry_context_impl.h | 3 ++- src/mongo/otel/traces/trace_initialization.h | 7 +++++-- src/mongo/otel/traces/tracing.h | 4 +++- src/mongo/otel/traces/tracing_feature_flag.idl | 1 + src/mongo/util/observable_mutex.h | 9 +++++---- src/mongo/util/observable_mutex_registry.h | 3 ++- src/mongo/watchdog/watchdog.h | 9 +++++---- src/mongo/watchdog/watchdog_mock.h | 4 +++- src/mongo/watchdog/watchdog_mongod.h | 5 +++-- src/mongo/watchdog/watchdog_register.h | 5 +++-- 28 files changed, 87 insertions(+), 45 deletions(-) diff --git a/modules_poc/modules.yaml b/modules_poc/modules.yaml index d528a4f39f7..0996e67e7d7 100644 --- a/modules_poc/modules.yaml +++ b/modules_poc/modules.yaml @@ -600,6 +600,7 @@ observability: meta: slack: server-networking-observability jira: Networking & Observability + fully_marked: true files: - src/mongo/db/connection_health_metrics_parameter.idl - src/mongo/db/not_primary_error_tracker* @@ -624,6 +625,7 @@ observability.tracing: meta: slack: server-networking-observability jira: Networking & Observability + fully_marked: true files: - src/mongo/otel/traces/ - src/mongo/util/tracing_support* @@ -632,6 +634,7 @@ observability.metrics: meta: slack: server-networking-observability jira: Networking & Observability + fully_marked: true files: - src/mongo/otel/metrics/ @@ -639,6 +642,7 @@ observability.ftdc: meta: slack: server-networking-observability jira: Networking & Observability + fully_marked: true files: - src/mongo/db/ftdc/ diff --git a/src/mongo/db/connection_health_metrics_parameter.idl b/src/mongo/db/connection_health_metrics_parameter.idl index 31d0dbe005d..be80feb4aab 100644 --- a/src/mongo/db/connection_health_metrics_parameter.idl +++ b/src/mongo/db/connection_health_metrics_parameter.idl @@ -31,6 +31,7 @@ global: server_parameters: enableDetailedConnectionHealthMetricLogLines: + mod_visibility: public description: >- Enables detailed log lines related to connection health in a cluster. set_at: [startup, runtime] diff --git a/src/mongo/db/not_primary_error_tracker.h b/src/mongo/db/not_primary_error_tracker.h index f3dee23cd4a..77fec5018e4 100644 --- a/src/mongo/db/not_primary_error_tracker.h +++ b/src/mongo/db/not_primary_error_tracker.h @@ -30,8 +30,9 @@ #pragma once #include "mongo/db/client.h" +#include "mongo/util/modules.h" -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class BSONObjBuilder; static const char kUpsertedFieldName[] = "upserted"; @@ -91,4 +92,4 @@ private: bool _hadError = false; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/db/operation_cpu_timer.h b/src/mongo/db/operation_cpu_timer.h index 314a5dffa8c..98b3dbbda65 100644 --- a/src/mongo/db/operation_cpu_timer.h +++ b/src/mongo/db/operation_cpu_timer.h @@ -31,12 +31,13 @@ #include "mongo/util/duration.h" #include "mongo/util/inline_memory.h" +#include "mongo/util/modules.h" #include #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class OperationContext; @@ -141,4 +142,4 @@ private: Nanoseconds _elapsedAdjustment; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/db/process_health/fault_manager.h b/src/mongo/db/process_health/fault_manager.h index dad21d7e0fa..f70f757d82c 100644 --- a/src/mongo/db/process_health/fault_manager.h +++ b/src/mongo/db/process_health/fault_manager.h @@ -44,6 +44,7 @@ #include "mongo/util/duration.h" #include "mongo/util/future.h" #include "mongo/util/future_impl.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -68,7 +69,7 @@ namespace process_health { * * If an active fault state persists, FaultManager will terminate the server process. */ -class FaultManager : protected StateMachine { +class MONGO_MOD_PUBLIC FaultManager : protected StateMachine { FaultManager(const FaultManager&) = delete; FaultManager& operator=(const FaultManager&) = delete; diff --git a/src/mongo/db/process_health/fault_manager_config.h b/src/mongo/db/process_health/fault_manager_config.h index f1d20825729..080813e4c90 100644 --- a/src/mongo/db/process_health/fault_manager_config.h +++ b/src/mongo/db/process_health/fault_manager_config.h @@ -36,6 +36,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/synchronized_value.h" #include @@ -75,7 +76,15 @@ std::ostream& operator<<(std::ostream& os, const FaultState& state); /** * Types of health observers available. */ -enum class FaultFacetType { kSystem, kMock1, kMock2, kTestObserver, kLdap, kDns, kConfigServer }; +enum class MONGO_MOD_PUBLIC FaultFacetType { + kSystem, + kMock1, + kMock2, + kTestObserver, + kLdap, + kDns, + kConfigServer +}; static const StringData FaultFacetTypeStrings[] = { "systemObserver", "mock1", "mock2", "testObserver", "LDAP", "DNS", "configServer"}; @@ -97,7 +106,7 @@ inline std::ostream& operator<<(std::ostream& os, const FaultFacetType& type) { return os; } -class FaultManagerConfig { +class MONGO_MOD_PUBLIC FaultManagerConfig { public: /* Maximum possible jitter added to the time between health checks */ static auto inline constexpr kPeriodicHealthCheckMaxJitter{Milliseconds{100}}; diff --git a/src/mongo/db/process_health/fault_manager_test_suite.h b/src/mongo/db/process_health/fault_manager_test_suite.h index 2d691adb53d..ec6b3874072 100644 --- a/src/mongo/db/process_health/fault_manager_test_suite.h +++ b/src/mongo/db/process_health/fault_manager_test_suite.h @@ -40,6 +40,7 @@ #include "mongo/transport/transport_layer_manager_impl.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/thread_pool.h" +#include "mongo/util/modules.h" #include "mongo/util/tick_source_mock.h" #include @@ -65,7 +66,7 @@ inline std::unique_ptr getConfigWithDisabledPeriodicChecks() * Test wrapper class for FaultManager that has access to protected methods * for testing. */ -class FaultManagerTestImpl : public FaultManager { +class MONGO_MOD_NEEDS_REPLACEMENT FaultManagerTestImpl : public FaultManager { public: FaultManagerTestImpl(ServiceContext* svcCtx, std::shared_ptr taskExecutor, @@ -122,9 +123,9 @@ public: /** * Test suite for fault manager. */ -class FaultManagerTest : service_context_test::WithSetupTransportLayer, - service_context_test::RouterRoleOverride, - public ClockSourceMockServiceContextTest { +class MONGO_MOD_PUBLIC FaultManagerTest : service_context_test::WithSetupTransportLayer, + service_context_test::RouterRoleOverride, + public ClockSourceMockServiceContextTest { public: void setUp() override { HealthObserverRegistration::resetObserverFactoriesForTest(); diff --git a/src/mongo/db/process_health/health_check_status.h b/src/mongo/db/process_health/health_check_status.h index 090efe8b01c..16e7acb9b26 100644 --- a/src/mongo/db/process_health/health_check_status.h +++ b/src/mongo/db/process_health/health_check_status.h @@ -31,6 +31,7 @@ #include "mongo/base/string_data.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/process_health/fault_manager_config.h" +#include "mongo/util/modules.h" #include #include @@ -38,7 +39,7 @@ namespace mongo { namespace process_health { -enum class Severity { kOk, kFailure }; +enum class MONGO_MOD_PUBLIC Severity { kOk, kFailure }; static const StringData SeverityStrings[] = {"kOk", "kFailure"}; inline StringBuilder& operator<<(StringBuilder& s, const Severity& sev) { @@ -51,7 +52,7 @@ inline std::ostream& operator<<(std::ostream& s, const Severity& sev) { /** * Immutable class representing current status of an ongoing fault tracked by facet. */ -class HealthCheckStatus { +class MONGO_MOD_PUBLIC HealthCheckStatus { public: HealthCheckStatus(FaultFacetType type, Severity severity, StringData description) : _type(type), _severity(severity), _description(description) {} diff --git a/src/mongo/db/process_health/health_observer.h b/src/mongo/db/process_health/health_observer.h index 0c48350c079..cd9eb6a7a84 100644 --- a/src/mongo/db/process_health/health_observer.h +++ b/src/mongo/db/process_health/health_observer.h @@ -37,6 +37,7 @@ #include "mongo/util/cancellation.h" #include "mongo/util/duration.h" #include "mongo/util/future.h" +#include "mongo/util/modules.h" #include "mongo/util/time_support.h" #include @@ -75,7 +76,7 @@ struct HealthObserverLivenessStats { /** * Interface to conduct periodic health checks. */ -class HealthObserver { +class MONGO_MOD_PUBLIC HealthObserver { public: virtual ~HealthObserver() = default; diff --git a/src/mongo/db/process_health/health_observer_base.h b/src/mongo/db/process_health/health_observer_base.h index 432f3bf25b9..9fc246e0176 100644 --- a/src/mongo/db/process_health/health_observer_base.h +++ b/src/mongo/db/process_health/health_observer_base.h @@ -43,6 +43,7 @@ #include "mongo/util/duration.h" #include "mongo/util/future.h" #include "mongo/util/hierarchical_acquisition.h" +#include "mongo/util/modules.h" #include "mongo/util/tick_source.h" #include "mongo/util/time_support.h" @@ -59,7 +60,7 @@ namespace process_health { * Every instance of health observer is wired internally to update the state of the FaultManager * when a problem is detected. */ -class HealthObserverBase : public HealthObserver { +class MONGO_MOD_OPEN HealthObserverBase : public HealthObserver { public: explicit HealthObserverBase(ServiceContext* svcCtx); ~HealthObserverBase() override = default; diff --git a/src/mongo/db/process_health/health_observer_registration.h b/src/mongo/db/process_health/health_observer_registration.h index 3f54e874b8a..1a199c84109 100644 --- a/src/mongo/db/process_health/health_observer_registration.h +++ b/src/mongo/db/process_health/health_observer_registration.h @@ -30,6 +30,7 @@ #include "mongo/db/process_health/health_observer.h" #include "mongo/db/service_context.h" +#include "mongo/util/modules.h" #include #include @@ -42,7 +43,7 @@ namespace process_health { * Registration mechanism for all health observers. * This is static class not requiring an instance to work. */ -class HealthObserverRegistration { +class MONGO_MOD_PUBLIC HealthObserverRegistration { public: /** * Registers a factory method, which will be invoked later to instantiate the observer. diff --git a/src/mongo/executor/split_timer.h b/src/mongo/executor/split_timer.h index 50adac9a6a4..7488a522ea7 100644 --- a/src/mongo/executor/split_timer.h +++ b/src/mongo/executor/split_timer.h @@ -35,6 +35,7 @@ #include "mongo/logv2/log.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include "mongo/util/timer.h" #include @@ -114,7 +115,7 @@ private: * - nonstatic makeTimer to initialize Timer. */ template -class SplitTimer { +class MONGO_MOD_PUBLIC SplitTimer { private: template static constexpr size_t _idx(E e) { diff --git a/src/mongo/otel/metrics/metrics_initialization.h b/src/mongo/otel/metrics/metrics_initialization.h index a3cc6e7dea6..06489211b98 100644 --- a/src/mongo/otel/metrics/metrics_initialization.h +++ b/src/mongo/otel/metrics/metrics_initialization.h @@ -31,6 +31,7 @@ #include "mongo/base/status.h" #include "mongo/config.h" +#include "mongo/util/modules.h" #include @@ -38,11 +39,11 @@ namespace mongo::otel::metrics { /** * Initializes OpenTelemetry metrics using either the HTTP or file exporter. */ -Status initialize(const std::string& name); +MONGO_MOD_PUBLIC Status initialize(const std::string& name); /** * Shuts down the OpenTelemetry metric export process by setting the global MeterProvider to a * NoopMeterProvider. */ -void shutdown(); +MONGO_MOD_PUBLIC void shutdown(); } // namespace mongo::otel::metrics diff --git a/src/mongo/otel/telemetry_context_holder.h b/src/mongo/otel/telemetry_context_holder.h index 0dd9616dd9d..07dc01000f6 100644 --- a/src/mongo/otel/telemetry_context_holder.h +++ b/src/mongo/otel/telemetry_context_holder.h @@ -32,6 +32,7 @@ #include "mongo/db/client.h" #include "mongo/db/operation_context.h" #include "mongo/otel/telemetry_context.h" +#include "mongo/util/modules.h" #include @@ -44,7 +45,7 @@ namespace otel { * propagate parent / child relationships between Spans as well as hold metadata to correlate * various telemetry data. */ -class TelemetryContextHolder { +class MONGO_MOD_PUBLIC TelemetryContextHolder { public: static TelemetryContextHolder& get(OperationContext* opCtx); diff --git a/src/mongo/otel/telemetry_context_serialization.h b/src/mongo/otel/telemetry_context_serialization.h index 64bc6cf82b9..132591f8397 100644 --- a/src/mongo/otel/telemetry_context_serialization.h +++ b/src/mongo/otel/telemetry_context_serialization.h @@ -32,14 +32,14 @@ #include "mongo/bson/bsonobj.h" #include "mongo/db/operation_context.h" #include "mongo/otel/telemetry_context.h" +#include "mongo/util/modules.h" #ifdef MONGO_CONFIG_OTEL #include #endif - namespace mongo { -namespace otel { +namespace MONGO_MOD_PUBLIC otel { #ifdef MONGO_CONFIG_OTEL @@ -80,5 +80,5 @@ public: #endif -} // namespace otel +} // namespace MONGO_MOD_PUBLIC otel } // namespace mongo diff --git a/src/mongo/otel/traces/bson_text_map_carrier.h b/src/mongo/otel/traces/bson_text_map_carrier.h index cc9d9efbe38..21364006d74 100644 --- a/src/mongo/otel/traces/bson_text_map_carrier.h +++ b/src/mongo/otel/traces/bson_text_map_carrier.h @@ -31,6 +31,7 @@ #include "mongo/bson/bsonobj.h" #include "mongo/otel/traces/tracing_utils.h" +#include "mongo/util/modules.h" #include @@ -45,7 +46,7 @@ using opentelemetry::nostd::function_ref; * providing interoperability between BSONObj and OpenTelemetry TextMap Propagators * (https://opentelemetry.io/docs/specs/otel/context/api-propagators/#textmap-propagator). */ -class BSONTextMapCarrier : public TextMapCarrier { +class MONGO_MOD_PARENT_PRIVATE BSONTextMapCarrier : public TextMapCarrier { public: /** * Default constructor with an empty initial BSONObj. Intended to be used when using a diff --git a/src/mongo/otel/traces/otel_test_fixture.h b/src/mongo/otel/traces/otel_test_fixture.h index 73fd3b7af6f..f069a11d41b 100644 --- a/src/mongo/otel/traces/otel_test_fixture.h +++ b/src/mongo/otel/traces/otel_test_fixture.h @@ -32,6 +32,7 @@ #include "mongo/db/service_context_test_fixture.h" #include "mongo/otel/traces/mock_exporter.h" #include "mongo/otel/traces/tracer_provider_service.h" +#include "mongo/util/modules.h" #include #include @@ -45,7 +46,7 @@ namespace traces { * Test fixture for tests that require OpenTelemetry TracerProvider to be initialized. * Sets up a TracerProvider with MockExporter so tests can create and inspect spans. */ -class OtelTestFixture : public ServiceContextTest { +class MONGO_MOD_OPEN OtelTestFixture : public ServiceContextTest { public: void setUp() override { ServiceContextTest::setUp(); diff --git a/src/mongo/otel/traces/span/span.h b/src/mongo/otel/traces/span/span.h index 4ad48e863d0..80f78019a4c 100644 --- a/src/mongo/otel/traces/span/span.h +++ b/src/mongo/otel/traces/span/span.h @@ -33,12 +33,13 @@ #include "mongo/config.h" #include "mongo/db/operation_context.h" #include "mongo/otel/telemetry_context.h" +#include "mongo/util/modules.h" #include namespace mongo { namespace otel { -namespace traces { +namespace MONGO_MOD_PUBLIC traces { #ifdef MONGO_CONFIG_OTEL @@ -141,6 +142,6 @@ public: #endif -} // namespace traces +} // namespace MONGO_MOD_PUBLIC traces } // namespace otel } // namespace mongo diff --git a/src/mongo/otel/traces/span/span_telemetry_context_impl.h b/src/mongo/otel/traces/span/span_telemetry_context_impl.h index b90ab424419..41686111f9d 100644 --- a/src/mongo/otel/traces/span/span_telemetry_context_impl.h +++ b/src/mongo/otel/traces/span/span_telemetry_context_impl.h @@ -31,6 +31,7 @@ #include "mongo/base/string_data.h" #include "mongo/otel/telemetry_context.h" +#include "mongo/util/modules.h" #include #include @@ -53,7 +54,7 @@ constexpr OtelStringView falseValue = "false"; * SpanTelemetryContextImpl is an implementation of TelemetryContext that wraps OpenTelemetry's * Context to allow for propagation of span state across OpenTelemetry functionality. */ -class SpanTelemetryContextImpl : public TelemetryContext { +class MONGO_MOD_NEEDS_REPLACEMENT SpanTelemetryContextImpl : public TelemetryContext { public: explicit SpanTelemetryContextImpl(OtelContext ctx); SpanTelemetryContextImpl() : _ctx() {} diff --git a/src/mongo/otel/traces/trace_initialization.h b/src/mongo/otel/traces/trace_initialization.h index ac8259f2b8e..f05f983c27b 100644 --- a/src/mongo/otel/traces/trace_initialization.h +++ b/src/mongo/otel/traces/trace_initialization.h @@ -32,10 +32,12 @@ #include "mongo/base/status.h" #include "mongo/config.h" #include "mongo/db/service_context.h" +#include "mongo/util/modules.h" #include -namespace mongo::otel::traces { +namespace mongo::otel { +namespace MONGO_MOD_PUBLIC traces { #ifdef MONGO_CONFIG_OTEL @@ -52,4 +54,5 @@ inline void shutdown(ServiceContext* serviceContext) {} #endif -} // namespace mongo::otel::traces +} // namespace MONGO_MOD_PUBLIC traces +} // namespace mongo::otel diff --git a/src/mongo/otel/traces/tracing.h b/src/mongo/otel/traces/tracing.h index fa638c13217..25abefd8543 100644 --- a/src/mongo/otel/traces/tracing.h +++ b/src/mongo/otel/traces/tracing.h @@ -30,9 +30,11 @@ #pragma once #include "mongo/db/operation_context.h" +#include "mongo/rpc/metadata/metadata_hook.h" +#include "mongo/util/modules.h" namespace mongo::otel::traces { -bool isTracingEnabled(OperationContext* opCtx); +MONGO_MOD_PUBLIC bool isTracingEnabled(OperationContext* opCtx); } diff --git a/src/mongo/otel/traces/tracing_feature_flag.idl b/src/mongo/otel/traces/tracing_feature_flag.idl index 8b78e995a8c..b138781fe89 100644 --- a/src/mongo/otel/traces/tracing_feature_flag.idl +++ b/src/mongo/otel/traces/tracing_feature_flag.idl @@ -34,6 +34,7 @@ imports: feature_flags: featureFlagTracing: + mod_visibility: public description: "Feature flag for enabling the creation of tracing spans in the server code." cpp_varname: gFeatureFlagTracing default: false diff --git a/src/mongo/util/observable_mutex.h b/src/mongo/util/observable_mutex.h index 180956bd670..687f8d7ff42 100644 --- a/src/mongo/util/observable_mutex.h +++ b/src/mongo/util/observable_mutex.h @@ -32,6 +32,7 @@ #include "mongo/platform/atomic.h" #include "mongo/platform/compiler.h" #include "mongo/stdx/mutex.h" +#include "mongo/util/modules.h" #include "mongo/util/scopeguard.h" #include @@ -42,7 +43,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { namespace observable_mutex_details { template @@ -215,13 +216,13 @@ public: _mutex.unlock_shared(); } - void setExclusiveAcquisitions_forTest(MutexAcquisitionStats stat) { + MONGO_MOD_NEEDS_REPLACEMENT void setExclusiveAcquisitions_forTest(MutexAcquisitionStats stat) { _exclusiveAcquisitions.contentions.store(stat.contentions); _exclusiveAcquisitions.total.store(stat.total); _exclusiveAcquisitions.waitCycles.store(stat.waitCycles); } - void setSharedAcquisitions_forTest(MutexAcquisitionStats stat) { + MONGO_MOD_NEEDS_REPLACEMENT void setSharedAcquisitions_forTest(MutexAcquisitionStats stat) { _sharedAcquisitions.contentions.store(stat.contentions); _sharedAcquisitions.total.store(stat.total); _sharedAcquisitions.waitCycles.store(stat.waitCycles); @@ -265,4 +266,4 @@ using ObservableMutex = MutexType; using ObservableExclusiveMutex = ObservableMutex; using ObservableSharedMutex = ObservableMutex; // NOLINT -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/util/observable_mutex_registry.h b/src/mongo/util/observable_mutex_registry.h index 364bc1ed101..0c7f3a73fee 100644 --- a/src/mongo/util/observable_mutex_registry.h +++ b/src/mongo/util/observable_mutex_registry.h @@ -31,6 +31,7 @@ #include "mongo/base/string_data.h" #include "mongo/bson/bsonobj.h" +#include "mongo/util/modules.h" #include "mongo/util/observable_mutex.h" #include "mongo/util/string_map.h" #include "mongo/util/system_clock_source.h" @@ -42,7 +43,7 @@ namespace mongo { * The registry keeps track of all registered instances of `ObservableMutex` and provides an * interface to collect contention stats. */ -class ObservableMutexRegistry { +class MONGO_MOD_PUBLIC ObservableMutexRegistry { public: static constexpr auto kTotalAcquisitionsFieldName = "total"_sd; static constexpr auto kTotalContentionsFieldName = "contentions"_sd; diff --git a/src/mongo/watchdog/watchdog.h b/src/mongo/watchdog/watchdog.h index bd4660251f8..d3eeb77c6eb 100644 --- a/src/mongo/watchdog/watchdog.h +++ b/src/mongo/watchdog/watchdog.h @@ -36,6 +36,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/duration.h" +#include "mongo/util/modules.h" #include #include @@ -45,7 +46,7 @@ #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class OperationContext; class ServiceContext; @@ -117,7 +118,7 @@ private: * - sleep(period) * - callback */ -class WatchdogPeriodicThread { +class MONGO_MOD_OPEN WatchdogPeriodicThread { public: WatchdogPeriodicThread(Milliseconds period, StringData threadName); virtual ~WatchdogPeriodicThread() = default; @@ -346,7 +347,7 @@ public: /** * Gets whether checks are paused or not. For testing purposes only. */ - virtual bool getShouldRunChecks_forTest() = 0; + MONGO_MOD_PUBLIC virtual bool getShouldRunChecks_forTest() = 0; }; @@ -445,4 +446,4 @@ private: WatchdogMonitorThread _watchdogMonitorThread; }; -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/watchdog/watchdog_mock.h b/src/mongo/watchdog/watchdog_mock.h index 550410c92a9..d6db34af619 100644 --- a/src/mongo/watchdog/watchdog_mock.h +++ b/src/mongo/watchdog/watchdog_mock.h @@ -28,7 +28,9 @@ */ #pragma once + #include "mongo/platform/atomic_word.h" +#include "mongo/util/modules.h" #include "mongo/watchdog/watchdog.h" namespace mongo { @@ -37,7 +39,7 @@ namespace mongo { * A mock WatchdogMonitor for use in C++ unit tests. * */ -class WatchdogMonitorMock final : public WatchdogMonitorInterface { +class MONGO_MOD_PUBLIC WatchdogMonitorMock final : public WatchdogMonitorInterface { public: WatchdogMonitorMock() = default; ~WatchdogMonitorMock() override = default; diff --git a/src/mongo/watchdog/watchdog_mongod.h b/src/mongo/watchdog/watchdog_mongod.h index 646e8c5b7a1..4a68c34a2b5 100644 --- a/src/mongo/watchdog/watchdog_mongod.h +++ b/src/mongo/watchdog/watchdog_mongod.h @@ -31,11 +31,12 @@ #include "mongo/base/status.h" #include "mongo/db/tenant_id.h" +#include "mongo/util/modules.h" #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { class ServiceContext; @@ -50,4 +51,4 @@ void startWatchdog(ServiceContext* service); Status validateWatchdogPeriodSeconds(const int& value, const boost::optional&); Status onUpdateWatchdogPeriodSeconds(const int& value); -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo diff --git a/src/mongo/watchdog/watchdog_register.h b/src/mongo/watchdog/watchdog_register.h index 5a7c8f57571..5c7d7629c3b 100644 --- a/src/mongo/watchdog/watchdog_register.h +++ b/src/mongo/watchdog/watchdog_register.h @@ -30,11 +30,12 @@ #pragma once #include "mongo/base/string_data.h" +#include "mongo/util/modules.h" #include #include -namespace mongo { +namespace MONGO_MOD_PUBLIC mongo { /** * Allow components a way to tell the watchdog what to watch. @@ -46,4 +47,4 @@ void registerWatchdogPath(StringData path); */ std::vector& getWatchdogPaths(); -} // namespace mongo +} // namespace MONGO_MOD_PUBLIC mongo