Skip to content

Commit e201b8f

Browse files
ltowarekclaude
andauthored
Keep each export batch within its queue (#147)
* Bump third_party/opentelemetry-cpp to v1.30.0 The pin moves from upstream main 7f93577b to the v1.30.0 release c7b64ec6, four commits later: a baggage parsing fix, a curl HTTP client fix, and the version bump. Nothing in the batch processors changes. Refs #145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep each export batch within its queue The span and log record processors left max_export_batch_size at the SDK default of 512, larger than their queues of 64 and 128. Since opentelemetry-cpp waits for a full batch before exporting spans, a full batch never formed: spans exported only when the schedule delay expired, and every span that overflowed the queue meanwhile was dropped with a warning. CONFIG_ESP_OPENTELEMETRY_BATCH_MAX_EXPORT_BATCH_SIZE and CONFIG_ESP_OPENTELEMETRY_LOGS_BATCH_MAX_EXPORT_BATCH_SIZE set the batch size next to each queue size, defaulting to half of it (32 and 64). Half the queue matches the SDK's half-full wake-up, so every wake-up has a full batch, and leaves room for items that arrive during an export. Closes #145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 460ba15 commit e201b8f

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎Kconfig.projbuild‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ menu "OpenTelemetry"
208208
depends on ESP_OPENTELEMETRY_TRACING_ENABLED
209209
default 64
210210

211+
config ESP_OPENTELEMETRY_BATCH_MAX_EXPORT_BATCH_SIZE
212+
int "Max spans per export batch"
213+
depends on ESP_OPENTELEMETRY_TRACING_ENABLED
214+
default 32
215+
211216
config ESP_OPENTELEMETRY_BATCH_SCHEDULE_DELAY_MS
212217
int "Batch span processor schedule delay (ms)"
213218
depends on ESP_OPENTELEMETRY_TRACING_ENABLED
@@ -240,6 +245,11 @@ menu "OpenTelemetry"
240245
Records emitted once the queue is full are dropped rather than
241246
blocking the logging call site.
242247

248+
config ESP_OPENTELEMETRY_LOGS_BATCH_MAX_EXPORT_BATCH_SIZE
249+
int "Max log records per export batch"
250+
depends on ESP_OPENTELEMETRY_LOGS_ENABLED
251+
default 64
252+
243253
config ESP_OPENTELEMETRY_LOGS_BATCH_SCHEDULE_DELAY_MS
244254
int "Batch log record processor schedule delay (ms)"
245255
depends on ESP_OPENTELEMETRY_LOGS_ENABLED

‎src/integration/esp_logs.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ void esp_opentelemetry_logs_setup(
106106
}
107107

108108
sdk_logs::BatchLogRecordProcessorOptions batch_options;
109-
batch_options.max_queue_size = CONFIG_ESP_OPENTELEMETRY_LOGS_BATCH_MAX_QUEUE_SIZE;
109+
batch_options.max_queue_size = CONFIG_ESP_OPENTELEMETRY_LOGS_BATCH_MAX_QUEUE_SIZE;
110+
batch_options.max_export_batch_size = CONFIG_ESP_OPENTELEMETRY_LOGS_BATCH_MAX_EXPORT_BATCH_SIZE;
110111
batch_options.schedule_delay_millis =
111112
std::chrono::milliseconds(CONFIG_ESP_OPENTELEMETRY_LOGS_BATCH_SCHEDULE_DELAY_MS);
112113

‎src/integration/esp_tracing.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void esp_opentelemetry_tracing_setup(
5959

6060
sdk_trace::BatchSpanProcessorOptions batch_options;
6161
batch_options.max_queue_size = CONFIG_ESP_OPENTELEMETRY_BATCH_MAX_QUEUE_SIZE;
62+
batch_options.max_export_batch_size = CONFIG_ESP_OPENTELEMETRY_BATCH_MAX_EXPORT_BATCH_SIZE;
6263
batch_options.schedule_delay_millis =
6364
std::chrono::milliseconds(CONFIG_ESP_OPENTELEMETRY_BATCH_SCHEDULE_DELAY_MS);
6465

0 commit comments

Comments
 (0)