[SDK] BatchLogRecordProcessor still drains the queue in a tight loop, inconsistent with BatchSpanProcessor fix
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
sdk/src/logs/batch_log_record_processor.cc から始め、#4466 の BatchSpanProcessor の変更とその動作を比較します。issue で説明されているエクスポート呼び出しとバッチサイズの測定を再現し、その後、通常のウェイクアップでは 1 つのバッチがエクスポートされ、ForceFlush() と Shutdown() ではバッファが空になることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe your environment
- Platform: macOS
- opentelemetry-cpp version: main branch
- Component:
sdk/src/logs/batch_log_record_processor.cc - BatchLogRecordProcessor configuration:
max_queue_size = 8192max_export_batch_size = 2048schedule_delay_millis = 5000
Steps to reproduce
- Configure
BatchLogRecordProcessorwith aLogRecordExporterthat counts export calls and records per call. - Produce log records at a constant rate (e.g. 5,000 logs/s) for 10 seconds.
- Observe the number of export requests and the average number of logs per request.
- Produce 50,000 log records without calling
ForceFlush().
What is the expected behavior?
With max_export_batch_size = 2048, exports should be close to 2048 records each. After #4466, BatchSpanProcessor behaves this way: on a normal wakeup it exports at most one batch, and only ForceFlush() / Shutdown() drain the entire buffer.
BatchLogRecordProcessor should follow the same semantics.
What is the actual behavior?
BatchLogRecordProcessor::Export() still drains the whole buffer in a tight loop:
void BatchLogRecordProcessor::Export()
{
do {
bool notify_force_flush =
synchronization_data_->is_force_flush_pending.exchange(false, std::memory_order_acq_rel);
if (notify_force_flush) {
num_records_to_export = buffer_.size();
} else {
num_records_to_export =
buffer_.size() >= max_export_batch_size_ ? max_export_batch_size_ : buffer_.size();
}
// ... consume & export ...
} while (true);
}
And the worker wakes up as soon as the buffer is non-empty:
synchronization_data_->cv.wait_for(lk, timeout, [this] {
...
return !buffer_.empty();
});
Measured result
| Metric | Value |
|---|---|
| Logs produced | 50,000 |
| Export calls | 2,332 |
| Average batch size | 21.4 |
| Full batches (>=2048) | 1 |
| Tiny batches (<100) | 2,331 |
The first export is 2048 records; every subsequent export in the same wakeup is ~20–25 records because the worker keeps draining the buffer instead of waiting for the next full batch.
Additional context
- #4449 reported the same problem for
BatchSpanProcessor. - #4466 fixed the trace path by changing the worker wait predicate and making
Export()drain the buffer only forForceFlush()/Shutdown(). - The logs path (
sdk/src/logs/batch_log_record_processor.cc) still uses the old implementation and should be aligned with the trace path.
- 主要言語
- C++
- スター
- 1.4k
- フォーク
- 656
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 51
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
open-telemetry/opentelemetry-cpp のほかの issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
open-telemetry/opentelemetry-cpp#4697 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
TracerContext construction might result in a terminate再び着手できるかも @akshat-lakhera が 13 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンtriage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
open-telemetry/opentelemetry-cpp#4684 · コメント 2 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[CI] Add Ubuntu 26.04 runners to the CI workflow対応中かも @deodattap が 25 日前に担当しました。 オープンtriage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-telemetry/opentelemetry-cpp#4596 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Resource::Create() throws bad_variant_access if process.executable.name isn't a string対応中かも @ryux1 が 47 日前に担当しました。 オープンbug help wanted triage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
open-telemetry/opentelemetry-cpp#4535 · コメント 1 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] OnResponse() can call std::terminate() when the response body fails to parse as JSON/protobuf対応中かも @YuEfSaEDU が 38 日前に担当しました。 オープンbug help wanted triage/accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-telemetry/opentelemetry-cpp#4534 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
open-telemetry/opentelemetry-cpp の issue をすべて見る
似ている issue
-
area:decoder area:libnvmpi bug P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gjrtimmer/jetson-nvmpi#164 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redis/memtier_benchmark#850 ·
メンテナーはふだん 1 日以内に返信
-
bug-unconfirmed
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信
-
Status: Needs confirmation Status: Needs triage
難易度 1/5 1〜3時間 初心者へのやさしさ 77/100
FreeCAD/FreeCAD#33863 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
pawelsalawa/letos#5839 ·