From fcb0fa72704c2ea71265f4cdbd59c81f99e581f1 Mon Sep 17 00:00:00 2001 From: ArielGMachado Date: Sun, 10 Nov 2024 03:10:10 +0000 Subject: [PATCH 1/5] opentelemetry-cpp: add version 1.16.1 --- recipes/opentelemetry-cpp/all/conandata.yml | 3 +++ recipes/opentelemetry-cpp/all/conanfile.py | 5 ++++- recipes/opentelemetry-cpp/config.yml | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index ce31f611ba274..ec83bb84a8b61 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.16.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.16.1.tar.gz" + sha256: "b8a78bb2a3a78133dbb08bcd04342f4b1e03cb4a19079b8416d408d905fffc37" "1.14.2": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.14.2.tar.gz" sha256: "c7e7801c9f6228751cdb9dd4724d0f04777ed53f524c8828e73bf4c9f894e0bd" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 4027a85ffced7..531ab9e2dffb7 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -195,7 +195,10 @@ def validate(self): def build_requirements(self): if self.options.with_otlp_grpc or self.options.with_otlp_http: - self.tool_requires("opentelemetry-proto/1.3.0") + if Version(self.version) >= "1.16.0": + self.tool_requires("opentelemetry-proto/1.3.1") + else: + self.tool_requires("opentelemetry-proto/1.3.0") self.tool_requires("protobuf/") if self.options.with_otlp_grpc: diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index 2d959457e4aec..1e86e3ee8a470 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.16.1": + folder: all "1.14.2": folder: all "1.12.0": From 2981ec253c6a302f67b56072c7f670400936dd32 Mon Sep 17 00:00:00 2001 From: ArielGMachado Date: Sun, 10 Nov 2024 03:12:57 +0000 Subject: [PATCH 2/5] opentelemetry-cpp: add version 1.17.0 --- recipes/opentelemetry-cpp/all/conandata.yml | 3 +++ recipes/opentelemetry-cpp/all/conanfile.py | 4 +++- recipes/opentelemetry-cpp/config.yml | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index ec83bb84a8b61..1906e472cd519 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.17.0": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.17.0.tar.gz" + sha256: "13542725463f1ea106edaef078c2276065cf3da998cb1d3dcf92630daa3f64d4" "1.16.1": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.16.1.tar.gz" sha256: "b8a78bb2a3a78133dbb08bcd04342f4b1e03cb4a19079b8416d408d905fffc37" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 531ab9e2dffb7..c199b65715e3d 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -195,7 +195,9 @@ def validate(self): def build_requirements(self): if self.options.with_otlp_grpc or self.options.with_otlp_http: - if Version(self.version) >= "1.16.0": + if Version(self.version) >= "1.17.0": + self.tool_requires("opentelemetry-proto/1.3.2") + elif Version(self.version) >= "1.16.0": self.tool_requires("opentelemetry-proto/1.3.1") else: self.tool_requires("opentelemetry-proto/1.3.0") diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index 1e86e3ee8a470..6e3e868a29e2f 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.17.0": + folder: all "1.16.1": folder: all "1.14.2": From fd4b2e21856115d67887bdfbb2ad6e708c88b619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 11 Nov 2024 14:14:53 +0100 Subject: [PATCH 3/5] Remove deprecated option now that we have new versions --- recipes/opentelemetry-cpp/all/conanfile.py | 16 +--------------- .../all/test_v1_package/CMakeLists.txt | 9 --------- .../all/test_v1_package/conanfile.py | 18 ------------------ 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt delete mode 100644 recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index d30cbf8b38de5..f10ef1babb190 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -27,7 +27,6 @@ class OpenTelemetryCppConan(ConanFile): "with_stl": [True, False], "with_gsl": [True, False], "with_abseil": [True, False], - "with_otlp": ["deprecated", True, False], "with_otlp_grpc": [True, False], "with_otlp_http": [True, False], "with_zipkin": [True, False], @@ -50,7 +49,6 @@ class OpenTelemetryCppConan(ConanFile): "with_stl": False, "with_gsl": False, "with_abseil": True, - "with_otlp": "deprecated", "with_otlp_grpc": False, "with_otlp_http": True, "with_zipkin": True, @@ -100,9 +98,6 @@ def config_options(self): def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - if self.options.with_otlp != "deprecated": - self.output.warning(f"{self.ref}:with_otlp option is deprecated, do not use anymore. " - "Please, consider with_otlp_grpc or with_otlp_http instead.") def layout(self): cmake_layout(self, src_folder="src") @@ -195,12 +190,7 @@ def validate(self): def build_requirements(self): if self.options.with_otlp_grpc or self.options.with_otlp_http: - if Version(self.version) >= "1.17.0": - self.tool_requires("opentelemetry-proto/1.3.2") - elif Version(self.version) >= "1.16.0": - self.tool_requires("opentelemetry-proto/1.3.1") - else: - self.tool_requires("opentelemetry-proto/1.3.0") + self.tool_requires("opentelemetry-proto/1.3.2") self.tool_requires("protobuf/") if self.options.with_otlp_grpc: @@ -217,10 +207,6 @@ def _create_cmake_module_variables(self, module_file): """) save(self, module_file, content) - def package_id(self): - # deprecated - del self.info.options.with_otlp - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index babe7e0cea000..0000000000000 --- a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py b/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py deleted file mode 100644 index 5a05af3c2dfd2..0000000000000 --- a/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building -import os - - -class TestPackageV1Conan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) From a1f7ff0035efb4d0c17f377e45f6271f5ded6da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 11 Nov 2024 17:45:34 +0100 Subject: [PATCH 4/5] New version features --- recipes/opentelemetry-cpp/all/conanfile.py | 79 ++++++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index f10ef1babb190..ac0ab89b260d0 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -1,5 +1,6 @@ from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.files import get, copy, rmdir, replace_in_file, save from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -29,6 +30,8 @@ class OpenTelemetryCppConan(ConanFile): "with_abseil": [True, False], "with_otlp_grpc": [True, False], "with_otlp_http": [True, False], + "with_otlp_http_compression": [True, False], + "with_otlp_file": [True, False], "with_zipkin": [True, False], "with_prometheus": [True, False], "with_elasticsearch": [True, False], @@ -50,7 +53,10 @@ class OpenTelemetryCppConan(ConanFile): "with_gsl": False, "with_abseil": True, "with_otlp_grpc": False, + # True because dependencies usually need this, and it would generate missing binaries for those "with_otlp_http": True, + "with_otlp_http_compression": False, + "with_otlp_file": False, "with_zipkin": True, "with_prometheus": False, "with_elasticsearch": False, @@ -94,6 +100,9 @@ def config_options(self): del self.options.with_jaeger if Version(self.version) >= "1.11": del self.options.with_logs_preview + if Version(self.version) < "1.16.0": + del self.options.with_otlp_file + del self.options.with_otlp_http_compression def configure(self): if self.options.shared: @@ -111,6 +120,19 @@ def _supports_new_proto_grpc_abseil(self): """ return Version(self.version) >= "1.12.0" + @property + def _needs_proto(self): + return self.options.with_otlp_grpc or self.options.with_otlp_http or self.options.get_safe("with_otlp_file") + + @property + def _otlp_http_needs_zlib(self): + # Bug before 1.17.X meant that zib was needed even with compression off + return (Version(self.version) >= "1.16.0" + # Check if new version released with this fix + # It was fixed in https://github.com/open-telemetry/opentelemetry-cpp/pull/3120 + and (Version(self.version) < "1.17.1" + or self.options.with_otlp_http_compression)) + def requirements(self): if self.options.with_gsl: self.requires("ms-gsl/4.0.0") @@ -121,7 +143,7 @@ def requirements(self): else: self.requires("abseil/[>=20230125.3 <=20230802.1]", transitive_headers=True) - if self.options.with_otlp_grpc or self.options.with_otlp_http: + if self._needs_proto: if self._supports_new_proto_grpc_abseil(): self.requires("protobuf/5.27.0", transitive_headers=True, transitive_libs=True) else: @@ -136,7 +158,8 @@ def requirements(self): if (self.options.with_zipkin or self.options.with_elasticsearch or self.options.with_otlp_http or - self.options.get_safe("with_etw") + self.options.get_safe("with_etw") or + self.options.get_safe("with_otlp_file") ): self.requires("nlohmann_json/3.11.3") self.requires("openssl/[>=1.1 <4]") @@ -147,6 +170,9 @@ def requirements(self): ): self.requires("libcurl/[>=7.78.0 <9]") + if self.options.with_otlp_http and self._otlp_http_needs_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_prometheus: self.requires("prometheus-cpp/1.1.0") @@ -189,7 +215,7 @@ def validate(self): raise ConanInvalidConfiguration("opentelemetry-cpp >= 1.12.0 does not support Apple Clang on Conan v1") def build_requirements(self): - if self.options.with_otlp_grpc or self.options.with_otlp_http: + if self._needs_proto: self.tool_requires("opentelemetry-proto/1.3.2") self.tool_requires("protobuf/") @@ -240,7 +266,11 @@ def generate(self): tc.cache_variables["WITH_OTLP"] = self.options.with_otlp_grpc or self.options.with_otlp_http tc.cache_variables["WITH_OTLP_GRPC"] = self.options.with_otlp_grpc tc.cache_variables["WITH_OTLP_HTTP"] = self.options.with_otlp_http - if self.options.with_otlp_grpc or self.options.with_otlp_http: + if Version(self.version) >= "1.16.0": + tc.cache_variables["WITH_OTLP_HTTP_COMPRESSION"] = self.options.with_otlp_http_compression + if self.options.get_safe("with_otlp_file"): + tc.cache_variables["WITH_OTLP_FILE"] = True + if self._needs_proto: tc.cache_variables["OTELCPP_PROTO_PATH"] = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/") tc.cache_variables["WITH_ZIPKIN"] = self.options.with_zipkin tc.cache_variables["WITH_PROMETHEUS"] = self.options.with_prometheus @@ -265,7 +295,7 @@ def generate(self): deps.generate() def _patch_sources(self): - if self.options.with_otlp_http or self.options.with_otlp_grpc: + if self._needs_proto: protos_path = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/") protos_cmake_path = os.path.join(self.source_folder, "cmake", "opentelemetry-proto.cmake") replace_in_file(self, protos_cmake_path, @@ -326,7 +356,7 @@ def _otel_libraries(self): if self.options.with_otlp_http or self.options.with_elasticsearch or self.options.get_safe("with_jaeger") or self.options.with_zipkin: # https://github.com/open-telemetry/opentelemetry-cpp/blob/v1.12.0/CMakeLists.txt#L452-L460 libraries.append(self._http_client_name) - if self.options.with_otlp_grpc or self.options.with_otlp_http: + if self._needs_proto: libraries.extend([ "opentelemetry_proto", "opentelemetry_otlp_recordable", @@ -345,6 +375,11 @@ def _otel_libraries(self): libraries.append("opentelemetry_exporter_otlp_http_metric") if Version(self.version) >= "1.11" or self.options.with_logs_preview: libraries.append("opentelemetry_exporter_otlp_http_log") + if self.options.get_safe("with_otlp_file"): + libraries.append("opentelemetry_exporter_otlp_file") + libraries.append("opentelemetry_exporter_otlp_file_client") + libraries.append("opentelemetry_exporter_otlp_file_metric") + libraries.append("opentelemetry_exporter_otlp_file_log") if self.options.with_prometheus: libraries.append("opentelemetry_exporter_prometheus") if self.options.with_elasticsearch and (Version(self.version) >= "1.11" or self.options.with_logs_preview): @@ -399,6 +434,9 @@ def package_info(self): if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["opentelemetry_common"].system_libs.extend(["pthread"]) + if Version(self.version) >= "1.16.0" and is_apple_os(self): + self.cpp_info.components["opentelemetry_common"].frameworks.extend(["CoreFoundation"]) + if self._stl_value: self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_CPP_STDLIB") @@ -462,6 +500,11 @@ def package_info(self): "opentelemetry_proto", ]) + if self._otlp_http_needs_zlib: + # This version requires zlib for the http client even if not used, as it includes zconf.h + # regardless of WITH_OTLP_HTTP_COMPRESSION + self.cpp_info.components["opentelemetry_exporter_otlp_http_client"].requires.append("zlib::zlib") + self.cpp_info.components["opentelemetry_exporter_otlp_http"].requires.extend([ "opentelemetry_otlp_recordable", "opentelemetry_exporter_otlp_http_client", @@ -478,6 +521,30 @@ def package_info(self): "opentelemetry_exporter_otlp_http_client", ]) + if self.options.get_safe("with_otlp_file"): + self.cpp_info.components["opentelemetry_exporter_otlp_file_client"].requires.extend([ + "nlohmann_json::nlohmann_json", + "opentelemetry_proto", + "opentelemetry_common" + ]) + if self.options.with_abseil: + self.cpp_info.components["opentelemetry_exporter_otlp_file_client"].requires.append("abseil::absl_strings") + + self.cpp_info.components["opentelemetry_exporter_otlp_file"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_client", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_file_log"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_client", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_file_metric"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_client", + ]) + if self.options.with_zipkin: self.cpp_info.components["opentelemetry_exporter_zipkin_trace"].requires.extend([ self._http_client_name, From fd370085bbd242cceae64c959781d16f0e8de7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Wed, 13 Nov 2024 17:44:45 +0100 Subject: [PATCH 5/5] Update recipes/opentelemetry-cpp/all/conanfile.py --- recipes/opentelemetry-cpp/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index ac0ab89b260d0..33d46b7aade44 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -437,6 +437,8 @@ def package_info(self): if Version(self.version) >= "1.16.0" and is_apple_os(self): self.cpp_info.components["opentelemetry_common"].frameworks.extend(["CoreFoundation"]) + if self.options.get_safe("with_otlp_http_compression"): + self.cpp_info.components["opentelemetry_common"].defines.append("ENABLE_OTLP_COMPRESSION_PREVIEW") if self._stl_value: self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_CPP_STDLIB")