Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUILD] Remove WITH_ABSEIL #3318

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

Merged
merged 8 commits into from
Apr 1, 2025
Merged

Conversation

owent
Copy link
Member

@owent owent commented Mar 24, 2025

Fixes #3116

Maybe also fixes #3309

Changes

Please provide a brief description of the changes here.

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

@owent owent requested a review from a team as a code owner March 24, 2025 08:00
Copy link

netlify bot commented Mar 24, 2025

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit d8f8163
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/67ec6a7f54d52700083d1188

Copy link

codecov bot commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.55%. Comparing base (6175aa0) to head (d8f8163).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3318      +/-   ##
==========================================
- Coverage   89.56%   89.55%   -0.01%     
==========================================
  Files         210      210              
  Lines        6502     6502              
==========================================
- Hits         5823     5822       -1     
- Misses        679      680       +1     
Files with missing lines Coverage Δ
api/include/opentelemetry/nostd/variant.h 66.67% <ø> (ø)
sdk/src/common/base64.cc 82.93% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@owent owent force-pushed the remove_with_abseil branch 2 times, most recently from 3049062 to e639896 Compare March 24, 2025 12:59
@marcalff marcalff self-assigned this Mar 24, 2025
@owent owent force-pushed the remove_with_abseil branch from e639896 to 44d67d5 Compare March 25, 2025 03:53
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

The WITH_ABSEIL removal itself looks ok.

Not sure why the file opentelemetry-cpp-config.cmake.in was reformated.

Should we change the formatting scripts to ignore this file instead ?

owent added 4 commits March 26, 2025 10:33
…and Linux

Fix different results of the same version of clang-format on Windows and Linux

Fix different results of the same version of clang-format on Windows and Linux
@owent owent force-pushed the remove_with_abseil branch from 44d67d5 to 45186aa Compare March 26, 2025 02:33
@owent owent force-pushed the remove_with_abseil branch from 67f2c6c to 2d35c25 Compare March 27, 2025 09:13
@owent
Copy link
Member Author

owent commented Mar 27, 2025

The WITH_ABSEIL removal itself looks ok.

Not sure why the file opentelemetry-cpp-config.cmake.in was reformated.

Should we change the formatting scripts to ignore this file instead ?

Maybe the problem is the max length of cmake is default set to 80. I use #[[ ... ]] to prevent cmake-format to change comments by temporary. Can we change the setting the reformat all cmake files in another PR?

@marcalff
Copy link
Member

In terms of stability and risk mitigation, there is:

I suspect there will be minor merge conflicts between the WITH_ABSEIL removal and the CMake COMPONENTS refactoring, so this raise the question in which order to merge (for one, the cmake.in template has moved)

@owent Can this PR wait after the opentelemetry-cpp 1.20 release, so we merge all cmake changes at once ?

@dbarker FYI

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the cleanup.

@dbarker
Copy link
Contributor

dbarker commented Mar 27, 2025

I'm okay merging this before the components pr and working through the conflicts, they should be manageable.

