Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPORTER] Rework OTLP/HTTP and OTLP/GRPC exporter options #2388

Merged
merged 17 commits into from
Nov 13, 2023

Conversation

marcalff
Copy link
Member

@marcalff marcalff commented Oct 28, 2023

Fixes #1845
Contributes to #2202
Contributes to #1429

Changes

This fix refactored the OTLP/HTTP and OTLP/GRPC exporter options.

OTLP/GRPC exporters uses the wrong environment variables

Before the fix, the class hierarchy was:

struct OtlpGrpcExporterOptions;
struct OtlpGrpcMetricExporterOptions : public OtlpGrpcExporterOptions
// no OtlpGrpcLogRecordExporterOptions

After the fix, it is changed to:

struct OtlpGrpcExporterOptions : public OtlpGrpcClientOptions
struct OtlpGrpcMetricExporterOptions : public OtlpGrpcClientOptions
struct OtlpGrpcLogRecordExporterOptions : public OtlpGrpcClientOptions

This resolved issue #1845

OTLP/GRPC exporters causes a lot of symbols to be visible

Reading the default configuration from environment variables,
with helpers such as GetOtlpDefaultGrpcEndpoint(),
was done in code inlined in the header file.

This causes various GetOtlpDefaultGrpcEndpoint() helpers to leak into the application at build time,
causing issues when building a DLL on Windows when GetOtlpXXX() helpers are not exported.

This is fixed by declaring a constructor for options structs,
and moving all the default initialization in the constructor implementation,
located in a *.cc file, in the opentelemetry-cpp libraries.

Now that the application code no longer must sees GetOtlpXXX() helpers, the dependencies are simpler.

Note that helper functions GetOtlpXXX() are still visible and exported, for applications that uses them directly.

This contributes to fix issues #2202 and #1429

OTLP/HTTP exporters causes a lot of symbols to be visible

Likewise for the OTLP/HTTP exporter.

This contributes to fix issues #2202 and #1429

Added missing OTLP/GRPC unit tests for the Metrics exporter.

The unit tests added only check the configuration part.

Adjust list of symbols exported on Windows, when building a DLL.

File ext/src/dll/opentelemetry_cpp.src is adjusted to export the new options structs constructors and destructors.

Thanks to @perhapsmaple for contributing this change.

Follow up work

The following is not part of the PR, to be done in separate fixes:

  • For OTLP/HTTP, consider inheritance from Signal options structs to OtlpHttpClientOptions
    • This pattern works well with OTLP/GRPC, and can be also used.
    • Waiting for OTLP/HTTP SSL options to go mainline, and may require some additional refactoring for ssl options.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov
Copy link

codecov bot commented Oct 28, 2023

Codecov Report

Merging #2388 (dbb6421) into main (5bd9c65) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2388   +/-   ##
=======================================
  Coverage   87.43%   87.43%           
=======================================
  Files         199      199           
  Lines        6028     6028           
=======================================
  Hits         5270     5270           
  Misses        758      758           

@marcalff marcalff changed the title [EXPORTER] Options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables [EXPORTER] Rework OTLP/HTTP and OTLP/GRPC exporter options Oct 29, 2023
@marcalff marcalff marked this pull request as ready for review October 29, 2023 17:27
@marcalff marcalff requested a review from a team October 29, 2023 17:27
@marcalff
Copy link
Member Author

Also tested with examples:

malff@localhost.localdomain:otlp> export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=POISON
malff@localhost.localdomain:otlp> export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=GOOD
malff@localhost.localdomain:otlp> ./example_otlp_grpc_metric
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc:75 [OTLP METRIC GRPC Exporter] Export() failed: DNS resolution failed for GOOD:80: C-ares status is not ARES_SUCCESS qtype=AAAA name=GOOD is_balancer=0: Domain name not found
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc:75 [OTLP METRIC GRPC Exporter] Export() failed: DNS resolution failed for GOOD:80: C-ares status is not ARES_SUCCESS qtype=AAAA name=GOOD is_balancer=0: Domain name not found

This proves example_otlp_grpc_metric uses OTEL_EXPORTER_OTLP_METRICS_ENDPOINT instead of OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.

Likewise for logs:

malff@localhost.localdomain:otlp> env | grep OTEL_EXPORTER
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=BETTER
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=POISON
malff@localhost.localdomain:otlp> ./example_otlp_http_log
Using BETTER to export log records.
Using POISON to export trace spans.
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc:200 [OTLP HTTP Client] Session state: connection failed.Could not resolve host: BETTER
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_log_record_exporter.cc:124 [OTLP HTTP Client] ERROR: Export 1 log(s) error: 1
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc:200 [OTLP HTTP Client] Session state: connection failed.Could not resolve host: POISON
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_exporter.cc:123 [OTLP HTTP Client] ERROR: Export 1 trace span(s) error: 1
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_client.cc:200 [OTLP HTTP Client] Session state: connection failed.Could not resolve host: POISON
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_http_exporter.cc:123 [OTLP HTTP Client] ERROR: Export 1 trace span(s) error: 1

