Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into default-span-doc
Browse files Browse the repository at this point in the history
lalitb authored Aug 24, 2021
2 parents eba40b9 + 115a136 commit 22bf451
Showing 13 changed files with 35 additions and 41 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -22,3 +22,4 @@ common:tsan --cc_output_directory_tag=tsan
# This is needed to address false positive problem with abseil.The same setting as gRPC
# https://github.com/google/sanitizers/issues/953
common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0

2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.2
4.2.0
26 changes: 1 addition & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -128,30 +128,6 @@ jobs:
- name: run tests
run: ./ci/do_ci.sh cmake.test_example_plugin

bazel_gcc_48_test:
name: Bazel gcc 4.8
runs-on: ubuntu-18.04
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_gcc_48_test
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
sudo ./ci/install_bazelisk.sh
sudo ./ci/install_gcc48.sh
- name: run tests
run: ./ci/do_ci.sh bazel.legacy.test
env:
CC: /usr/bin/gcc-4.8

bazel_test:
name: Bazel
runs-on: ubuntu-latest
@@ -272,7 +248,7 @@ jobs:
path: /Users/runner/.cache/bazel
key: bazel_osx
- name: run tests
run: ./ci/do_ci.sh bazel.test
run: ./ci/do_ci.sh bazel.macos.test

benchmark:
name: Benchmark
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -374,7 +374,7 @@ endif()
# config file for find_packages(opentelemetry-cpp CONFIG)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/opentelemetry-cpp-config.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/cmake/opentelemetry-cpp-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
PATH_VARS OPENTELEMETRY_ABI_VERSION_NO OPENTELEMETRY_VERSION PROJECT_NAME
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -133,6 +133,8 @@ target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES})

## Build instructions using Bazel

NOTE: Experimental, and not supported for all the components.

### Prerequisites for Bazel

- A supported platform (e.g. Windows, macOS or Linux).
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -47,11 +47,16 @@ of the current project.

Our CI pipeline builds and tests on following `x86-64` platforms:

* ubuntu-18.04 (Default GCC Compiler - 7.5.0)
* ubuntu-18.04 (GCC 4.8 with -std=c++11 flag)
* ubuntu-20.04 (Default GCC Compiler - 9.3.0 with -std=c++20 flags)
* macOS 10.15 (Xcode 12.2)
* Windows Server 2019 (Visual Studio Enterprise 2019)
| Platform | Build type |
|---------------------------------------------------------------------|---------------|
| ubuntu-18.04 (Default GCC Compiler - 7.5.0) | CMake, Bazel |
| ubuntu-18.04 (GCC 4.8 with -std=c++11 flag) | CMake [1] |
| ubuntu-20.04 (Default GCC Compiler - 9.3.0 with -std=c++20 flags) | CMake, Bazel |
| macOS 10.15 (Xcode 12.2) | Bazel |
| Windows Server 2019 (Visual Studio Enterprise 2019) | CMake, Bazel |

[1]: Bazel build is disabled for GCC 4.8, as GRPC library ( required by OTLP expoter)
doesn't build with this compiler. CMake build won't build OTLP exporter with GCC 4.8.

In general, the code shipped from this repository should build on all platforms
having C++ compiler with [supported C++ standards](#supported-c-versions).
12 changes: 6 additions & 6 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
@@ -32,20 +32,20 @@ def opentelemetry_cpp_deps():
maybe(
http_archive,
name = "com_github_grpc_grpc_legacy",
sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a",
strip_prefix = "grpc-1.33.2",
sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec",
strip_prefix = "grpc-1.39.1",
urls = [
"https://github.com/grpc/grpc/archive/v1.33.2.tar.gz",
"https://github.com/grpc/grpc/archive/v1.39.1.tar.gz",
],
)

maybe(
http_archive,
name = "com_github_grpc_grpc",
sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a",
strip_prefix = "grpc-1.33.2",
sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec",
strip_prefix = "grpc-1.39.1",
urls = [
"https://github.com/grpc/grpc/archive/v1.33.2.tar.gz",
"https://github.com/grpc/grpc/archive/v1.39.1.tar.gz",
],
)

9 changes: 9 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
@@ -25,6 +25,11 @@ mkdir -p "${PLUGIN_DIR}"

BAZEL_OPTIONS="--copt=-DENABLE_METRICS_PREVIEW --copt=-DENABLE_LOGS_PREVIEW"
BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors"

# https://github.com/bazelbuild/bazel/issues/4341
BAZEL_MACOS_OPTIONS="$BAZEL_OPRIONS --features=-supports_dynamic_linker"
BAZEL_MACOS_TEST_OPTIONS="$BAZEL_MACOS_OPTIONS --test_output=errors"

BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel"

export CTEST_OUTPUT_ON_FAILURE=1
@@ -158,6 +163,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.macos.test" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS //...
exit 0
elif [[ "$1" == "bazel.legacy.test" ]]; then
# we uses C++ future and async() function to test the Prometheus Exporter functionality,
# that make this test always fail. ignore Prometheus exporter here.
2 changes: 1 addition & 1 deletion ci/install_bazelisk.sh
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

set -e

BAZELISK_VERSION=v1.7.4
BAZELISK_VERSION=v1.10.1

wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/$BAZELISK_VERSION/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazel
2 changes: 1 addition & 1 deletion ci/setup_grpc.sh
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
set -e
export DEBIAN_FRONTEND=noninteractive
old_grpc_version='v1.33.2'
new_grpc_version='v1.39.0'
new_grpc_version='v1.39.1'
gcc_version_for_new_grpc='5.1'
install_grpc_version=${new_grpc_version}
grpc_version='v1.39.0'
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ struct ZipkinExporterOptions
std::string service_name = "default-service";
std::string ipv4;
std::string ipv6;
ext::http::client::Headers headers = {{"content-type", "application/json"}};
};

namespace trace_sdk = opentelemetry::sdk::trace;
2 changes: 1 addition & 1 deletion exporters/zipkin/src/zipkin_exporter.cc
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ sdk::common::ExportResult ZipkinExporter::Export(
}
auto body_s = json_spans.dump();
http_client::Body body_v(body_s.begin(), body_s.end());
auto result = http_client_->Post(url_parser_.url_, body_v);
auto result = http_client_->Post(url_parser_.url_, body_v, options_.headers);
if (result &&
(result.GetResponse().GetStatusCode() == 200 || result.GetResponse().GetStatusCode() == 202))
{

0 comments on commit 22bf451

Please sign in to comment.