find_package(absl CONFIG REQUIRED)
endif()
if(WITH_OTLP_GRPC)
find_package(absl CONFIG REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is absl only required for WITH_OTLP_GRPC, not for all cases?

Copy link
Member Author

@owent owent Mar 28, 2025

Choose a reason for hiding this comment

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

otel-cpp's API no longer depends on abseil-cpp's headers, eliminating path conflicts between internal and external versions of abseil-cpp.

Some components use protobuf, which may include abseil-cpp headers with overlapping paths from the internal version. This necessitates abseil-cpp when using a newer version of protobuf.

The protobuf package file automatically calls find_package(absl CONFIG REQUIRED) and imports it when needed. However, some gRPC versions do not import abseil-cpp, so it only needs to be imported when working with gRPC.

@owent
Copy link
Member Author

owent commented Mar 28, 2025

In terms of stability and risk mitigation, there is:

I suspect there will be minor merge conflicts between the WITH_ABSEIL removal and the CMake COMPONENTS refactoring, so this raise the question in which order to merge (for one, the cmake.in template has moved)

@owent Can this PR wait after the opentelemetry-cpp 1.20 release, so we merge all cmake changes at once ?

@dbarker FYI

OK, this is a small PR and it can be merged last, I will resolve the conflicts when the time comes.

@marcalff
Copy link
Member

All, there is more to this, as it just turned out.

Ubuntu 20.04 is being removed in 3 days, so we MUST upgrade ci as we are still using it.

When upgrading CI, the abseil builds now fails, even when the abseil version used is the same.

From a quick look, this sounds due to a compiler version change (gcc 9 to 11), confusing the abseil code to think it can use std::in_place_t, which is a C++17 construct. It seems the abseil code does not honor the fact we build in C++14 then, and assumes std::in_place_t is ok to use.

Long story short:

  • I am very reluctant to debug and fix this upgrade to support some abseil new combination we have not been exposed to before, just for 3 days, given WITH_ABSEIL is going to be removed anyway
  • I am now considering to merge WITH_ABSEIL removal now, before shipping opentelemetry-cpp 1.20, to avoid the issue entirely that comes with the ubuntu ci upgrade from 20.04

@open-telemetry/cpp-approvers @dbarker Any thoughts ?

@dbarker
Copy link
Contributor

dbarker commented Mar 28, 2025

@marcalff The main risk I see of removing WITH_ABSEIL before the release is the lack of cmake install tests in ci and there is an indication that community vcpkg portfile is requiring it since this PR microsoft/vcpkg#30720. It may be covering up some other issues in the cmake files.

Setting WIITH_ABSEIL=ON ensures find_dependency(absl) is called when a user calls find_package(opentelemetry-cpp CONFIG). This PR will remove that.

Potential issues that may be uncovered:

  • There may be unintended linking to absl targets to opentelemetry-cpp targets
  • There is an issue I found with calling find_dependency(Protobuf) in opentelemetry-config.cmake on modern versions of protobuf (> 3.22.0) as they require using the CONFIG search mode to find/include the abseil dependency properly, causing abseil link errors. This has existed for a few releases now.

Adding a simple cmake install test based on vcpkg installed dependencies, and a conditional in the opentelemetry-cpp-config.cmake on the protobuf version to use the correct cmake search mode could mitigate the risk.

That said, I'd lean towards releasing this and #3220 together due to the test coverage added.

Would disabling the 20.04 ci runners before the 3 days, then create the release without this PR, and work on the ci upgrade post release work?

@ThomsonTan
Copy link
Contributor

As @dbarker mentioned, I agree on merging this after the release if it could break vcpkg port in potential.

@dbarker
Copy link
Contributor

dbarker commented Mar 28, 2025

I've added a comment here #3330 (comment). I'm optimistic that the ci upgrade can proceed by adding the CXX_STANDARD=14 env var to the failing jobs.

@marcalff
Copy link
Member

Would disabling the 20.04 ci runners before the 3 days, then create the release without this PR, and work on the ci upgrade post release work?

Yes, this is the safest path I think.

@marcalff marcalff mentioned this pull request Mar 28, 2025
3 tasks
@marcalff
Copy link
Member

Do not merge (now) tag: To merge after opentelemetry-cpp 1.20 is released

@marcalff marcalff added the pr:do-not-merge This PR is not ready to be merged. label Mar 28, 2025
@marcalff marcalff removed the pr:do-not-merge This PR is not ready to be merged. label Apr 1, 2025
@marcalff marcalff changed the title Remove WITH_ABSEIL [BUILD] Remove WITH_ABSEIL Apr 1, 2025
@marcalff marcalff merged commit ab81479 into open-telemetry:main Apr 1, 2025
56 checks passed
@owent owent deleted the remove_with_abseil branch April 27, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API VariantTest.Get test fails on windows when WITH_ABSEIL=ON Clarifications needed around WITH_ABSEIL
4 participants