The log exporter uses OTEL_EXPORTER_OTLP_LOGS_ENDPOINT.

@Dangeroustuber
Copy link

I've attempted to build this on windows doing the following steps:

git clone --single-branch --branch fix_exporter_option_1845 --recursive https://github.com/marcalff/opentelemetry-cpp.git

cd opentelemetry-cpp && mkdir build && cd build

open a x64 visual studio command prompt for ninja and cmake configuration at cmd line.

cmake .. -G Ninja -DWITH_STL=ON -DCMAKE_CXX_STANDARD=23 -DOPENTELEMETRY_BUILD_DLL=ON -DOPENTELEMETRY_INSTALL=ON -DBUILD_TESTING=ON -DWITH_OTLP_HTTP=ON -DWITH_FUNC_TESTS=OFF -DWITH_EXAMPLES_HTTP=ON -DWITH_EXAMPLES=ON -DWITH_ETW=OFF -DWITH_ELASTICSEARCH=OFF -DWITH_BENCHMARK=OFF

ninja

This quickly errors with probably just a missing header

output:

C:\dev\otel-marc-test\opentelemetry-cpp\build>ninja
[2/376] Building CXX object api\test\context\CMakeFiles\runtime_context_test.dir\runtime_context_test.cc.obj
FAILED: api/test/context/CMakeFiles/runtime_context_test.dir/runtime_context_test.cc.obj
C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\cl.exe  /nologo /TP -DENABLE_HTTP_SSL_PREVIEW -DENABLE_HTTP_SSL_TLS_PREVIEW -DENABLE_OTLP_HTTP_SSL_PREVIEW -DENABLE_OTLP_HTTP_SSL_TLS_PREVIEW -DENABLE_TEST -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DNOMINMAX -DOPENTELEMETRY_ABI_VERSION_NO=1 -DOPENTELEMETRY_BUILD_EXPORT_DLL -DOPENTELEMETRY_STL_VERSION=2023 -IC:\dev\otel-marc-test\opentelemetry-cpp\build\generated\third_party\opentelemetry-proto -IC:\dev\otel-marc-test\opentelemetry-cpp\api\include -external:IC:\dev\otel-marc-test\opentelemetry-cpp\tools\vcpkg\installed\x64-windows\include -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /Od /Zc:__cplusplus /MDd /Zi /Ob0 /Od /RTC1 -std:c++latest /showIncludes /Foapi\test\context\CMakeFiles\runtime_context_test.dir\runtime_context_test.cc.obj /Fdapi\test\context\CMakeFiles\runtime_context_test.dir\ /FS -c C:\dev\otel-marc-test\opentelemetry-cpp\api\test\context\runtime_context_test.cc
C:\dev\otel-marc-test\opentelemetry-cpp\api\test\context\runtime_context_test.cc(134): error C2039: 'next_permutation': is not a member of 'std'
C:\dev\otel-marc-test\opentelemetry-cpp\tools\vcpkg\installed\x64-windows\include\gtest/internal/gtest-internal.h(1323): note: see declaration of 'std'
C:\dev\otel-marc-test\opentelemetry-cpp\api\test\context\runtime_context_test.cc(134): error C3861: 'next_permutation': identifier not found
[7/376] Building CXX object api\test\nostd\CMakeFiles\string_view_test.dir\string_view_test.cc.obj
C:\dev\otel-marc-test\opentelemetry-cpp\api\test\nostd\string_view_test.cc(75): warning C4834: discarding return value of function with 'nodiscard' attribute
[17/376] Building CXX object api\test\context\propagation\CMakeFiles\composite_propagator_test.dir\composite_propagator_test.cc.obj
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/unique_ptr.h(17): note: see declaration of 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>'
[18/376] Building CXX object api\test\plugin\CMakeFiles\dynamic_load_test.dir\dynamic_load_test.cc.obj
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/unique_ptr.h(17): note: see declaration of 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>'
[19/376] Building CXX object api\test\trace\CMakeFiles\api_provider_test.dir\provider_test.cc.obj
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/unique_ptr.h(17): note: see declaration of 'std::unique_ptr<opentelemetry::v1::common::KeyValueProperties,std::default_delete<opentelemetry::v1::common::KeyValueProperties>>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/shared_ptr.h(17): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'std::unique_ptr<opentelemetry::v1::trace::SpanContext,std::default_delete<opentelemetry::v1::trace::SpanContext>>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/unique_ptr.h(17): note: see declaration of 'std::unique_ptr<opentelemetry::v1::trace::SpanContext,std::default_delete<opentelemetry::v1::trace::SpanContext>>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/std/shared_ptr.h(17): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
ninja: build stopped: subcommand failed.

