Skip to content

Provide major/minor/patch version macros #2012

Closed
@wjones127

Description

@wjones127

Is your feature request related to a problem?

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions