Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump to gRPC v1.48.1 for bazel CIs #1786

Merged
merged 6 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ def opentelemetry_cpp_deps():
],
)

maybe(
http_archive,
name = "com_google_absl_latest11",
sha256 = "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
strip_prefix = "abseil-cpp-20211102.0",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/20211102.0.tar.gz",
"https:/abseil/abseil-cpp/archive/20211102.0.tar.gz",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repository.bzl is already using:
strip_prefix = "abseil-cpp-20220623.1",

Per the abseil release notes:
https:/abseil/abseil-cpp/releases/tag/20220623.1
this is the latest abseil version using C++11.

Why do we need to use an older version ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest gRPC can not work with a old abseil-cpp , I think we can use a old gRPC and abseil-cpp with legacy toolchain and the latest version with modern toolchain.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, grpc-1.46.4 is the last gRPC release supporting C++11, which is dependent on abseil-cpp-20211102.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gRPC 1.46.4 is the last with C++11 support which has dependency on abseil-cpp-20211102.0. But it seems it works with the latest abseil as well:
https:/open-telemetry/opentelemetry-cpp/actions/runs/3516378955/jobs/5892867609

I'm going to remove it.

],
)

# Load abseil dependency(optional)
maybe(
http_archive,
Expand All @@ -72,13 +83,23 @@ def opentelemetry_cpp_deps():
],
)

maybe(
http_archive,
name = "com_github_grpc_grpc_latest11",
sha256 = "e266aa0d9d9cddb876484a370b94f468248594a96ca0b6f87c21f969db2b8c5b",
strip_prefix = "grpc-1.46.4",
urls = [
"https:/grpc/grpc/archive/v1.46.4.tar.gz",
],
)

maybe(
http_archive,
name = "com_github_grpc_grpc",
sha256 = "b74ce7d26fe187970d1d8e2c06a5d3391122f7bc1fdce569aff5e435fb8fe780",
strip_prefix = "grpc-1.43.2",
sha256 = "320366665d19027cda87b2368c03939006a37e0388bfd1091c8d2a96fbc93bd8",
strip_prefix = "grpc-1.48.1",
urls = [
"https:/grpc/grpc/archive/v1.43.2.tar.gz",
"https:/grpc/grpc/archive/v1.48.1.tar.gz",
],
)

Expand Down
11 changes: 8 additions & 3 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function run_benchmarks

[ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark
mkdir -p $BENCHMARK_DIR
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-std=c++14 $BAZEL_OPTIONS_ASYNC -c opt -- \
$(bazel query 'attr("tags", "benchmark_result", ...)')
echo ""
echo "Benchmark results in $BENCHMARK_DIR:"
Expand Down Expand Up @@ -59,7 +59,8 @@ mkdir -p "${BUILD_DIR}"
[ -z "${PLUGIN_DIR}" ] && export PLUGIN_DIR=$HOME/plugin
mkdir -p "${PLUGIN_DIR}"

BAZEL_OPTIONS="--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_TEST --copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW"
BAZEL_OPTIONS_DEFAULT="--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_TEST --copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW"
BAZEL_OPTIONS="--cxxopt=-std=c++14 $BAZEL_OPTIONS_DEFAULT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the PR description correctly, we will add the CI test for gRPC-1.46.4 ( i.e building with C++11) in separate PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes #1787, gRPC with C++11 needed to be defined in the main branch first.


BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors"

Expand Down Expand Up @@ -298,9 +299,13 @@ elif [[ "$1" == "bazel.valgrind" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC //...
bazel $BAZEL_STARTUP_OPTIONS test --run_under="/usr/bin/valgrind --leak-check=full --error-exitcode=1 --suppressions=\"${SRC_DIR}/ci/valgrind-suppressions\"" $BAZEL_TEST_OPTIONS_ASYNC //...
exit 0
elif [[ "$1" == "bazel.e2e" ]]; then
cd examples/e2e
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_DEFAULT //...
exit 0
elif [[ "$1" == "benchmark" ]]; then
[ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-std=c++14 $BAZEL_OPTIONS_ASYNC -c opt -- \
$(bazel query 'attr("tags", "benchmark_result", ...)')
echo ""
echo "Benchmark results in $BENCHMARK_DIR:"
Expand Down
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_grpc_exporter_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ BENCHMARK(BM_OtlpExporterDenseSpans);
} // namespace exporter
OPENTELEMETRY_END_NAMESPACE

#ifdef NDEBUG
namespace
{
opentelemetry::exporter::otlp::OtlpGrpcExporterOptions opts;
Expand All @@ -212,5 +213,6 @@ void BM_otlp_grpc_with_collector(benchmark::State &state)
}
BENCHMARK(BM_otlp_grpc_with_collector);
} // namespace
#endif

BENCHMARK_MAIN();
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_http_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# include "opentelemetry/sdk/trace/tracer_provider.h"
# include "opentelemetry/trace/provider.h"

# include <google/protobuf/message_lite.h>
# include <gtest/gtest.h>
# include "gmock/gmock.h"

Expand Down Expand Up @@ -466,6 +467,7 @@ TEST_F(OtlpHttpExporterTestPeer, ExportJsonIntegrationTestSync)
TEST_F(OtlpHttpExporterTestPeer, ExportJsonIntegrationTestAsync)
{
ExportJsonIntegrationTestAsync();
google::protobuf::ShutdownProtobufLibrary();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is protobuf library loaded explicitly?

Copy link
Member Author

@esigo esigo Nov 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is needed to delete any global objects that were allocated by the Protocol Buffer: https://developers.google.com/protocol-buffers/docs/cpptutorial

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing the doc. It looks optional in the doc. Also wondering whether live global objects should be considered as leak.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is optional, here we need it to prevent the leak report though.
Live global objects should not be considered as leak.

}
# endif

Expand Down
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_http_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# include "opentelemetry/sdk/logs/logger_provider.h"
# include "opentelemetry/sdk/resource/resource.h"

# include <google/protobuf/message_lite.h>
# include <gtest/gtest.h>
# include "gmock/gmock.h"

Expand Down Expand Up @@ -507,6 +508,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestSync)
TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestAsync)
{
ExportJsonIntegrationTestAsync();
google::protobuf::ShutdownProtobufLibrary();
}
# endif

Expand Down
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/resource/resource.h"

#include <google/protobuf/message_lite.h>
#include <gtest/gtest.h>
#include "gmock/gmock.h"

Expand Down Expand Up @@ -845,6 +846,7 @@ TEST_F(OtlpHttpMetricExporterTestPeer, ConfigJsonBytesMappingTest)
opts.json_bytes_mapping = JsonBytesMappingKind::kHex;
std::unique_ptr<OtlpHttpMetricExporter> exporter(new OtlpHttpMetricExporter(opts));
EXPECT_EQ(GetOptions(exporter).json_bytes_mapping, JsonBytesMappingKind::kHex);
google::protobuf::ShutdownProtobufLibrary();
}

#ifndef NO_GETENV
Expand Down