This commit is contained in:
WenTao Ou 2022-01-15 08:53:15 +08:00 коммит произвёл GitHub
Родитель d206b505e0
Коммит b8fae39f81
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
25 изменённых файлов: 67 добавлений и 4 удалений

22
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -150,6 +150,28 @@ jobs:
- name: run tests
run: ./ci/do_ci.sh bazel.test
bazel_with_abseil:
name: Bazel with external abseil
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Mount Bazel Cache
uses: actions/cache@v2
env:
cache-name: bazel_cache
with:
path: /home/runner/.cache/bazel
key: bazel_test
- name: setup
run: |
sudo ./ci/setup_thrift.sh dependencies_only
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_bazelisk.sh
- name: run tests
run: ./ci/do_ci.sh bazel.with_abseil
bazel_valgrind:
name: Bazel valgrind
runs-on: ubuntu-latest

Просмотреть файл

@ -17,6 +17,7 @@ Increment the:
* [SDK] Add LogLevel to internal_log ([#1147](https://github.com/open-telemetry/opentelemetry-cpp/pull/1147))
* [API/SDK] Logger: Propagating resources through LoggerProvider ([#1154](https://github.com/open-telemetry/opentelemetry-cpp/pull/1154))
* [API]: Allow to use external abseil for bazel targets ([#1172](https://github.com/open-telemetry/opentelemetry-cpp/pull/1172))
## [1.1.1] 2021-12-20

Просмотреть файл

@ -12,11 +12,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
package(default_visibility = ["//visibility:public"])
bool_flag(
name = "with_abseil",
build_setting_default = False,
)
cc_library(
name = "api",
hdrs = glob(["include/**/*.h"]),
defines = select({
":with_external_abseil": ["HAVE_ABSEIL"],
"//conditions:default": [],
}),
strip_include_prefix = "include",
tags = ["api"],
deps = select({
":with_external_abseil": [
"@com_google_absl//absl/base",
"@com_google_absl//absl/types:variant",
],
"//conditions:default": [],
}),
)
config_setting(
name = "with_external_abseil",
flag_values = {":with_abseil": "true"},
)

Просмотреть файл

@ -47,9 +47,9 @@ OPENTELEMETRY_END_NAMESPACE
# endif
# ifdef HAVE_ABSEIL
# include <absl/types/variant.h>
# include "absl/types/variant.h"
# else
# include "./absl/types/variant.h"
# include "./internal/absl/types/variant.h"
# endif
# ifdef _MSC_VER

Просмотреть файл

@ -28,6 +28,17 @@ def opentelemetry_cpp_deps():
],
)
# Load abseil dependency(optional)
maybe(
http_archive,
name = "com_google_absl",
sha256 = "dd7db6815204c2a62a2160e32c55e97113b0a0178b2f090d6bab5ce36111db4b",
strip_prefix = "abseil-cpp-20210324.0",
urls = [
"https://github.com/abseil/abseil-cpp/archive/20210324.0.tar.gz",
],
)
# Load gRPC dependency
maybe(
http_archive,

Просмотреть файл

@ -162,6 +162,10 @@ elif [[ "$1" == "bazel.test" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //...
exit 0
elif [[ "$1" == "bazel.with_abseil" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS --//api:with_abseil=true //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS --//api:with_abseil=true //...
exit 0
elif [[ "$1" == "bazel.macos.test" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS //...

Просмотреть файл

@ -18,7 +18,7 @@ Both these dependencies are listed here:
- [API](https://github.com/open-telemetry/opentelemetry-cpp/tree/v1.0.0-rc1/api) & [SDK](https://github.com/open-telemetry/opentelemetry-cpp/tree/v1.0.0-rc1/sdk):
- Uses Standard C++ library for latest features (std::string_view, std::variant, std::span, std::shared_ptr, std::unique_ptr) with C++14/17/20 compiler if `WITH_STL` cmake option is enabled or `HAVE_CPP_STDLIB` macro is defined. License: `GNU General Public License`
- For C++11/14/17 compilers, fallback to gsl::span if [GSL C++ library](https://github.com/microsoft/GSL) is installed. License: `MIT License`
- Uses Abseil C++ Library for `absl::variant` as default `nostd::variant` if `WITH_ABSEIL` cmake option is enabled. License: `Apache License 2.0`
- Uses Abseil C++ Library for `absl::variant` as default `nostd::variant` if `WITH_ABSEIL` cmake option or `--@io_opentelemetry_cpp/api:with_abseil=true` (aka `--//api:with_abseil=true`) bazel option is enabled. License: `Apache License 2.0`
- [OTLP/HTTP+JSON](https://github.com/open-telemetry/opentelemetry-cpp/tree/v1.0.0-rc1/exporters/otlp) exporter:
- [protobuf](https://github.com/protocolbuffers/protobuf): Library to serialize structured data.

Просмотреть файл

@ -57,7 +57,9 @@ gRPC internally uses a different version of Abseil than OpenTelemetry C++ SDK.
One option to optimize your code is to build the SDK with system-provided
Abseil library. If you are using CMake, then `-DWITH_ABSEIL=ON` may be passed
during the build of SDK to reuse the same Abseil library as gRPC.
during the build of SDK to reuse the same Abseil library as gRPC. If you are
using Bazel, then `--@io_opentelemetry_cpp/api:with_abseil=true` may be passed
to reuse your Abseil library in your project.
If you do not want to pursue the above option, and in case if you run into
conflict between Abseil library and OpenTelemetry C++ `absl::variant`