when i try to build with WITH_STL option set to off it gets quite a bit further in compilation ([360/376]).

If i build with it only building WITH_OTLP_HTTP=ON and everything else off, It does compile. I have not tested that dll with an actual program that does anything. But it does build on my machine.

output from the first time ninja prints "failed" (WITH_STL=OFF):

C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[360/376] Linking CXX executable examples\otlp\example_otlp_http_log.exe
FAILED: examples/otlp/example_otlp_http_log.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=examples\otlp\CMakeFiles\example_otlp_http_log.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http_log.dir\http_log_main.cc.obj  /out:examples\otlp\example_otlp_http_log.exe /implib:examples\otlp\example_otlp_http_log.lib /pdb:examples\otlp\example_otlp_http_log.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  examples\common\logs_foo_library\common_logs_foo_library.lib  ext\src\dll\opentelemetry_cpp.lib  sdk\src\common\opentelemetry_common.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\dev\otel-marc-test\opentelemetry-cpp\build\examples\otlp && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/dev/otel-marc-test/opentelemetry-cpp/build/examples/otlp/example_otlp_http_log.exe -installedDir C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
LINK Pass 1: command "C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http_log.dir\http_log_main.cc.obj /out:examples\otlp\example_otlp_http_log.exe /implib:examples\otlp\example_otlp_http_log.lib /pdb:examples\otlp\example_otlp_http_log.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console examples\common\logs_foo_library\common_logs_foo_library.lib ext\src\dll\opentelemetry_cpp.lib sdk\src\common\opentelemetry_common.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:examples\otlp\CMakeFiles\example_otlp_http_log.dir/intermediate.manifest examples\otlp\CMakeFiles\example_otlp_http_log.dir/manifest.res" failed (exit code 1120) with the following output:
http_log_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::OtlpHttpExporterOptions(void)" (__imp_??0OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'trace_opts''(void)" (??__Etrace_opts@?A0xee6f94dc@@YAXXZ)
http_log_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::~OtlpHttpExporterOptions(void)" (__imp_??1OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic atexit destructor for 'trace_opts''(void)" (??__Ftrace_opts@?A0xee6f94dc@@YAXXZ)
http_log_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions(void)" (__imp_??0OtlpHttpLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'logger_opts''(void)" (??__Elogger_opts@?A0xee6f94dc@@YAXXZ)
http_log_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions::~OtlpHttpLogRecordExporterOptions(void)" (__imp_??1OtlpHttpLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic atexit destructor for 'logger_opts''(void)" (??__Flogger_opts@?A0xee6f94dc@@YAXXZ)
examples\otlp\example_otlp_http_log.exe : fatal error LNK1120: 4 unresolved externals
[361/376] Linking CXX executable examples\otlp\example_otlp_http.exe
FAILED: examples/otlp/example_otlp_http.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=examples\otlp\CMakeFiles\example_otlp_http.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http.dir\http_main.cc.obj  /out:examples\otlp\example_otlp_http.exe /implib:examples\otlp\example_otlp_http.lib /pdb:examples\otlp\example_otlp_http.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  examples\common\foo_library\common_foo_library.lib  ext\src\dll\opentelemetry_cpp.lib  sdk\src\common\opentelemetry_common.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\dev\otel-marc-test\opentelemetry-cpp\build\examples\otlp && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/dev/otel-marc-test/opentelemetry-cpp/build/examples/otlp/example_otlp_http.exe -installedDir C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
LINK Pass 1: command "C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http.dir\http_main.cc.obj /out:examples\otlp\example_otlp_http.exe /implib:examples\otlp\example_otlp_http.lib /pdb:examples\otlp\example_otlp_http.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console examples\common\foo_library\common_foo_library.lib ext\src\dll\opentelemetry_cpp.lib sdk\src\common\opentelemetry_common.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:examples\otlp\CMakeFiles\example_otlp_http.dir/intermediate.manifest examples\otlp\CMakeFiles\example_otlp_http.dir/manifest.res" failed (exit code 1120) with the following output:
http_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::OtlpHttpExporterOptions(void)" (__imp_??0OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'opts''(void)" (??__Eopts@?A0xcf519c93@@YAXXZ)
http_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::~OtlpHttpExporterOptions(void)" (__imp_??1OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic atexit destructor for 'opts''(void)" (??__Fopts@?A0xcf519c93@@YAXXZ)
examples\otlp\example_otlp_http.exe : fatal error LNK1120: 2 unresolved externals
[362/376] Linking CXX executable examples\otlp\example_otlp_http_metric.exe
FAILED: examples/otlp/example_otlp_http_metric.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=examples\otlp\CMakeFiles\example_otlp_http_metric.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http_metric.dir\http_metric_main.cc.obj  /out:examples\otlp\example_otlp_http_metric.exe /implib:examples\otlp\example_otlp_http_metric.lib /pdb:examples\otlp\example_otlp_http_metric.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  examples\common\metrics_foo_library\common_metrics_foo_library.lib  ext\src\dll\opentelemetry_cpp.lib  sdk\src\common\opentelemetry_common.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\dev\otel-marc-test\opentelemetry-cpp\build\examples\otlp && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/dev/otel-marc-test/opentelemetry-cpp/build/examples/otlp/example_otlp_http_metric.exe -installedDir C:/dev/otel-marc-test/opentelemetry-cpp/tools/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
LINK Pass 1: command "C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo examples\otlp\CMakeFiles\example_otlp_http_metric.dir\http_metric_main.cc.obj /out:examples\otlp\example_otlp_http_metric.exe /implib:examples\otlp\example_otlp_http_metric.lib /pdb:examples\otlp\example_otlp_http_metric.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console examples\common\metrics_foo_library\common_metrics_foo_library.lib ext\src\dll\opentelemetry_cpp.lib sdk\src\common\opentelemetry_common.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:examples\otlp\CMakeFiles\example_otlp_http_metric.dir/intermediate.manifest examples\otlp\CMakeFiles\example_otlp_http_metric.dir/manifest.res" failed (exit code 1120) with the following output:
http_metric_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions(void)" (__imp_??0OtlpHttpMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'exporter_options''(void)" (??__Eexporter_options@?A0x6040844f@@YAXXZ)
http_metric_main.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions::~OtlpHttpMetricExporterOptions(void)" (__imp_??1OtlpHttpMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic atexit destructor for 'exporter_options''(void)" (??__Fexporter_options@?A0x6040844f@@YAXXZ)
examples\otlp\example_otlp_http_metric.exe : fatal error LNK1120: 2 unresolved externals
[365/376] Building CXX object examples\multithreaded\CMakeFiles\example_multithreaded.dir\main.cc.obj
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(34): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'opentelemetry::v1::nostd::unique_ptr<T>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/nostd/shared_ptr.h(106): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<T>'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[366/376] Building CXX object examples\batch\CMakeFiles\batch_span_processor_example.dir\main.cc.obj
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(34): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'opentelemetry::v1::nostd::unique_ptr<T>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/nostd/shared_ptr.h(106): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<T>'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[367/376] Building CXX object examples\http\CMakeFiles\http_client.dir\client.cc.obj
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(34): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'opentelemetry::v1::nostd::unique_ptr<T>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/nostd/shared_ptr.h(106): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<T>'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[368/376] Building CXX object examples\multi_processor\CMakeFiles\example_multi_processor.dir\main.cc.obj
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(34): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'opentelemetry::v1::nostd::unique_ptr<T>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/nostd/shared_ptr.h(106): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<T>'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[369/376] Building CXX object examples\http\CMakeFiles\http_server.dir\server.cc.obj
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Span' used as base for dll-interface class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/scope.h(16): note: see declaration of 'opentelemetry::v1::trace::Span'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(31): note: see declaration of 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(81): warning C4251: 'opentelemetry::v1::trace::NoopSpan::tracer_': class 'std::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(34): note: see declaration of 'std::shared_ptr<opentelemetry::v1::trace::Tracer>'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(82): warning C4251: 'opentelemetry::v1::trace::NoopSpan::span_context_': class 'opentelemetry::v1::nostd::unique_ptr<T>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopSpan'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/nostd/shared_ptr.h(106): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<T>'
        with
        [
            T=opentelemetry::v1::trace::SpanContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): warning C4275: non dll-interface class 'opentelemetry::v1::trace::Tracer' used as base for dll-interface class 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(16): note: see declaration of 'opentelemetry::v1::trace::Tracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(88): note: see declaration of 'opentelemetry::v1::trace::NoopTracer'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(90): warning C4251: 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>::_Wptr': class 'std::weak_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'std::enable_shared_from_this<opentelemetry::v1::trace::NoopTracer>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3143): note: see declaration of 'std::weak_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::trace::NoopTracer
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/noop.h(139): warning C4251: 'opentelemetry::v1::trace::NoopTracerProvider::tracer_': class 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::NoopTracerProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/tracer_provider.h(121): note: see declaration of 'opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::trace::Tracer>'
[370/376] Building CXX object examples\metrics_simple\CMakeFiles\metrics_ostream_example.dir\metrics_ostream.cc.obj
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ciso646(15): warning C4996: '_Header_ciso646': warning STL4036: <ciso646> is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry\nostd\internal\absl\base\internal\../../meta/type_traits.h(117): warning C4996: 'std::aligned_storage<_Len,_Align>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\type_traits(1235): note: see declaration of 'std::aligned_storage'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): warning C4251: 'opentelemetry::v1::trace::TraceState::kv_properties_': class 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::trace::TraceState'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/trace/trace_state.h(315): note: see declaration of 'opentelemetry::v1::nostd::unique_ptr<opentelemetry::v1::common::KeyValueProperties>'
C:\dev\otel-marc-test\opentelemetry-cpp\sdk\include\opentelemetry/sdk/metrics/meter_provider.h(33): warning C4275: non dll-interface class 'opentelemetry::v1::metrics::MeterProvider' used as base for dll-interface class 'opentelemetry::v1::sdk::metrics::MeterProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\api\include\opentelemetry/metrics/provider.h(18): note: see declaration of 'opentelemetry::v1::metrics::MeterProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\sdk\include\opentelemetry/sdk/metrics/meter_provider.h(33): note: see declaration of 'opentelemetry::v1::sdk::metrics::MeterProvider'
C:\dev\otel-marc-test\opentelemetry-cpp\sdk\include\opentelemetry/sdk/metrics/meter_provider.h(116): warning C4251: 'opentelemetry::v1::sdk::metrics::MeterProvider::context_': class 'std::shared_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::sdk::metrics::MeterProvider'
        with
        [
            _Ty=opentelemetry::v1::sdk::metrics::MeterContext
        ]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3135): note: see declaration of 'std::shared_ptr<_Ty>'
        with
        [
            _Ty=opentelemetry::v1::sdk::metrics::MeterContext
        ]
