SERVER-115315 Fix -Werror=subobject-linkage in metrics test util header (#45305)

GitOrigin-RevId: 3923d72c3f3d09bb2ea870454a11d21fa663b969
This commit is contained in:
Erin McNulty 2025-12-16 13:09:23 -05:00 committed by MongoDB Bot
parent 7296788d8f
commit dbfa36321a
1 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@
namespace mongo::otel::metrics { namespace mongo::otel::metrics {
namespace { namespace test_util_detail {
/** /**
* The MetricReader is the OTel component that connects the exporter with each registered * The MetricReader is the OTel component that connects the exporter with each registered
* Instrument. This implementation allows callers to trigger collection on-demand so that unit tests * Instrument. This implementation allows callers to trigger collection on-demand so that unit tests
@ -79,7 +79,7 @@ private:
std::unique_ptr<opentelemetry::sdk::metrics::PushMetricExporter> _exporter; std::unique_ptr<opentelemetry::sdk::metrics::PushMetricExporter> _exporter;
}; };
} // namespace } // namespace test_util_detail
bool isNoopMeter(opentelemetry::metrics::Meter* provider) { bool isNoopMeter(opentelemetry::metrics::Meter* provider) {
return !!dynamic_cast<opentelemetry::metrics::NoopMeter*>(provider); return !!dynamic_cast<opentelemetry::metrics::NoopMeter*>(provider);
@ -105,7 +105,7 @@ public:
auto exporter = opentelemetry::exporter::memory::InMemoryMetricExporterFactory::Create( auto exporter = opentelemetry::exporter::memory::InMemoryMetricExporterFactory::Create(
std::move(metrics)); std::move(metrics));
auto reader = std::make_shared<OnDemandMetricReader>(std::move(exporter)); auto reader = std::make_shared<test_util_detail::OnDemandMetricReader>(std::move(exporter));
_reader = reader.get(); _reader = reader.get();
std::shared_ptr<opentelemetry::sdk::metrics::MeterProvider> provider = std::shared_ptr<opentelemetry::sdk::metrics::MeterProvider> provider =
@ -127,7 +127,7 @@ private:
RAIIServerParameterControllerForTest _featureFlagController{"featureFlagOtelMetrics", true}; RAIIServerParameterControllerForTest _featureFlagController{"featureFlagOtelMetrics", true};
// Stash the reader so that callers can trigger on-demand metric collection. // Stash the reader so that callers can trigger on-demand metric collection.
OnDemandMetricReader* _reader; test_util_detail::OnDemandMetricReader* _reader;
// This is the in-memory data structure that holds the collected metrics. The exporter writes to // This is the in-memory data structure that holds the collected metrics. The exporter writes to
// this DS, and the get() function will read from it. // this DS, and the get() function will read from it.
opentelemetry::exporter::memory::SimpleAggregateInMemoryMetricData* _metrics; opentelemetry::exporter::memory::SimpleAggregateInMemoryMetricData* _metrics;