Skip to content

Commit 6caa218

Browse files
committed
Squashed commit of the following:
commit daf5091 Author: WenTao Ou <admin@owent.net> Date: Fri Jun 17 14:49:27 2022 +0800 Implement open-telemetry/opentelemetry-specification#2452 (open-telemetry#1456) * 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) * Fix variables inizialization (open-telemetry#1430) * Remove `AsyncBatch*Processor`, implement [opentelemetry-specification#2452](open-telemetry/opentelemetry-specification#2452) Signed-off-by: WenTao Ou <admin@owent.net> * Remove invalid changelog Signed-off-by: WenTao Ou <admin@owent.net> * Fix compiling problems without `ENABLE_ASYNC_EXPORT` Signed-off-by: WenTao Ou <admin@owent.net> * Always return `ExportResult::kSuccess` Signed-off-by: WenTao Ou <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> 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> Co-authored-by: univisionsrl <31103417+univisionsrl@users.noreply.github.com> 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)
1 parent 9f3a8ee commit 6caa218

39 files changed

Lines changed: 3884 additions & 1237 deletions

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,28 @@ jobs:
150150
- name: run tests
151151
run: ./ci/do_ci.sh bazel.test
152152

153+
bazel_test_async:
154+
name: Bazel with async export
155+
runs-on: ubuntu-latest
156+
steps:
157+
- uses: actions/checkout@v3
158+
with:
159+
submodules: 'recursive'
160+
- name: Mount Bazel Cache
161+
uses: actions/cache@v3
162+
env:
163+
cache-name: bazel_cache
164+
with:
165+
path: /home/runner/.cache/bazel
166+
key: bazel_test
167+
- name: setup
168+
run: |
169+
sudo ./ci/setup_thrift.sh dependencies_only
170+
sudo ./ci/setup_ci_environment.sh
171+
sudo ./ci/install_bazelisk.sh
172+
- name: run tests
173+
run: ./ci/do_ci.sh bazel.with_async_export
174+
153175
bazel_with_abseil:
154176
name: Bazel with external abseil
155177
runs-on: ubuntu-latest

.github/workflows/stale.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
name: 'Mark and close stale issues'
1+
name: "Mark and close stale issues"
22
on:
33
schedule:
4-
- cron: '30 1 * * *'
4+
- cron: "30 1 * * *"
55

66
jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/stale@v5
1111
with:
12-
stale-issue-message: 'This issue was marked as stale due to lack of activity.'
12+
stale-issue-message: "This issue was marked as stale due to lack of activity."
1313
days-before-issue-stale: 60
14-
exempt-issue-labels: 'do-not-stale'
14+
days-before-issue-close: 7
15+
exempt-issue-labels: "do-not-stale"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Increment the:
1515

1616
## [Unreleased]
1717

