Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit f357102
Author: WenTao Ou <admin@owent.net>
Date:   Wed Jun 15 22:40:39 2022 +0800

    Merge main into async changes (open-telemetry#1451)

    * install sdk config (open-telemetry#1273)

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

    * Add owent as an Approver (open-telemetry#1276)

    * add owent as reviewer

    * fix order

    * Disable benchmark action failure (open-telemetry#1284)

    * metrics exemplar round 1 (open-telemetry#1264)

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

    * fix compilation error with protobuf 3.5 (open-telemetry#1289)

    * Fix span SetAttribute crash (open-telemetry#1283)

    * Synchronous Metric collection (Delta , Cumulative) (open-telemetry#1265)

    * Rename `http_client_curl` to `opentelemetry_http_client_curl` (open-telemetry#1301)

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

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

    * Implement periodic exporting metric reader (open-telemetry#1286)

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

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

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

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

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

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

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

    * Add building test without RTTI (open-telemetry#1294)

    * Remove implicitly deleted default constructor (open-telemetry#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 (open-telemetry#1322)

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

    * ostream metrics example (open-telemetry#1312)

    * Prepare v1.3.0 release (open-telemetry#1324)

    * Update yield logic for ARM processor (open-telemetry#1325)

    * Fix for open-telemetry#1292 (open-telemetry#1326)

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

    * fix metrics compiler warnings (open-telemetry#1328)

    * Replace deprecated googletest API (open-telemetry#1327)

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

    * dependencies image as artifact (open-telemetry#1333)

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

    * metrics histogram example (open-telemetry#1330)

    * Link `opentelemetry_ext` with `opentelemetry_api` (open-telemetry#1336)

    * ostream metrics cmake (open-telemetry#1344)

    * prometheus exporter (open-telemetry#1331)

    * remove exporter registration to meter provider (open-telemetry#1350)

    * Bump github/codeql-action from 1 to 2 (open-telemetry#1351)

    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

    * Add explicit type cast in baggage UrlDecode (open-telemetry#1353)

    * Fix scalar delete against array (open-telemetry#1356)

    * conditional include for codecvt header (open-telemetry#1355)

    * Add missing include guard (open-telemetry#1357)

    * Use latest TraceLoggingDynamic.h (open-telemetry#1354)

    * prometheus example (open-telemetry#1332)

    * Fix output time in metrics OStream exporter (open-telemetry#1346)

    * Simplify SDK Configuration: Use View with default aggregation if no matching View is configured (open-telemetry#1358)

    * Fix class member initialization order (open-telemetry#1360)

    * codecov ignore (open-telemetry#1364)

    * export opentelemetry_otlp_recordable (open-telemetry#1365)

    * Disable test on prometheus-cpp which not need (open-telemetry#1363)

    * Enable metric collection for Async Instruments - Delta and Cumulative  (open-telemetry#1334)

    * fix baggage propagation for empty/invalid baggage context (open-telemetry#1367)

    * Fix empty tracestate header propagation (open-telemetry#1373)

    * Bump docker/setup-qemu-action from 1 to 2 (open-telemetry#1375)

    * Add noexcept/const qualifier at missing places for Trace API. (open-telemetry#1374)

    * fix noxcept

    * fix etw

    * Bump docker/build-push-action from 2 to 3 (open-telemetry#1377)

    * Bump docker/setup-buildx-action from 1 to 2 (open-telemetry#1376)

    * [Metrics SDK] Remove un-necessary files. (open-telemetry#1379)

    * reuse temporal metric storage for sync storage (open-telemetry#1369)

    * Prometheus exporter meters and instrument name (open-telemetry#1378)

    * Fix sharing resource in batched exported spans (open-telemetry#1386)

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

    * fix: missing link to nlohmann_json (open-telemetry#1390)

    * Getting started document using ostream exporter (open-telemetry#1394)

    Co-authored-by: Reiley Yang <reyang@microsoft.com>

    * Connect async storage with async instruments (open-telemetry#1388)

    * get span_id from context when Logger::Log received invalid span_id  (open-telemetry#1398)

    * Alpine image (open-telemetry#1382)

    * Upgrade proto to v0.17.0, update log data model (open-telemetry#1383)

    * Prepare v1.4.0 release (open-telemetry#1404)

    * Fix vcpkg package name in doc (open-telemetry#1392)

    * Document Getting Started with Prometheus and Grafana (open-telemetry#1396)

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

    * fix OTEL_INTERNAL_LOG_INFO (open-telemetry#1407)

    * fix: WaitOnSocket select error when sockfd above FD_SETSIZE (open-telemetry#1410)

    * [BUILD] fix nlohmann_json's (third party) include dir (open-telemetry#1415)

    * [Metrics API/SDK] - Pass state to async callback function. (open-telemetry#1408)

    * Copy string_view passed to ETW exporter in PropertyVariant (open-telemetry#1425)

    * Fix ETW log exporter header inclusion (open-telemetry#1426)

    * [Metrics SDK] Only record non-negative / finite / Non-NAN histogram values (open-telemetry#1427)

    * validate histogram value

    * handle Nan

    * add changelog

    * divide by 0 error on windows

    * fix markdown lint

    * Fix global log handle symbols when using dlopen (open-telemetry#1420)

    * Add attributes/dimensions to metrics ostream exporter (open-telemetry#1400)

    * Log current timestamp instead of epoch time (open-telemetry#1434)

    * install sdk-config.h (open-telemetry#1419)

    * Fix GettingStarted documentation for Jaeger HTTP exporter (open-telemetry#1347) (open-telemetry#1439)

    * fix histogram (open-telemetry#1440)

    * Upgrade nlohmann_json to 3.10.5 (open-telemetry#1438) (open-telemetry#1441)

    * Fixed broken link to OpenTelemetry.io (open-telemetry#1445) (open-telemetry#1446)

    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>
    Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
    Co-authored-by: Leo Di Donato <leodidonato@gmail.com>
    Co-authored-by: Reiley Yang <reyang@microsoft.com>
    Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
    Co-authored-by: Hamed Mansouri <hamed0381@gmail.com>
    Co-authored-by: ztao <t@taozj.org>
    Co-authored-by: Flier Lu <flier@users.noreply.github.com>
    Co-authored-by: Marc Alff <marc.alff@free.fr>
    Co-authored-by: Marc Alff <marc.alff@oracle.com>

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

    Merge main into async changes (open-telemetry#1411)

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

    Merge main into async changes (open-telemetry#1395)

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

    Cocurrency otlp http session (open-telemetry#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 (open-telemetry#1306)

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

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

    * install sdk config (open-telemetry#1273)

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

    * Add owent as an Approver (open-telemetry#1276)

    * add owent as reviewer

    * fix order

    * Disable benchmark action failure (open-telemetry#1284)

    * metrics exemplar round 1 (open-telemetry#1264)

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

    * fix compilation error with protobuf 3.5 (open-telemetry#1289)

    * Fix span SetAttribute crash (open-telemetry#1283)

    * Synchronous Metric collection (Delta , Cumulative) (open-telemetry#1265)

    * Rename `http_client_curl` to `opentelemetry_http_client_curl` (open-telemetry#1301)

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

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

    * Implement periodic exporting metric reader (open-telemetry#1286)

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

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

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

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

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

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

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

    * Add building test without RTTI (open-telemetry#1294)

    * Remove implicitly deleted default constructor (open-telemetry#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 (open-telemetry#1322)

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

    * ostream metrics example (open-telemetry#1312)

    * Prepare v1.3.0 release (open-telemetry#1324)

    * Update yield logic for ARM processor (open-telemetry#1325)

    * Fix for open-telemetry#1292 (open-telemetry#1326)

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

    * fix metrics compiler warnings (open-telemetry#1328)

    * Replace deprecated googletest API (open-telemetry#1327)

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

    * dependencies image as artifact (open-telemetry#1333)

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

    * metrics histogram example (open-telemetry#1330)

    * Link `opentelemetry_ext` with `opentelemetry_api` (open-telemetry#1336)

    * ostream metrics cmake (open-telemetry#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 (open-telemetry#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 (open-telemetry#1295)

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

    Cocurrency otlp http session (open-telemetry#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 (open-telemetry#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  (open-telemetry#1275)

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

    Cocurrency otlp http session (open-telemetry#1274)
  • Loading branch information
owent committed Jun 15, 2022
1 parent 2f0a3d6 commit 88ee601
Show file tree
Hide file tree
Showing 69 changed files with 5,498 additions and 1,235 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
6 changes: 5 additions & 1 deletion 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 @@ -32,6 +32,7 @@ switch ($action) {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-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) {
Expand All @@ -52,6 +53,7 @@ switch ($action) {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
-DWITH_OTPROTCOL=ON `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
Expand All @@ -73,6 +75,7 @@ switch ($action) {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-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) {
Expand All @@ -89,6 +92,7 @@ switch ($action) {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-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) {
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
14 changes: 7 additions & 7 deletions examples/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ global:
evaluation_interval: 5s
alerting:
alertmanagers:
- follow_redirects: true
scheme: http
timeout: 5s
api_version: v2
static_configs:
- targets: [localhost:9464]
- follow_redirects: true
scheme: http
timeout: 5s
api_version: v2
static_configs:
- targets: [localhost:9464]
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 88ee601

Please sign in to comment.