C:\dev\otel-marc-test\opentelemetry-cpp\sdk\include\opentelemetry/sdk/metrics/meter_provider.h(117): warning C4251: 'opentelemetry::v1::sdk::metrics::MeterProvider::lock_': class 'std::mutex' needs to have dll-interface to be used by clients of class 'opentelemetry::v1::sdk::metrics::MeterProvider'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\mutex(132): note: see declaration of 'std::mutex'
ninja: build stopped: subcommand failed.

Let me know if anything i've done to test this is wrong and how i should redo it. Feel free to ping me for anything Windows DLL related. Building/Code/Testing changes related.

@Dangeroustuber
Copy link

After the fix from @perhapsmaple and the latest changes i've attempted to build it again. It does not fully build but is close. It fails on the last linking stage of the DLL from what i can se. This symbol that is missing is included in the opentelemetry_cpp.src file at line 96.

The addition to the command from last time i was building is the option WITH_OTLP_GRPC set to ON. I've attempted to build this WITH_STL=OFF and WITH_STL=ON and there was no difference.

commands:

cmake .. -G Ninja -DWITH_STL=ON -DCMAKE_CXX_STANDARD=23 -DOPENTELEMETRY_BUILD_DLL=ON -DOPENTELEMETRY_INSTALL=ON -DBUILD_TESTING=ON -DWITH_OTLP_HTTP=ON -DWITH_OTLP_GRPC=ON -DWITH_FUNC_TESTS=OFF -DWITH_EXAMPLES_HTTP=ON -DWITH_EXAMPLES=ON -DWITH_ETW=OFF -DWITH_ELASTICSEARCH=OFF -DWITH_BENCHMARK=OFF

