Skip to content

metrics_simple example does nothing on Windows #3740

@vkrevs

Description

@vkrevs

Describe your environment
Same as in #3673
Windows 11, VS2022, cmake-4.1.1, ninja 1.13.1
opentelemetry-cpp dependencies are built as shared libraries

Steps to reproduce
Build opentelemetry 1.23.0 on Windows as a single shared dll (using OPENTELEMETRY_BUILD_DLL cmake option)as described in #3673, including patching ext/src/dll/input.src, and replacing "-DWITH_EXAMPLES=OFF -DWITH_EXAMPLES_HTTP=OFF" with "-DWITH_EXAMPLES=ON -DWITH_EXAMPLES_HTTP=ON". The build will have built the metrics_simple example and then will fail due to failure to link other examples (because of the same underlying issues as in #3673).

Then put the build opentelemetry-cpp.dll (along with it's dependencies such as protobuf/abseil DLLs) on PATH and run the built <BUILD_ROOT>\opentelemetry-cpp-1.23.0\build\examples\metrics_simple\metrics_ostream_example.exe with or without any parameters such as "counter".

What is the expected behavior?
Exported metrics displayed on stdout, just like it happens on Linux.

What is the actual behavior?
The exe appears to hang for 10 seconds then it exits. Nothing is displayed on stdout.

Additional context
Modifying the example to set up an OtlpHttpMetricExporter using http://localhost:56633/v1/metric as the url and install a custom LogHandler via opentelemetry::sdk::common::internal_log::GlobalLogHandler::SetLogHandler shows there is no attempt to connect to the non-existent OTLP HTTP metric exporter url (unlike when attempting to use a non-existent OTLP Http trace exporter url for traces).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions