diff --git a/CHANGELOG.md b/CHANGELOG.md index 462236afa6..18203926f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,9 @@ Increment the: when building the SDK, with exclude patterns taking precedence. [#3546](https://github.com/open-telemetry/opentelemetry-cpp/issues/3546) +* [CONFIGURATION] Update registry factory to return a unique_ptr + [#4487](https://github.com/open-telemetry/opentelemetry-cpp/pull/4487) + * [CONFIGURATION] Add support for the composite sampler configuration (programmatic and from yaml) ([#4366](https://github.com/open-telemetry/opentelemetry-cpp/pull/4366)) diff --git a/install/test/src/test_sdk.cc b/install/test/src/test_sdk.cc index 128c8385b3..a0e21e16c9 100644 --- a/install/test/src/test_sdk.cc +++ b/install/test/src/test_sdk.cc @@ -601,7 +601,7 @@ TEST_F(SdkInstallTest, ConfigurationCoreCheck) { const std::string propagator_name{"noop"}; - auto registry = config_sdk::RegistryFactory::Create(); + std::shared_ptr registry = config_sdk::RegistryFactory::Create(); registry->SetConsoleSpanBuilder(std::make_unique()); registry->SetConsoleLogRecordBuilder(std::make_unique()); registry->SetConsolePushMetricExporterBuilder(std::make_unique()); diff --git a/sdk/include/opentelemetry/sdk/configuration/registry_factory.h b/sdk/include/opentelemetry/sdk/configuration/registry_factory.h index bb090ca32e..92b0991cf0 100644 --- a/sdk/include/opentelemetry/sdk/configuration/registry_factory.h +++ b/sdk/include/opentelemetry/sdk/configuration/registry_factory.h @@ -18,7 +18,7 @@ class RegistryFactory { public: // Returns a Registry pre-populated with all default signal builders. - static std::shared_ptr Create(); + static std::unique_ptr Create(); }; } // namespace configuration diff --git a/sdk/src/configuration/registry_factory.cc b/sdk/src/configuration/registry_factory.cc index 4bf720f51b..a506b303f7 100644 --- a/sdk/src/configuration/registry_factory.cc +++ b/sdk/src/configuration/registry_factory.cc @@ -16,9 +16,9 @@ namespace sdk namespace configuration { -std::shared_ptr RegistryFactory::Create() +std::unique_ptr RegistryFactory::Create() { - auto registry = std::make_shared(); + auto registry = std::make_unique(); RegisterDefaultTraceBuilders(registry.get()); RegisterDefaultMetricsBuilders(registry.get()); RegisterDefaultLogsBuilders(registry.get());