ninja

output:

[400/421] Linking CXX shared library ext\src\dll\opentelemetry_cpp.dll
FAILED: ext/src/dll/opentelemetry_cpp.dll ext/src/dll/opentelemetry_cpp.lib
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=ext\src\dll\CMakeFiles\opentelemetry_cpp.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\opentelemetry_cpp.rsp  /out:ext\src\dll\opentelemetry_cpp.dll /implib:ext\src\dll\opentelemetry_cpp.lib /pdb:ext\src\dll\opentelemetry_cpp.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL  /DEF:ext\src\dll\opentelemetry_cpp.def  && cd ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\opentelemetry_cpp.rsp /out:ext\src\dll\opentelemetry_cpp.dll /implib:ext\src\dll\opentelemetry_cpp.lib /pdb:ext\src\dll\opentelemetry_cpp.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /DEF:ext\src\dll\opentelemetry_cpp.def /MANIFEST /MANIFESTFILE:ext\src\dll\CMakeFiles\opentelemetry_cpp.dir/intermediate.manifest ext\src\dll\CMakeFiles\opentelemetry_cpp.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library ext\src\dll\opentelemetry_cpp.lib and object ext\src\dll\opentelemetry_cpp.exp
opentelemetry_cpp.exp : error LNK2001: unresolved external symbol "public: static class std::unique_ptr<class opentelemetry::v1::sdk::logs::LogRecordExporter,struct std::default_delete<class opentelemetry::v1::sdk::logs::LogRecordExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions const &)" (?Create@OtlpGrpcLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcExporterOptions@2345@@Z)
ext\src\dll\opentelemetry_cpp.dll : fatal error LNK1120: 1 unresolved externals

