You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Apache Arrow Flight C++, we'd like to support a wide range of versions of opentelemetry-cpp. Sometimes there are breaking changes in the API, such as in #1761. It's cool that there are breaking changes (I appreciate the pace at which the project is evolving), except that in our project we don't have a way to check the version and easily adapt our code to support versions both before and after the change.
Describe the solution you'd like
It's common in many C++ projects to provide macros for:
OPENTELEMETRY_VERSION_MAJOR
OPENTELEMETRY_VERSION_MINOR
OPENTELEMETRY_VERSION_PATCH
Then, downstream libraries can write code like:
#if !(OPENTELEMETRY_VERSION_MAJOR <= 2 && OPENTELEMETRY_VERSION_MINOR < 5)
// Handle old API
#else// Handle new API
#endif
Would you be open to providing these?
Describe alternatives you've considered
We could use CMake try_compile feature to detect what APIs are available at compile time, but that's quite burdensome to maintain.
I don't think OPENTELEMETRY_SDK_VERSION is something we can compare against in the #if directives, which is why the MAJOR/MINOR/PATCH macros typically exist.
Though if we do some work in CMake, we might be able to extract these ourselves.
To clarify, opentelemetry-cpp should provide versions for API and SDK, like this:
API
OPENTELEMETRY_VERSION_MAJOR
OPENTELEMETRY_VERSION_MINOR
OPENTELEMETRY_VERSION_PATCH
SDK
OPENTELEMETRY_SDK_VERSION_MAJOR
OPENTELEMETRY_SDK_VERSION_MINOR
OPENTELEMETRY_SDK_VERSION_PATCH
so that client code can adapt when incompatible changes are done in the API (for example, semantic conventions, links in spans currently under discussion) or in the SDK (for example, options for exporters)
Having separate versions for API and SDK would introduce more confusion, as we have single release version containing both of them. We can instead have one of above set of macros(say)
And the the guidelines for changing the version (as done now):
Patch version increment if there is no API/SDK breaking change in stable components. And also for any breaking changes in experimental components for API/SDK. Experimental components include - components in preview release (e.g., Logs API/SDK), or those marked as experimental as per the specs (e.g., semantic convention).
Minor version increment for any breaking changes in API/SDK. And in case of ABI breaking changes in API, also increment the OPENTELEMETRY_ABI_VERSION.
Major version will be consistent with the major version of specification release (as done in other SIGs)
Having separate versions for API and SDK would introduce more confusion, as we have single release version containing both of them. We can instead have one of above set of macros(say)
Activity
lalitb commentedon Mar 2, 2023
@wjones127 - Is
OPENTELEMETRY_SDK_VERSIONmacro something you can use -https://github.com/open-telemetry/opentelemetry-cpp/blob/main/sdk/include/opentelemetry/sdk/version/version.h#LL8C9-L8C35
This get's updated for every release.
wjones127 commentedon Mar 2, 2023
I don't think
OPENTELEMETRY_SDK_VERSIONis something we can compare against in the#ifdirectives, which is why theMAJOR/MINOR/PATCHmacros typically exist.Though if we do some work in CMake, we might be able to extract these ourselves.
wjones127 commentedon Mar 2, 2023
Nevermind, we don't have access to the version at configure time.
lalitb commentedon Mar 2, 2023
Yes it would be difficult to tokenize OPENTELEMETRY_SDK_VERSION macro.
I think we should add support for
marcalff commentedon Mar 3, 2023
To clarify, opentelemetry-cpp should provide versions for API and SDK, like this:
API
SDK
so that client code can adapt when incompatible changes are done in the API (for example, semantic conventions, links in spans currently under discussion) or in the SDK (for example, options for exporters)
lalitb commentedon Mar 3, 2023
Having separate versions for API and SDK would introduce more confusion, as we have single release version containing both of them. We can instead have one of above set of macros(say)
And the the guidelines for changing the version (as done now):
Fix open-telemetry#2012
marcalff commentedon Mar 3, 2023
Agreed, this is sufficient because API and SDK are shipped together.
Implemented, please see PR.