Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit c484d16
Merge: 0abf162 7e90dae
Author: WenTao Ou <admin@owent.net>
Date:   Tue Jun 7 10:57:25 2022 +0800

    Merge remote-tracking branch 'opentelemetry/main' into async-changes

    Signed-off-by: WenTao Ou <admin@owent.net>

    # Conflicts:
    #	CHANGELOG.md

commit 0abf162
Merge: cd3655f 5c8f476
Author: WenTao Ou <admin@owent.net>
Date:   Wed May 25 12:11:04 2022 +0800

    Merge remote-tracking branch 'opentelemetry/main' into merge_main_into_async-changes

commit cd3655f
Merge: d7b03e8 63803d1
Author: owent <admin@owent.net>
Date:   Fri May 20 14:28:31 2022 +0800

    Merge branch 'merge_async-changes_into_main' into merge_main_into_async-changes

    Signed-off-by: owent <admin@owent.net>

    # Conflicts:
    #	CHANGELOG.md
    #	CMakeLists.txt
    #	api/CMakeLists.txt
    #	api/include/opentelemetry/common/spin_lock_mutex.h
    #	ci/do_ci.ps1
    #	ci/do_ci.sh
    #	examples/common/metrics_foo_library/foo_library.cc
    #	examples/prometheus/prometheus.yml
    #	exporters/otlp/test/otlp_http_log_exporter_test.cc
    #	ext/src/http/client/curl/CMakeLists.txt