Let me know if my building is wrong in any way or if i should enable/disable more options. Thanks for working on this.

@perhapsmaple
Copy link
Contributor

The function definition for OtlpGrpcLogRecordExporterFactory::Create has changed from using OtlpGrpcExporterOptions to OtlpGrpcLogRecordExporterOptions. The opentelemetry_cpp.src would also need a bit of cleanup removing the GetOtlpDefault* methods, and exporting only the constructor for the options structs. I will be happy to look into that if it is not in the scope of this PR.

@marcalff
Copy link
Member Author

marcalff commented Nov 7, 2023

The function definition for OtlpGrpcLogRecordExporterFactory::Create has changed from using OtlpGrpcExporterOptions to OtlpGrpcLogRecordExporterOptions. The opentelemetry_cpp.src would also need a bit of cleanup removing the GetOtlpDefault* methods, and exporting only the constructor for the options structs. I will be happy to look into that if it is not in the scope of this PR.

As far as I know, the remaining items to make this PR complete and also link with windows DLL is to export:

  • (ctor, dtor) x (http, grpc) x (trace, metrics, log_record) = 12 new symbols

plus the signature change for the GRPC log exporter factory::Create() method.

I was hoping to see build failures in CI logs for existing examples or tests, then adjust exports accordingly, but this part is not covered yet in CI.

This makes it incredibly difficult to investigate for me (and I shall say, frustrating), as I am not running an a windows platform locally: I can not remote debug a build failure for a different platform that is not even reported ;-(

@perhapsmaple If you could investigate this part, it would be awesome, and also very appreciated.

Thanks.

And thanks @Dangeroustuber for testing.

@perhapsmaple
Copy link
Contributor

Hi @marcalff, I have a question regarding one of the examples. In example_otlp_http_log, we directly use

trace_opts.url = opentelemetry::exporter::otlp::GetOtlpDefaultHttpTracesEndpoint();

I thought the GetOtlpDefault* functions were supposed to be used only by the options struct. Do we still have to expose these functions?

One more thing, I cloned marcalff:fix_exporter_option_1845 and updated the symbols to fix all the linker errors. Is there a better way to update the changes than copy pasting the new file here. I'm a little new to this but I can't seem to submit a PR directly from that. Any help would be appreciated.

@owent
Copy link
Member

owent commented Nov 9, 2023

Hi @marcalff, I have a question regarding one of the examples. In example_otlp_http_log, we directly use

trace_opts.url = opentelemetry::exporter::otlp::GetOtlpDefaultHttpTracesEndpoint();

I thought the GetOtlpDefault* functions were supposed to be used only by the options struct. Do we still have to expose these functions?

One more thing, I cloned marcalff:fix_exporter_option_1845 and updated the symbols to fix all the linker errors. Is there a better way to update the changes than copy pasting the new file here. I'm a little new to this but I can't seem to submit a PR directly from that. Any help would be appreciated.

I agree. I believe that GetOtlpDefault* do not need to be exported if they are only used in .cc files. However, exporting them would make it easier for the user to access the default settings and potentially modify them.

@marcalff
Copy link
Member Author

marcalff commented Nov 9, 2023

Hi @marcalff, I have a question regarding one of the examples. In example_otlp_http_log, we directly use

trace_opts.url = opentelemetry::exporter::otlp::GetOtlpDefaultHttpTracesEndpoint();

I thought the GetOtlpDefault* functions were supposed to be used only by the options struct. Do we still have to expose these functions?

Good point.

To clarify, the application code no longer has to call the GetOtlpDefault*() functions to populate the options structs with defaults, since this is done by the SDK and is hidden.

However, for whatever reason, the application code still may use some of this helpers functions (as seen in this example), so to be on the safe side we still have to export all these helpers.

One more thing, I cloned marcalff:fix_exporter_option_1845 and updated the symbols to fix all the linker errors. Is there a better way to update the changes than copy pasting the new file here. I'm a little new to this but I can't seem to submit a PR directly from that. Any help would be appreciated.

In theory you could clone off my own fork, file a PR against it, which I can then merge to my own branch in this PR ... but I would probably need to setup my own branch to accept PR, etc, to make this possible.

That is a lot of work for both of us, just to adjust one file, so in practice please paste the diff here in a comment, and I will adjust the code accordingly.

I will add credits in the PR comments as well.

Thanks.

@perhapsmaple
Copy link
Contributor

diff --git a/ext/src/dll/opentelemetry_cpp.src b/ext/src/dll/opentelemetry_cpp.src
index 10172dbb..195b3064 100644
--- a/ext/src/dll/opentelemetry_cpp.src
+++ b/ext/src/dll/opentelemetry_cpp.src
@@ -14,22 +14,6 @@ EXPORTS
 #endif
     // public: static class std::unique_ptr<class opentelemetry::v1::trace::TracerProvider,struct std::default_delete<class opentelemetry::v1::trace::TracerProvider> > __cdecl opentelemetry::v1::sdk::trace::TracerProviderFactory::Create(class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanProcessor,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanProcessor> >)
     ?Create@TracerProviderFactory@trace@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VTracerProvider@trace@v1@opentelemetry@@U?$default_delete@VTracerProvider@trace@v1@opentelemetry@@@std@@@std@@V?$unique_ptr@VSpanProcessor@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanProcessor@trace@sdk@v1@opentelemetry@@@std@@@7@@Z
-#if defined(WITH_OTLP_GRPC)
-    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions const & __ptr64)
-#if defined(_WIN64)
-    ?Create@OtlpGrpcExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcExporterOptions@2345@@Z
-#else
-    ?Create@OtlpGrpcExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@ABUOtlpGrpcExporterOptions@2345@@Z
-#endif  // defined(_WIN64)
-#endif  // defined(WITH_OTLP_GRPC)
-#if defined(WITH_OTLP_HTTP)
-    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions const & __ptr64)
-#if defined(_WIN64)
-    ?Create@OtlpHttpExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpExporterOptions@2345@@Z
-#else
-    ?Create@OtlpHttpExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@ABUOtlpHttpExporterOptions@2345@@Z
-#endif  // defined(_WIN64)
-#endif  // defined(WITH_OTLP_HTTP)
     // public: static class std::unique_ptr<class opentelemetry::v1::logs::LoggerProvider,class std::default_delete<class opentelemetry::v1::logs::LoggerProvider> > __cdecl opentelemetry::v1::sdk::logs::LoggerProviderFactory::Create(class std::unique_ptr<class opentelemetry::v1::sdk::logs::LogRecordProcessor,struct std::default_delete<class opentelemetry::v1::sdk::logs::LogRecordProcessor> > && __ptr64)
 #if defined(_WIN64)
     ?Create@LoggerProviderFactory@logs@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VLoggerProvider@logs@v1@opentelemetry@@U?$default_delete@VLoggerProvider@logs@v1@opentelemetry@@@std@@@std@@$$QEAV?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@7@@Z
