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

[API/SDK] Provider cleanup #2664

Merged
merged 25 commits into from
Jun 3, 2024

Conversation

marcalff
Copy link
Member

@marcalff marcalff commented May 9, 2024

Fixes #2506

Changes

Please provide a brief description of the changes here.

  • Removed methods related to Flush() and Close() from the API class opentelemetry::trace::Tracer, starting with ABI version 2.
    • These methods are not intended for the API, and got exposed as an oversight
    • These methods belong to the SDK instead
  • Changed all XXXProviderFactory::Create() methods to return an SDK object instead of an API object.
    • Returning an SDK object is necessary for the application code to perform a proper initialisation, and proper shutdown of the SDK
    • In particular, returning an SDK object is required for the caller to invoke Flush() and Shutdown().
  • Removed static_cast<SDK*>(API object) from examples, and use cleaner code, to initialize SDK providers.
  • Because the SDK change is breaking, provided a compile flag and a migration path. This allows applications:
    • To upgrade to the latest opentelemetry-cpp immediately, without code changes
    • To plan for code adjustments at a later date.

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

Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 87.68%. Comparing base (497eaf4) to head (79595f5).
Report is 72 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2664      +/-   ##
==========================================
+ Coverage   87.12%   87.68%   +0.56%     
==========================================
  Files         200      190      -10     
  Lines        6109     5851     -258     
==========================================
- Hits         5322     5130     -192     
+ Misses        787      721      -66     
Files Coverage Δ
api/include/opentelemetry/trace/noop.h 93.34% <ø> (ø)
api/include/opentelemetry/trace/tracer.h 100.00% <ø> (ø)
sdk/include/opentelemetry/sdk/trace/tracer.h 100.00% <ø> (ø)
sdk/src/logs/event_logger_provider_factory.cc 100.00% <ø> (ø)
sdk/src/trace/tracer_provider_factory.cc 44.83% <30.00%> (+0.39%) ⬆️

... and 70 files with indirect coverage changes

@marcalff marcalff changed the title [SDK] Provider cleanup [API/SDK] Provider cleanup May 9, 2024
@lalitb
Copy link
Member

lalitb commented May 9, 2024

Good catch :)

@marcalff
Copy link
Member Author

marcalff commented May 9, 2024

Waiting for the build to finish to make sure DLL links, then this will be ready for review.

@marcalff marcalff added the help wanted Good for taking. Extra help will be provided by maintainers label May 10, 2024
@marcalff
Copy link
Member Author

Add help-wanted label:

The windows DLL build fails with undefined symbols, and I can not figure out why (I don't have windows locally to investigate).

@marcalff marcalff added pr:please-review This PR is ready for review and removed help wanted Good for taking. Extra help will be provided by maintainers labels May 13, 2024
@marcalff marcalff marked this pull request as ready for review May 13, 2024 20:34
@marcalff marcalff requested a review from a team May 13, 2024 20:34
CHANGELOG.md Outdated Show resolved Hide resolved
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.

Thanks for the fix.

@esigo esigo added ok-to-merge The PR is ok to merge (has two approves or raised by a maintainer/approver and has one approve) and removed pr:please-review This PR is ready for review labels Jun 3, 2024
@marcalff marcalff merged commit 2535c70 into open-telemetry:main Jun 3, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-merge The PR is ok to merge (has two approves or raised by a maintainer/approver and has one approve)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EXAMPLES] Improve ForceFlush call to also work with NoopTracerProvider
3 participants