18+
* [EXPORTER] OTLP http exporter allow concurrency session ([#1209](https://github.com/open-telemetry/opentelemetry-cpp/pull/1209))
19+
* [EXT] `curl::HttpClient` use `curl_multi_handle` instead of creating a thread
20+
for every request and it's able to reuse connections now. ([#1317](https://github.com/open-telemetry/opentelemetry-cpp/pull/1317))
1821
* [METRICS] Only record non-negative / finite / Non-NAN histogram values([#1427](https://github.com/open-telemetry/opentelemetry-cpp/pull/1427))
1922

2023
## [1.4.0] 2022-05-17

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ option(WITH_EXAMPLES "Whether to build examples" ON)
186186

187187
option(WITH_METRICS_PREVIEW "Whether to build metrics preview" OFF)
188188
option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF)
189+
option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF)
189190

190191
find_package(Threads)
191192

api/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,7 @@ if(WIN32)
9292
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
9393
endif()
9494
endif()
95+
96+
if(WITH_ASYNC_EXPORT_PREVIEW)
97+
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_ASYNC_EXPORT)
98+
endif()

api/include/opentelemetry/common/spin_lock_mutex.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ class SpinLockMutex
5959
SpinLockMutex &operator=(const SpinLockMutex &) = delete;
6060
SpinLockMutex &operator=(const SpinLockMutex &) volatile = delete;
6161

62+
static inline void fast_yield() noexcept
63+
{
64+
// Issue a Pause/Yield instruction while spinning.
65+
#if defined(_MSC_VER)
66+
YieldProcessor();
67+
#elif defined(__i386__) || defined(__x86_64__)
68+
# if defined(__clang__)
69+
_mm_pause();
70+
# else
71+
__builtin_ia32_pause();
72+
# endif
73+
#elif defined(__arm__)
74+
__asm__ volatile("yield" ::: "memory");
75+
#else
76+
// TODO: Issue PAGE/YIELD on other architectures.
77+
#endif
78+
}
79+
6280
/**
6381
* Attempts to lock the mutex. Return immediately with `true` (success) or `false` (failure).
6482
*/
@@ -91,20 +109,7 @@ class SpinLockMutex
91109
{
92110
return;
93111
}
94-
// Issue a Pause/Yield instruction while spinning.
95-
#if defined(_MSC_VER)
96-
YieldProcessor();
97-
#elif defined(__i386__) || defined(__x86_64__)
98-
# if defined(__clang__)
99-
_mm_pause();
100-
# else
101-
__builtin_ia32_pause();
102-
# endif
103-
#elif defined(__arm__)
104-
__asm__ volatile("yield" ::: "memory");
105-
#else
106-
// TODO: Issue PAGE/YIELD on other architectures.
107-
#endif
112+
fast_yield();
108113
}
109114
// Yield then try again (goal ~100ns)
110115
std::this_thread::yield();

api/include/opentelemetry/common/timestamp.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,39 @@ class SteadyTimestamp
169169
private:
170170
int64_t nanos_since_epoch_;
171171
};
172+
173+
class DurationUtil
174+
{
175+
public:
176+
template <class Rep, class Period>
177+
static std::chrono::duration<Rep, Period> AdjustWaitForTimeout(
178+
std::chrono::duration<Rep, Period> timeout,
179+
std::chrono::duration<Rep, Period> indefinite_value) noexcept
180+
{
181+
// Do not call now() when this duration is max value, now() may have a expensive cost.
182+
if (timeout == std::chrono::duration<Rep, Period>::max())
183+
{
184+
return indefinite_value;
185+
}
186+
187+
// std::future<T>::wait_for, std::this_thread::sleep_for, and std::condition_variable::wait_for
188+
// may use steady_clock or system_clock.We need make sure now() + timeout do not overflow.
189+
auto max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
190+
std::chrono::steady_clock::time_point::max() - std::chrono::steady_clock::now());
191+
if (timeout >= max_timeout)
192+
{
193+
return indefinite_value;
194+
}
195+
max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
196+
std::chrono::system_clock::time_point::max() - std::chrono::system_clock::now());
197+
if (timeout >= max_timeout)
198+
{
199+
return indefinite_value;
200+
}
201+
202+
return timeout;
203+
}
204+
};
205+
172206
} // namespace common
173207
OPENTELEMETRY_END_NAMESPACE

ci/do_ci.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $action = $args[0]
55

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

8-
$BAZEL_OPTIONS = "--copt=-DENABLE_METRICS_PREVIEW --copt=-DENABLE_LOGS_PREVIEW"
8+
$BAZEL_OPTIONS = "--copt=-DENABLE_METRICS_PREVIEW --copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_ASYNC_EXPORT"
99
$BAZEL_TEST_OPTIONS = "$BAZEL_OPTIONS --test_output=errors"
1010

