open-telemetry / open-telemetry/opentelemetry-cpp

Header only singletons are not working properly for Windows

Open
#2,534 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug do-not-stale issue:blocking triage/accepted
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

The opentelemetry-cpp API uses header only singletons, for example for the tracer provider.

When:

  • an application calls TracerProvider::SetTracerProvider() in the main application code
  • a shared library is loaded by the main application
  • the shared library uses TracerProvider::GetTracerProvider()

the shared library does not see the tracer provider installed in the main application.

As a result, opentelemetry is disabled in the shared library (the noop tracer provider is seen instead).

Related issues:

  • #1105
  • #1932
  • #1604
    • This fixed all platforms except Windows.
  • #2164
    • The test is executed on all platforms except Windows.
  • #1595
  • #1525

The issue about singletons for the Windows platform is known, but still not resolved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the related issues, especially #1604 and #2164, then reproduce the described Windows scenario with a main application, a loaded shared library, and the tracer provider singleton. Done means the shared library observes the provider set by the main application and the corresponding test runs on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design, observability-sre, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.