From 500cf98f0b9549da5539af60ce4a0a0f79f4eb11 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 6 Jun 2023 08:47:01 +0200 Subject: [PATCH 1/3] [EXPORTER] Fixed HTTP CURL for 32bits platforms --- .../http/client/curl/http_operation_curl.h | 2 ++ .../http/client/curl/http_operation_curl.cc | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index 65355a05cd..b711ac8445 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -269,6 +269,8 @@ class HttpOperation CURLcode SetCurlLongOption(CURLoption option, long value); + CURLcode SetCurlOffOption(CURLoption option, curl_off_t value); + const char *GetCurlErrorMessage(CURLcode code); std::atomic is_aborted_; // Set to 'true' when async callback is aborted diff --git a/ext/src/http/client/curl/http_operation_curl.cc b/ext/src/http/client/curl/http_operation_curl.cc index dcb1ec9042..22b2565e6f 100644 --- a/ext/src/http/client/curl/http_operation_curl.cc +++ b/ext/src/http/client/curl/http_operation_curl.cc @@ -556,6 +556,26 @@ CURLcode HttpOperation::SetCurlLongOption(CURLoption option, long value) return rc; } +CURLcode HttpOperation::SetCurlOffOption(CURLoption option, curl_off_t value) +{ + CURLcode rc; + + /* + curl_easy_setopt() is a macro with variadic arguments, type unsafe. + SetCurlOffOption() ensures it is called with a curl_off_t. + */ + rc = curl_easy_setopt(curl_resource_.easy_handle, option, value); + + if (rc != CURLE_OK) + { + const char *message = GetCurlErrorMessage(rc); + OTEL_INTERNAL_LOG_ERROR("CURL, set option <" << std::to_string(option) << "> failed: <" + << message << ">"); + } + + return rc; +} + CURLcode HttpOperation::Setup() { if (!curl_resource_.easy_handle) @@ -980,7 +1000,7 @@ CURLcode HttpOperation::Setup() return rc; } - rc = SetCurlLongOption(CURLOPT_POSTFIELDSIZE_LARGE, req_size); + rc = SetCurlOffOption(CURLOPT_POSTFIELDSIZE_LARGE, req_size); if (rc != CURLE_OK) { return rc; From 600bd305fec6cf5e7a9e206953f9602799b3f3fe Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 6 Jun 2023 10:16:24 +0200 Subject: [PATCH 2/3] [BUILD] Avoid dependency on protobuf from the OTLP HTTP metrics exporter header --- .../opentelemetry/exporters/otlp/otlp_http_metric_exporter.h | 1 - 1 file changed, 1 deletion(-) diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h index d09d7f525c..0aebf79760 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h @@ -8,7 +8,6 @@ #include "opentelemetry/exporters/otlp/otlp_environment.h" #include "opentelemetry/exporters/otlp/otlp_http_client.h" #include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" -#include "opentelemetry/exporters/otlp/otlp_metric_utils.h" #include #include From d980e8b4066d3b268be7c246345732d31da1f7cf Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 6 Jun 2023 12:25:57 +0200 Subject: [PATCH 3/3] [SDK] Simplify SDK version --- buildscripts/pre-commit | 27 ++++++++----------- .../opentelemetry/sdk/version/version.h | 3 --- sdk/src/version/version.cc | 20 ++++++-------- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/buildscripts/pre-commit b/buildscripts/pre-commit index eb09e01c2c..c21f363b5a 100755 --- a/buildscripts/pre-commit +++ b/buildscripts/pre-commit @@ -10,7 +10,7 @@ if [[ ! -w "$(pwd)/sdk/src/version/version.cc" && ! -w "$(pwd)/api/include/open exit 1 fi -# format: "v..-+--g"" +# format: "v..-+--g" semver_regex="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-([0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*))?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?-([0-9]+)-g([0-9|a-z]+)$" git_tag=$(git describe --tags --long 2>/dev/null) || true if [[ ! -z $git_tag ]] && [[ $git_tag =~ $semver_regex ]]; then @@ -22,7 +22,7 @@ if [[ ! -z $git_tag ]] && [[ $git_tag =~ $semver_regex ]]; then count_new_commits="${BASH_REMATCH[9]}" latest_commit_hash="${BASH_REMATCH[10]}" if [[ -z ${major} ]] || [[ -z ${minor} ]] || [[ -z ${patch} ]] || [[ -z ${count_new_commits} ]] || [[ -z ${latest_commit_hash} ]]; then - echo "Error: Incorrect tag format recevived. Exiting.." + echo "Error: Incorrect tag format received. Exiting.." exit 1 fi else @@ -38,9 +38,8 @@ if [[ -z ${latest_commit_hash} ]]; then exit 1 fi -branch="$(git rev-parse --abbrev-ref HEAD)" short_version="${major}.${minor}.${patch}" -full_version="${short_version}-${pre_release}-${build_metadata}-${count_new_commits}-${branch}-${latest_commit_hash}" +full_version="${short_version}-${pre_release}-${build_metadata}" # Update api version.h sed -i "/^\#define OPENTELEMETRY_VERSION /c\#define OPENTELEMETRY_VERSION \"${short_version}\"" "$(pwd)/api/include/opentelemetry/version.h" @@ -64,18 +63,14 @@ namespace sdk { namespace version { -const int major_version = ${major}; -const int minor_version = ${minor}; -const int patch_version = ${patch}; -const char *pre_release = "${pre_release}"; -const char *build_metadata = "${build_metadata}"; -const int count_new_commits = ${count_new_commits}; -const char *branch = "${branch}"; -const char *commit_hash = "${latest_commit_hash}"; -const char *short_version = "${short_version}"; -const char *full_version = - "${full_version}"; -const char *build_date = "$(date -u)"; +const int major_version = ${major}; +const int minor_version = ${minor}; +const int patch_version = ${patch}; +const char *pre_release = "${pre_release}"; +const char *build_metadata = "${build_metadata}"; +const char *short_version = "${short_version}"; +const char *full_version = "${full_version}"; +const char *build_date = "$(date -u)"; } // namespace version } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/version/version.h b/sdk/include/opentelemetry/sdk/version/version.h index 758805b19c..1c9c285f90 100644 --- a/sdk/include/opentelemetry/sdk/version/version.h +++ b/sdk/include/opentelemetry/sdk/version/version.h @@ -19,9 +19,6 @@ extern const int minor_version; extern const int patch_version; extern const char *pre_release; extern const char *build_metadata; -extern const int count_new_commits; -extern const char *branch; -extern const char *commit_hash; extern const char *short_version; extern const char *full_version; extern const char *build_date; diff --git a/sdk/src/version/version.cc b/sdk/src/version/version.cc index 6dfc299814..a658331f27 100644 --- a/sdk/src/version/version.cc +++ b/sdk/src/version/version.cc @@ -11,18 +11,14 @@ namespace sdk { namespace version { -const int major_version = 1; -const int minor_version = 9; -const int patch_version = 1; -const char *pre_release = "NONE"; -const char *build_metadata = "NONE"; -const int count_new_commits = 22; -const char *branch = "make_release_1.9.1"; -const char *commit_hash = "5592180d539b59c4e8293bc927f5a6431fcbacdf"; -const char *short_version = "1.9.1"; -const char *full_version = - "1.9.1-NONE-NONE-22-make_release_1.9.1-5592180d539b59c4e8293bc927f5a6431fcbacdf"; -const char *build_date = "Fri 26 May 2023 07:14:07 AM UTC"; +const int major_version = 1; +const int minor_version = 9; +const int patch_version = 1; +const char *pre_release = "NONE"; +const char *build_metadata = "NONE"; +const char *short_version = "1.9.1"; +const char *full_version = "1.9.1-NONE-NONE"; +const char *build_date = "Fri 26 May 2023 07:14:07 AM UTC"; } // namespace version } // namespace sdk OPENTELEMETRY_END_NAMESPACE