diff --git a/CHANGELOG.md b/CHANGELOG.md index a76b91692b..9acee42235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,13 @@ Breaking changes: * This header should not be included directly in an application. If this is the case, please remove any remaining include directives. +* [BUILD] Fix exported definitions when building DLL with STL + [#2387](https://github.com/open-telemetry/opentelemetry-cpp/pull/2387) + * The MeterSelector, MeterSelectorFactory, InstrumentSelector, + and InstrumentSelectorFactory APIs now use const std::string& + instead of nostd::string_view for name, version and schema to + maintain a single export definition for DLL. + ## [1.12.0] 2023-10-16 * [BUILD] Support `pkg-config` diff --git a/ext/src/dll/opentelemetry_cpp.src b/ext/src/dll/opentelemetry_cpp.src index 49226ec543..10172dbb3f 100644 --- a/ext/src/dll/opentelemetry_cpp.src +++ b/ext/src/dll/opentelemetry_cpp.src @@ -72,11 +72,10 @@ EXPORTS ?Create@ViewFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VView@metrics@sdk@v1@opentelemetry@@U?$default_delete@VView@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@7@00W4AggregationType@2345@V?$shared_ptr@VAggregationConfig@metrics@sdk@v1@opentelemetry@@@7@@Z // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::metrics::ViewFactory::Create(class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &,enum opentelemetry::v1::sdk::metrics::AggregationType) ?Create@ViewFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VView@metrics@sdk@v1@opentelemetry@@U?$default_delete@VView@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@7@00W4AggregationType@2345@@Z - // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::metrics::MeterSelectorFactory::Create(class opentelemetry::v1::nostd::string_view,class opentelemetry::v1::nostd::string_view,class opentelemetry::v1::nostd::string_view) - ?Create@MeterSelectorFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VMeterSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VMeterSelector@metrics@sdk@v1@opentelemetry@@@std@@@std@@Vstring_view@nostd@45@00@Z - // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::metrics::InstrumentSelectorFactory::Create(enum opentelemetry::v1::sdk::metrics::InstrumentType,class opentelemetry::v1::nostd::string_view,class opentelemetry::v1::nostd::string_view) - ?Create@InstrumentSelectorFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@@std@@@std@@W4InstrumentType@2345@Vstring_view@nostd@45@1@Z - + // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::metrics::MeterSelectorFactory::Create(class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &) + ?Create@MeterSelectorFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VMeterSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VMeterSelector@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@7@00@Z + // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::metrics::InstrumentSelectorFactory::Create(enum opentelemetry::v1::sdk::metrics::InstrumentType,class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &) + ?Create@InstrumentSelectorFactory@metrics@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@@std@@@std@@W4InstrumentType@2345@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@7@1@Z // public: void __cdecl opentelemetry::v1::sdk::metrics::MeterContext::AddMetricReader(class std::shared_ptr) ?AddMetricReader@MeterContext@metrics@sdk@v1@opentelemetry@@QEAAXV?$shared_ptr@VMetricReader@metrics@sdk@v1@opentelemetry@@@std@@@Z // public: void __cdecl opentelemetry::v1::sdk::metrics::MeterProvider::AddMetricReader(class std::shared_ptr) @@ -84,7 +83,6 @@ EXPORTS // public: void __cdecl opentelemetry::v1::sdk::metrics::MeterProvider::AddView(class std::unique_ptr >,class std::unique_ptr >,class std::unique_ptr >) ?AddView@MeterProvider@metrics@sdk@v1@opentelemetry@@QEAAXV?$unique_ptr@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VInstrumentSelector@metrics@sdk@v1@opentelemetry@@@std@@@std@@V?$unique_ptr@VMeterSelector@metrics@sdk@v1@opentelemetry@@U?$default_delete@VMeterSelector@metrics@sdk@v1@opentelemetry@@@std@@@7@V?$unique_ptr@VView@metrics@sdk@v1@opentelemetry@@U?$default_delete@VView@metrics@sdk@v1@opentelemetry@@@std@@@7@@Z - #if defined(WITH_OTLP_GRPC) || defined(WITH_OTLP_HTTP) ?GetOtlpDefaultTracesTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ ?GetOtlpDefaultTracesHeaders@otlp@exporter@v1@opentelemetry@@YA?AV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@Ucmp_ic@otlp@exporter@v1@opentelemetry@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@XZ diff --git a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h index 67c8592bb6..690a9168d0 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h @@ -4,8 +4,8 @@ #pragma once #include +#include -#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/view/predicate_factory.h" #include "opentelemetry/version.h" @@ -19,8 +19,8 @@ class InstrumentSelector { public: InstrumentSelector(opentelemetry::sdk::metrics::InstrumentType instrument_type, - opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view units) + const std::string &name, + const std::string &units) : name_filter_{PredicateFactory::GetPredicate(name, PredicateType::kPattern)}, unit_filter_{PredicateFactory::GetPredicate(units, PredicateType::kExact)}, instrument_type_{instrument_type} diff --git a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector_factory.h b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector_factory.h index 0af1efe04b..3c221f123b 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector_factory.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector_factory.h @@ -3,7 +3,8 @@ #pragma once -#include "opentelemetry/nostd/string_view.h" +#include + #include "opentelemetry/sdk/metrics/instruments.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -19,8 +20,8 @@ class OPENTELEMETRY_EXPORT InstrumentSelectorFactory public: static std::unique_ptr Create( opentelemetry::sdk::metrics::InstrumentType instrument_type, - opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view unit); + const std::string &name, + const std::string &unit); }; } // namespace metrics diff --git a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h index 16d777b71f..65dba7d7b9 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h @@ -4,8 +4,8 @@ #pragma once #include +#include -#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/metrics/view/predicate_factory.h" #include "opentelemetry/version.h" @@ -17,9 +17,7 @@ namespace metrics class MeterSelector { public: - MeterSelector(opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view version, - opentelemetry::nostd::string_view schema) + MeterSelector(const std::string &name, const std::string &version, const std::string &schema) : name_filter_{PredicateFactory::GetPredicate(name, PredicateType::kExact)}, version_filter_{PredicateFactory::GetPredicate(version, PredicateType::kExact)}, schema_filter_{PredicateFactory::GetPredicate(schema, PredicateType::kExact)} diff --git a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector_factory.h b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector_factory.h index bd599d9c4b..47aa77b772 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector_factory.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector_factory.h @@ -4,8 +4,8 @@ #pragma once #include +#include -#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -19,9 +19,9 @@ class MeterSelector; class OPENTELEMETRY_EXPORT MeterSelectorFactory { public: - static std::unique_ptr Create(opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view version, - opentelemetry::nostd::string_view schema); + static std::unique_ptr Create(const std::string &name, + const std::string &version, + const std::string &schema); }; } // namespace metrics diff --git a/sdk/src/metrics/view/instrument_selector_factory.cc b/sdk/src/metrics/view/instrument_selector_factory.cc index 98a587ea62..5cf4a5b968 100644 --- a/sdk/src/metrics/view/instrument_selector_factory.cc +++ b/sdk/src/metrics/view/instrument_selector_factory.cc @@ -13,8 +13,8 @@ namespace metrics std::unique_ptr InstrumentSelectorFactory::Create( opentelemetry::sdk::metrics::InstrumentType instrument_type, - opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view unit) + const std::string &name, + const std::string &unit) { std::unique_ptr instrument_selector( new InstrumentSelector(instrument_type, name, unit)); diff --git a/sdk/src/metrics/view/meter_selector_factory.cc b/sdk/src/metrics/view/meter_selector_factory.cc index f8f906d9ad..088dcd864e 100644 --- a/sdk/src/metrics/view/meter_selector_factory.cc +++ b/sdk/src/metrics/view/meter_selector_factory.cc @@ -11,10 +11,9 @@ namespace sdk namespace metrics { -std::unique_ptr MeterSelectorFactory::Create( - opentelemetry::nostd::string_view name, - opentelemetry::nostd::string_view version, - opentelemetry::nostd::string_view schema) +std::unique_ptr MeterSelectorFactory::Create(const std::string &name, + const std::string &version, + const std::string &schema) { std::unique_ptr meter_selector(new MeterSelector(name, version, schema)); return meter_selector;