1111
if (!(test-path build)) {
@@ -32,6 +32,7 @@ switch ($action) {
3232
cd "$BUILD_DIR"
3333
cmake $SRC_DIR `
3434
-DVCPKG_TARGET_TRIPLET=x64-windows `
35+
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
3536
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
3637
$exit = $LASTEXITCODE
3738
if ($exit -ne 0) {
@@ -52,6 +53,7 @@ switch ($action) {
5253
cd "$BUILD_DIR"
5354
cmake $SRC_DIR `
5455
-DVCPKG_TARGET_TRIPLET=x64-windows `
56+
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
5557
-DWITH_OTPROTCOL=ON `
5658
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
5759
$exit = $LASTEXITCODE
@@ -73,6 +75,7 @@ switch ($action) {
7375
cd "$BUILD_DIR"
7476
cmake $SRC_DIR `
7577
-DVCPKG_TARGET_TRIPLET=x64-windows `
78+
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
7679
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
7780
$exit = $LASTEXITCODE
7881
if ($exit -ne 0) {
@@ -89,6 +92,7 @@ switch ($action) {
8992
cd "$BUILD_DIR"
9093
cmake $SRC_DIR `
9194
-DVCPKG_TARGET_TRIPLET=x64-windows `
95+
-DWITH_ASYNC_EXPORT_PREVIEW=ON `
9296
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
9397
$exit = $LASTEXITCODE
9498
if ($exit -ne 0) {

ci/do_ci.sh

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function run_benchmarks
2525

2626
[ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark
2727
mkdir -p $BENCHMARK_DIR
28-
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \
28+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
2929
$(bazel query 'attr("tags", "benchmark_result", ...)')
3030
echo ""
3131
echo "Benchmark results in $BENCHMARK_DIR:"
@@ -66,8 +66,11 @@ if [[ "$1" != "bazel.nortti" ]]; then
6666
fi
6767
BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors"
6868

69+
BAZEL_OPTIONS_ASYNC="$BAZEL_OPTIONS --copt=-DENABLE_ASYNC_EXPORT"
70+
BAZEL_TEST_OPTIONS_ASYNC="$BAZEL_OPTIONS_ASYNC --test_output=errors"
71+
6972
# https://github.com/bazelbuild/bazel/issues/4341
70-
BAZEL_MACOS_OPTIONS="$BAZEL_OPTIONS --features=-supports_dynamic_linker --build_tag_filters=-jaeger"
73+
BAZEL_MACOS_OPTIONS="$BAZEL_OPTIONS_ASYNC --features=-supports_dynamic_linker --build_tag_filters=-jaeger"
7174
BAZEL_MACOS_TEST_OPTIONS="$BAZEL_MACOS_OPTIONS --test_output=errors"
7275

7376
BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel"
@@ -85,6 +88,7 @@ if [[ "$1" == "cmake.test" ]]; then
8588
-DWITH_METRICS_PREVIEW=ON \
8689
-DWITH_LOGS_PREVIEW=ON \
8790
-DCMAKE_CXX_FLAGS="-Werror" \
91+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
8892
"${SRC_DIR}"
8993
make
9094
make test
@@ -96,6 +100,7 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then
96100
-DWITH_METRICS_PREVIEW=ON \
97101
-DWITH_LOGS_PREVIEW=ON \
98102
-DCMAKE_CXX_FLAGS="-Werror" \
103+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
99104
-DWITH_ABSEIL=ON \
100105
"${SRC_DIR}"
101106
make
@@ -106,6 +111,7 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then
106111
rm -rf *
107112
cmake -DCMAKE_BUILD_TYPE=Debug \
108113
-DCMAKE_CXX_FLAGS="-Werror" \
114+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
109115
-DCMAKE_CXX_STANDARD=20 \
110116
"${SRC_DIR}"
111117
make
@@ -118,6 +124,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
118124
-DWITH_METRICS_PREVIEW=ON \
119125
-DWITH_LOGS_PREVIEW=ON \
120126
-DCMAKE_CXX_FLAGS="-Werror" \
127+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
121128
-DWITH_STL=ON \
122129
"${SRC_DIR}"
123130
make
@@ -145,6 +152,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
145152
cmake -DCMAKE_BUILD_TYPE=Debug \
146153
-DCMAKE_CXX_STANDARD=11 \
147154
-DWITH_OTLP=ON \
155+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
148156
"${SRC_DIR}"
149157
grpc_cpp_plugin=`which grpc_cpp_plugin`
150158
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"
@@ -157,6 +165,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
157165
rm -rf *
158166
cmake -DCMAKE_BUILD_TYPE=Debug \
159167
-DWITH_OTLP=ON \
168+
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
160169
"${SRC_DIR}"
161170
grpc_cpp_plugin=`which grpc_cpp_plugin`
162171
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"
@@ -165,8 +174,8 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
165174
cd exporters/otlp && make test
166175
exit 0
167176
elif [[ "$1" == "bazel.with_abseil" ]]; then
168-
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS --//api:with_abseil=true //...
169-
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS --//api:with_abseil=true //...
177+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC --//api:with_abseil=true //...
178+
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC --//api:with_abseil=true //...
170179
exit 0
171180
elif [[ "$1" == "cmake.test_example_plugin" ]]; then
172181
# Build the plugin
@@ -206,6 +215,10 @@ elif [[ "$1" == "bazel.test" ]]; then
206215
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //...
207216
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //...
208217
exit 0
218+
elif [[ "$1" == "bazel.with_async_export" ]]; then
219+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC //...
220+
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC //...
221+
exit 0
209222
elif [[ "$1" == "bazel.benchmark" ]]; then
210223
run_benchmarks
211224
exit 0
@@ -216,34 +229,34 @@ elif [[ "$1" == "bazel.macos.test" ]]; then
216229
elif [[ "$1" == "bazel.legacy.test" ]]; then
217230
# we uses C++ future and async() function to test the Prometheus Exporter functionality,
218231
# that make this test always fail. ignore Prometheus exporter here.
219-
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/...
220-
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS -- //... -//exporters/otlp/... -//exporters/prometheus/...
232+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -- //... -//exporters/otlp/... -//exporters/prometheus/...
233+
bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/otlp/... -//exporters/prometheus/...
221234
exit 0
222235
elif [[ "$1" == "bazel.noexcept" ]]; then
223236
# there are some exceptions and error handling code from the Prometheus and Jaeger Clients
224237
# that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here.
225-
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
226-
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
238+
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
239+
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/...
227240
exit 0
228241
elif [[ "$1" == "bazel.nortti" ]]; then
229242
# there are some exceptions and error handling code from the Prometheus and Jaeger Clients
230243
# that make this test always fail. ignore Prometheus and Jaeger exporters in the noexcept here.
231-
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/...
232-
bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS -- //... -//exporters/prometheus/... -//exporters/jaeger/...
244+
bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/...
245+
bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/...
233246
exit 0
234247
elif [[ "$1" == "bazel.asan" ]]; then
235-
bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS //...
248+
bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS_ASYNC //...
236249
exit 0
237250
elif [[ "$1" == "bazel.tsan" ]]; then
238-
bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS //...
251+
bazel $BAZEL_STARTUP_OPTIONS test --config=tsan $BAZEL_TEST_OPTIONS_ASYNC //...
239252
exit 0
240253
elif [[ "$1" == "bazel.valgrind" ]]; then
241-
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //...
242-
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 //...
254+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC //...
255+
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 //...
243256
exit 0
244257
elif [[ "$1" == "benchmark" ]]; then
245258
[ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark
246-
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS -c opt -- \
259+
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \
247260
$(bazel query 'attr("tags", "benchmark_result", ...)')
248261
echo ""
249262
echo "Benchmark results in $BENCHMARK_DIR:"

examples/prometheus/prometheus.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ global:
44
evaluation_interval: 5s
55
alerting:
66
alertmanagers:
7-
- follow_redirects: true
8-
scheme: http
9-
timeout: 5s
10-
api_version: v2
11-
static_configs:
12-
- targets: [localhost:9464]
7+
- follow_redirects: true
8+
scheme: http
9+
timeout: 5s
10+
api_version: v2
11+
static_configs:
12+
- targets: [localhost:9464]
1313
scrape_configs:
1414
- job_name: otel
1515
static_configs:
16-
- targets: ['localhost:9464']
16+
- targets: ["localhost:9464"]

0 commit comments

Comments
 (0)