@@ -82,7 +66,6 @@ EXPORTS
     ?AddMetricReader@MeterProvider@metrics@sdk@v1@opentelemetry@@QEAAXV?$shared_ptr@VMetricReader@metrics@sdk@v1@opentelemetry@@@std@@@Z
     // public: void __cdecl opentelemetry::v1::sdk::metrics::MeterProvider::AddView(class std::unique_ptr<class opentelemetry::v1::sdk::metrics::InstrumentSelector,struct std::default_delete<class opentelemetry::v1::sdk::metrics::InstrumentSelector> >,class std::unique_ptr<class opentelemetry::v1::sdk::metrics::MeterSelector,struct std::default_delete<class opentelemetry::v1::sdk::metrics::MeterSelector> >,class std::unique_ptr<class opentelemetry::v1::sdk::metrics::View,struct std::default_delete<class opentelemetry::v1::sdk::metrics::View> >)
     ?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
@@ -90,26 +73,63 @@ EXPORTS
     ?GetOtlpDefaultLogsHeaders@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
     ?GetOtlpDefaultMetricsTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ
     ?GetOtlpDefaultMetricsHeaders@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
+    ?GetOtlpDefaultTracesSslCertificatePath@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultMetricsSslCertificatePath@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultLogsSslCertificatePath@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultTracesSslCertificateString@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultMetricsSslCertificateString@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultLogsSslCertificateString@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
 #endif  // defined(WITH_OTLP_GRPC) || defined(WITH_OTLP_HTTP)
 #if defined(WITH_OTLP_GRPC)
-    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::logs::LogRecordExporter,struct std::default_delete<class opentelemetry::v1::sdk::logs::LogRecordExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions const & __ptr64)
-    ?Create@OtlpGrpcLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcExporterOptions@2345@@Z
+    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions const & __ptr64)
+    ?Create@OtlpGrpcExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcExporterOptions@2345@@Z
     // public: static class std::unique_ptr<class opentelemetry::v1::sdk::metrics::PushMetricExporter,struct std::default_delete<class opentelemetry::v1::sdk::metrics::PushMetricExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterOptions const & __ptr64)
     ?Create@OtlpGrpcMetricExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@U?$default_delete@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcMetricExporterOptions@2345@@Z
