[SDK] BatchLogRecordProcessor still drains the queue in a tight loop, inconsistent with BatchSpanProcessor fix
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- cpp
- Ambito
- observability
Direzione di ricerca
Inizia da sdk/src/logs/batch_log_record_processor.cc e confronta il suo comportamento con le modifiche a BatchSpanProcessor di #4466. Riproduci le misurazioni delle chiamate di esportazione e delle dimensioni dei batch descritte nell’issue, quindi verifica che i normali risvegli esportino un batch, mentre ForceFlush() e Shutdown() svuotino il buffer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C++
- Stelle
- 1.4k
- Fork
- 640
- Merge medio
- 1g 10h
- PR unite (30g)
- 74
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di open-telemetry/opentelemetry-cpp
-
[CI] Add Ubuntu 26.04 runners to the CI workflowForse già presa @deodattap l’ha presa 8 giorni fa. Apertatriage/accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
open-telemetry/opentelemetry-cpp#4596 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Resource::Create() throws bad_variant_access if process.executable.name isn't a stringForse già presa @ryux1 l’ha presa 29 giorni fa. Apertabug help wanted triage/accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
open-telemetry/opentelemetry-cpp#4535 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] OnResponse() can call std::terminate() when the response body fails to parse as JSON/protobufForse già presa @YuEfSaEDU l’ha presa 20 giorni fa. Apertabug help wanted triage/accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open-telemetry/opentelemetry-cpp#4534 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] ETW Properties::to_vector doubles the result and reads past a string_viewForse già presa @Tyagiquamar l’ha presa 6 giorni fa. Apertaneeds-triage Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
open-telemetry/opentelemetry-cpp#4347 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug Stale triage/accepted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
open-telemetry/opentelemetry-cpp#3109 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di open-telemetry/opentelemetry-cpp
Issue simili
-
8-membered-ring atrop stereo lost in 2026.09.1Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100
I maintainer di solito rispondono entro 2 giorni
-
thread safetyAperta1.0
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
libasr headers?Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Type: Bug :bug:
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
-
llvm-trunk
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno