Skip to content

Commit

Permalink
Merge branch 'main' into expo-histo-indexer-bench
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Jun 7, 2023
2 parents 9e134cb + d980e8b commit f966b99
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 33 deletions.
27 changes: 11 additions & 16 deletions buildscripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [[ ! -w "$(pwd)/sdk/src/version/version.cc" && ! -w "$(pwd)/api/include/open
exit 1
fi

# format: "v<MAJOR>.<MINOR>.<PATCH>-<PRERELEASE>+<BUILDMETADATA>-<NUMBER_OF_NEW_COMMITS>-g<LAST_COMMIT_HASH>""
# format: "v<MAJOR>.<MINOR>.<PATCH>-<PRERELEASE>+<BUILDMETADATA>-<NUMBER_OF_NEW_COMMITS>-g<LAST_COMMIT_HASH>"
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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <chrono>
#include <cstddef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> is_aborted_; // Set to 'true' when async callback is aborted
Expand Down
22 changes: 21 additions & 1 deletion ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions sdk/include/opentelemetry/sdk/version/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 8 additions & 12 deletions sdk/src/version/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f966b99

Please sign in to comment.