+    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::logs::LogRecordExporter,struct std::default_delete<class opentelemetry::v1::sdk::logs::LogRecordExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterOptions const &)
+    ?Create@OtlpGrpcLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcLogRecordExporterOptions@2345@@Z
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions::OtlpGrpcExporterOptions(void)
+    ??0OtlpGrpcExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions::~OtlpGrpcExporterOptions(void)
+    ??1OtlpGrpcExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterOptions::OtlpGrpcMetricExporterOptions(void)
+    ??0OtlpGrpcMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterOptions::~OtlpGrpcMetricExporterOptions(void)
+    ??1OtlpGrpcMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterOptions::OtlpGrpcLogRecordExporterOptions(void)
+    ??0OtlpGrpcLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterOptions::~OtlpGrpcLogRecordExporterOptions(void)
+    ??1OtlpGrpcLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
 
     ?GetOtlpDefaultGrpcTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultGrpcMetricsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultGrpcLogsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
     ?GetOtlpDefaultGrpcTracesIsInsecure@otlp@exporter@v1@opentelemetry@@YA_NXZ
-    ?GetOtlpDefaultTracesSslCertificatePath@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
-    ?GetOtlpDefaultTracesSslCertificateString@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultGrpcMetricsIsInsecure@otlp@exporter@v1@opentelemetry@@YA_NXZ
+    ?GetOtlpDefaultGrpcLogsIsInsecure@otlp@exporter@v1@opentelemetry@@YA_NXZ
 #endif  // defined(WITH_OTLP_GRPC)
+
 #if defined(WITH_OTLP_HTTP)
+    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::trace::SpanExporter,struct std::default_delete<class opentelemetry::v1::sdk::trace::SpanExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions const & __ptr64)
+    ?Create@OtlpHttpExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpExporterOptions@2345@@Z
+    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::metrics::PushMetricExporter,struct std::default_delete<class opentelemetry::v1::sdk::metrics::PushMetricExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions const &)
+    ?Create@OtlpHttpMetricExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@U?$default_delete@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpMetricExporterOptions@2345@@Z
     // public: static class std::unique_ptr<class opentelemetry::v1::sdk::logs::LogRecordExporter,struct std::default_delete<class opentelemetry::v1::sdk::logs::LogRecordExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions const & __ptr64)
     ?Create@OtlpHttpLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpLogRecordExporterOptions@2345@@Z
-    ?GetOtlpDefaultHttpTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
-    ?GetOtlpDefaultHttpLogsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::OtlpHttpExporterOptions(void)
+    ??0OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions::~OtlpHttpExporterOptions(void)
+    ??1OtlpHttpExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions(void)
+    ??0OtlpHttpMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions::~OtlpHttpMetricExporterOptions(void)
+    ??1OtlpHttpMetricExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions(void)
+    ??0OtlpHttpLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
+    // public: __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions::~OtlpHttpLogRecordExporterOptions(void)
+    ??1OtlpHttpLogRecordExporterOptions@otlp@exporter@v1@opentelemetry@@QEAA@XZ
 
-    // public: static class std::unique_ptr<class opentelemetry::v1::sdk::metrics::PushMetricExporter,struct std::default_delete<class opentelemetry::v1::sdk::metrics::PushMetricExporter> > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpMetricExporterOptions const &)
-    ?Create@OtlpHttpMetricExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@U?$default_delete@VPushMetricExporter@metrics@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpMetricExporterOptions@2345@@Z
+    ?GetOtlpDefaultHttpTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
     ?GetOtlpDefaultHttpMetricsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
+    ?GetOtlpDefaultHttpLogsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
 #endif  // defined(WITH_OTLP_HTTP)
 // clang-format on

@marcalff Here is the git diff. This should fix all the linker errors. Regarding the 32-bit export definitions, I'm facing some msbuild errors on my windows VM while trying to build a 32-bit DLL with cmake, I'll add those definitions once I figure out how to fix it.

@marcalff marcalff added the pr:please-review This PR is ready for review label Nov 9, 2023
Copy link
Member

@owent owent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and thanks.
To reduce conflicts, I will start to implement async exporting for OTLP gRPC exporter after this PR been merged.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nicely done, thanks.

@ThomsonTan ThomsonTan merged commit 3dfcf93 into open-telemetry:main Nov 13, 2023
45 checks passed
@georgthegreat
Copy link

It looks like adding the default ctors has broken a quite convenient way to initialize OtlpGrpcExporterOptions via C++20 designated initializers:

This is a part of our code that was broken by this change:

otel::OtlpGrpcExporterOptions{
    .endpoint = config.exporter().endpoint().Endpoint,
    .use_ssl_credentials = !config.exporter().ssl_credentials_path().empty(),
    .ssl_credentials_cacert_path = config.exporter().ssl_credentials_path(),
    // keep everything else to their defaults
}

Looks legit to me.
Could someone suggest a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:please-review This PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EXPORTER] OTLP/GRPC Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables.
7 participants