commit d7b03e8
Author: WenTao Ou <admin@owent.net>
Date:   Fri May 20 13:25:24 2022 +0800

    Merge main into async changes (#1411)

commit 0aebd6e
Author: WenTao Ou <admin@owent.net>
Date:   Mon May 16 23:26:41 2022 +0800

    Merge main into async changes (#1395)

commit 08a12b5
Author: WenTao Ou <admin@owent.net>
Date:   Thu May 12 00:51:48 2022 +0800

    Cocurrency otlp http session (#1317)

commit c614258
Author: DEBAJIT DAS <85024550+DebajitDas@users.noreply.github.com>
Date:   Wed May 4 22:55:20 2022 +0530

     Added max async export support using separate AsyncBatchSpan/LogProcessor (#1306)

commit 465158c
Author: WenTao Ou <admin@owent.net>
Date:   Mon Apr 25 23:48:02 2022 +0800

    Merge `main` into `async-changes` (#1348)

    * install sdk config (#1273)

    * Bump actions/cache from 2 to 3 (#1277)

    * Add owent as an Approver (#1276)

    * add owent as reviewer

    * fix order

    * Disable benchmark action failure (#1284)

    * metrics exemplar round 1 (#1264)

    * [Metrics SDK] - fix spelling (AggregationTemporarily to AggregationTemporality) (#1288)

    * fix compilation error with protobuf 3.5 (#1289)

    * Fix span SetAttribute crash (#1283)

    * Synchronous Metric collection (Delta , Cumulative) (#1265)

    * Rename `http_client_curl` to `opentelemetry_http_client_curl` (#1301)

    Signed-off-by: owent <admin@owent.net>

    * Don't show coverage annotation for pull requests (#1304)

    * Implement periodic exporting metric reader (#1286)

    * Add `async-changes` branch to pull_request of github action (#1309)

    Signed-off-by: owent <admin@owent.net>

    * Add InstrumentationInfo and Resource to the metrics data to be exported. (#1299)

    * Excempt should be applied on issue instead of PR (#1316)

    * Bump codecov/codecov-action from 2.1.0 to 3 (#1318)

    * Move public definitions into `opentelemetry_api`. (#1314)

    Signed-off-by: owent <admin@owent.net>

    * Add building test without RTTI (#1294)

    * Remove implicitly deleted default constructor (#1267)

    Co-authored-by: Tom Tan <Tom.Tan@microsoft.com>
    Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>

    * [ETW Exporter] - ETW provider handle cleanup (#1322)

    * Bump actions/stale from 4 to 5 (#1323)

    * ostream metrics example (#1312)

    * Prepare v1.3.0 release (#1324)

    * Update yield logic for ARM processor (#1325)

    * Fix for #1292 (#1326)

    * Implement Merge and Diff operation for Histogram Aggregation (#1303)

    * fix metrics compiler warnings (#1328)

    * Replace deprecated googletest API (#1327)

    * Remove redundant tail / in CMake install (#1329)

    * dependencies image as artifact (#1333)

    Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>

    * metrics histogram example (#1330)

    * Link `opentelemetry_ext` with `opentelemetry_api` (#1336)

    * ostream metrics cmake (#1344)

    * Fix conflicts

    Signed-off-by: owent <admin@owent.net>

    * Using clang-format-10 to format codes(clang-format-14 has a different output)

    Signed-off-by: owent <admin@owent.net>

    Co-authored-by: Ehsan Saei <71217171+esigo@users.noreply.github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
    Co-authored-by: Tom Tan <Tom.Tan@microsoft.com>
    Co-authored-by: Ben Landrum <71329856+benlandrum@users.noreply.github.com>
    Co-authored-by: jmanjon <67091862+juandemanjon@users.noreply.github.com>

commit 73f3515
Author: WenTao Ou <admin@owent.net>
Date:   Wed Apr 6 15:41:42 2022 +0800

    Merge main into async changes (#1321)

commit ad3bdfe
Author: DEBAJIT DAS <85024550+DebajitDas@users.noreply.github.com>
Date:   Thu Mar 31 09:56:24 2022 +0530

    Added feature flag for asynchronous export (#1295)

commit 15e7725
Author: WenTao Ou <admin@owent.net>
Date:   Tue Mar 29 13:09:11 2022 +0800

    Cocurrency otlp http session (#1281)

commit 729c2f8
Author: DEBAJIT DAS <85024550+DebajitDas@users.noreply.github.com>
Date:   Tue Mar 22 23:47:14 2022 +0530

    Changing the type of callback function in Export function to std::function (#1278)

commit 6f53da3
Author: DEBAJIT DAS <85024550+DebajitDas@users.noreply.github.com>
Date:   Mon Mar 21 19:31:51 2022 +0530

    Async callback Exporter to Processor changes  (#1275)

commit c3eaa9d
Author: WenTao Ou <owentou@tencent.com>
Date:   Mon Mar 21 14:41:51 2022 +0800

    Cocurrency otlp http session (#1274)
  • Loading branch information
owent committed Jun 7, 2022
1 parent 7e90dae commit 4603f20
Show file tree
Hide file tree
Showing 70 changed files with 5,501 additions and 1,239 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,28 @@ jobs:
- name: run tests
run: ./ci/do_ci.sh bazel.test

bazel_test_async:
name: Bazel with async export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Mount Bazel Cache
uses: actions/cache@v3
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_async_export

bazel_with_abseil:
name: Bazel with external abseil
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Increment the:

## [Unreleased]

* [SDK] Async Batch Span/Log processor with max async support ([#1306](https://github.com/open-telemetry/opentelemetry-cpp/pull/1306))
* [EXPORTER] OTLP http exporter allow concurrency session ([#1209](https://github.com/open-telemetry/opentelemetry-cpp/pull/1209))
* [EXT] `curl::HttpClient` use `curl_multi_handle` instead of creating a thread
for every request and it's able to reuse connections now. ([#1317](https://github.com/open-telemetry/opentelemetry-cpp/pull/1317))
* [METRICS] Only record non-negative / finite / Non-NAN histogram values([#1427](https://github.com/open-telemetry/opentelemetry-cpp/pull/1427))

## [1.4.0] 2022-05-17
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ option(WITH_EXAMPLES "Whether to build examples" ON)

option(WITH_METRICS_PREVIEW "Whether to build metrics preview" OFF)
option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF)
option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF)

find_package(Threads)

Expand Down
4 changes: 4 additions & 0 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ if(WIN32)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
endif()
endif()

if(WITH_ASYNC_EXPORT_PREVIEW)
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_ASYNC_EXPORT)
endif()
33 changes: 19 additions & 14 deletions api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ class SpinLockMutex
SpinLockMutex &operator=(const SpinLockMutex &) = delete;
SpinLockMutex &operator=(const SpinLockMutex &) volatile = delete;

static inline void fast_yield() noexcept
{
// Issue a Pause/Yield instruction while spinning.
#if defined(_MSC_VER)
YieldProcessor();
#elif defined(__i386__) || defined(__x86_64__)
# if defined(__clang__)
_mm_pause();
# else
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__asm__ volatile("yield" ::: "memory");
#else
// TODO: Issue PAGE/YIELD on other architectures.
#endif
}

/**
* Attempts to lock the mutex. Return immediately with `true` (success) or `false` (failure).
*/
Expand Down Expand Up @@ -91,20 +109,7 @@ class SpinLockMutex
{
return;
}
// Issue a Pause/Yield instruction while spinning.
#if defined(_MSC_VER)
YieldProcessor();
#elif defined(__i386__) || defined(__x86_64__)
# if defined(__clang__)
_mm_pause();
# else
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__asm__ volatile("yield" ::: "memory");
#else
// TODO: Issue PAGE/YIELD on other architectures.
#endif
fast_yield();
}
// Yield then try again (goal ~100ns)
std::this_thread::yield();
Expand Down
34 changes: 34 additions & 0 deletions api/include/opentelemetry/common/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,39 @@ class SteadyTimestamp
private:
int64_t nanos_since_epoch_;
};

class DurationUtil
{
public:
template <class Rep, class Period>
static std::chrono::duration<Rep, Period> AdjustWaitForTimeout(
std::chrono::duration<Rep, Period> timeout,
std::chrono::duration<Rep, Period> indefinite_value) noexcept
{
// Do not call now() when this duration is max value, now() may have a expensive cost.
if (timeout == std::chrono::duration<Rep, Period>::max())
{
return indefinite_value;
}

// std::future<T>::wait_for, std::this_thread::sleep_for, and std::condition_variable::wait_for
// may use steady_clock or system_clock.We need make sure now() + timeout do not overflow.
auto max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
std::chrono::steady_clock::time_point::max() - std::chrono::steady_clock::now());
if (timeout >= max_timeout)
{
return indefinite_value;
}
max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
std::chrono::system_clock::time_point::max() - std::chrono::system_clock::now());
if (timeout >= max_timeout)
{
return indefinite_value;
}

return timeout;
}
};

} // namespace common
OPENTELEMETRY_END_NAMESPACE
24 changes: 14 additions & 10 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $action = $args[0]

$SRC_DIR = (Get-Item -Path ".\").FullName

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

if (!(test-path build)) {
Expand All @@ -31,8 +31,9 @@ switch ($action) {
"cmake.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
Expand All @@ -51,9 +52,10 @@ switch ($action) {
"cmake.exporter.otprotocol.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_OTPROTCOL=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
-DWITH_OTPROTCOL=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
Expand All @@ -72,8 +74,9 @@ switch ($action) {
"cmake.build_example_plugin" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
Expand All @@ -88,8 +91,9 @@ switch ($action) {
"cmake.test_example_plugin" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
Expand Down
43 changes: 28 additions & 15 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 -c opt -- \
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
$(bazel query 'attr("tags", "benchmark_result", ...)')
echo ""
echo "Benchmark results in $BENCHMARK_DIR:"
Expand Down Expand Up @@ -66,8 +66,11 @@ if [[ "$1" != "bazel.nortti" ]]; then
fi
BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors"

BAZEL_OPTIONS_ASYNC="$BAZEL_OPTIONS --copt=-DENABLE_ASYNC_EXPORT"
BAZEL_TEST_OPTIONS_ASYNC="$BAZEL_OPTIONS_ASYNC --test_output=errors"

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

BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel"
Expand All @@ -85,6 +88,7 @@ if [[ "$1" == "cmake.test" ]]; then
-DWITH_METRICS_PREVIEW=ON \
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
make
make test
Expand All @@ -96,6 +100,7 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then
-DWITH_METRICS_PREVIEW=ON \
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DWITH_ABSEIL=ON \
"${SRC_DIR}"
make
Expand All @@ -106,6 +111,7 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-Werror" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=20 \
"${SRC_DIR}"
make
Expand All @@ -118,6 +124,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
-DWITH_METRICS_PREVIEW=ON \
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DWITH_STL=ON \
"${SRC_DIR}"
make
Expand Down Expand Up @@ -145,6 +152,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"
Expand All @@ -157,6 +165,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"
Expand All @@ -165,8 +174,8 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
cd exporters/otlp && make test
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 //...
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC --//api:with_abseil=true //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC --//api:with_abseil=true //...
exit 0
elif [[ "$1" == "cmake.test_example_plugin" ]]; then
# Build the plugin
Expand Down Expand Up @@ -206,6 +215,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_async_export" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC //...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC //...
exit 0
elif [[ "$1" == "bazel.benchmark" ]]; then
run_benchmarks
exit 0
Expand All @@ -216,34 +229,34 @@ elif [[ "$1" == "bazel.macos.test" ]]; then
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.
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -- //... -//exporters/otlp/... -//exporters/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/otlp/... -//exporters/prometheus/...
exit 0
elif [[ "$1" == "bazel.noexcept" ]]; then
# there are some exceptions and error handling code from the Prometheus and Jaeger Clients
# that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here.
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
exit 0
elif [[ "$1" == "bazel.nortti" ]]; then
# there are some exceptions and error handling code from the Prometheus and Jaeger Clients
# that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here.
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/...
bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/...
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/...
bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/...
exit 0
elif [[ "$1" == "bazel.asan" ]]; then
bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS_ASYNC //...
exit 0
elif [[ "$1" == "bazel.tsan" ]]; then
bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS //...
bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS_ASYNC //...
exit 0
elif [[ "$1" == "bazel.valgrind" ]]; then
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //...
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 //...
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" == "benchmark" ]]; then
[ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
$(bazel query 'attr("tags", "benchmark_result", ...)')
echo ""
echo "Benchmark results in $BENCHMARK_DIR:"
Expand Down
1 change: 0 additions & 1 deletion examples/common/metrics_foo_library/foo_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace metrics_api = opentelemetry::metrics;

namespace
{

std::map<std::string, std::string> get_random_attr()
{
static const std::vector<std::pair<std::string, std::string>> labels = {{"key1", "value1"},
Expand Down
2 changes: 1 addition & 1 deletion examples/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ alerting:
scrape_configs:
- job_name: otel
static_configs:
- targets: ['localhost:9464']
- targets: ['localhost:9464']
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ class ElasticsearchLogExporter final : public opentelemetry::sdk::logs::LogExpor
const opentelemetry::nostd::span<std::unique_ptr<opentelemetry::sdk::logs::Recordable>>
&records) noexcept override;

# ifdef ENABLE_ASYNC_EXPORT
/**
* Exports a vector of log records to the Elasticsearch instance asynchronously.
* @param records A list of log records to send to Elasticsearch.
* @param result_callback callback function accepting ExportResult as argument
*/
void Export(
const opentelemetry::nostd::span<std::unique_ptr<opentelemetry::sdk::logs::Recordable>>
&records,
std::function<bool(opentelemetry::sdk::common::ExportResult)> &&result_callback) noexcept
override;
# endif

/**
* Shutdown this exporter.
* @param timeout The maximum time to wait for the shutdown method to return
Expand Down
Loading

0 comments on commit 4603f20

Please sign in to comment.