Skip to content

[OTEL logs] OTel appender: custom retry budget + maxQueueSize - #290772

Open
jesuswr wants to merge 6 commits into
elastic:mainfrom
jesuswr:new-otel-retry-logic
Open

[OTEL logs] OTel appender: custom retry budget + maxQueueSize#290772
jesuswr wants to merge 6 commits into
elastic:mainfrom
jesuswr:new-otel-retry-logic

Conversation

@jesuswr

@jesuswr jesuswr commented Sep 14, 2026

Copy link
Copy Markdown
Member

Summary

Closes #284558

When the OTel collector is down, the OTel appender gives up too fast and drops logs:

  • The SDK's built-in retry stops after ~13 seconds.
  • The in-memory buffer only holds 2048 log records.

This PR makes both configurable so short collector outages don't lose logs:

  • maxElapsedTime (serverless default: 2m): how long a failed export keeps retrying with exponential backoff before the batch is dropped. Implemented in a new RetryingLogRecordExporter that wraps the OTLP exporter. Only transient errors are retried (network errors, HTTP 429/502/503/504, gRPC DEADLINE_EXCEEDED/UNAVAILABLE). Things like auth failures or bad requests fail immediately, as before.
  • maxQueueSize (serverless default: 15000): how many log records the batch processor buffers in memory. When full, new records are dropped and the SDK logs a warning with the count. Minimum is 512 so it never goes below the SDK's batch size.

Both settings are only exposed in serverless YAML config. Internal plugins can also set them through the runtime config.

About the defaults

Both defaults come from the example in the issue. To sanity-check 15000, we measured real Kibana log events: typical records are ~1–2KB, error records with stack traces are ~2–4KB, and the largest ones observed are ~10KB. So a full queue is ~30MB in the typical case, and can be higher during error storms (which is when the queue actually fills). If we'd rather bound the worst case, we can lower the default — it's a one-line change.

Testing

  • Unit tests: config validation, retry/backoff behavior, error classification, shutdown/flush (node scripts/jest src/core/packages/logging/server-internal/src/appenders/otel)
  • New integration test running the real OTel SDK pipeline against an in-process gRPC collector: retries bridge a short outage, batches are dropped when the budget is exhausted, no retries on auth errors, and queue overflow drops records (node scripts/jest_integration src/core/server/integration_tests/logging/otel)
  • Type check (node scripts/type_check on the touched projects) and lint pass
  • Manually tested end to end with a mock collector: killed the collector, logs buffered and retried, brought it back within the budget and all logs arrived; past the budget they were dropped as expected

@jesuswr jesuswr self-assigned this Sep 14, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

@jesuswr jesuswr added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting OpenTelemetry labels Sep 14, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@jesuswr
jesuswr marked this pull request as ready for review September 14, 2026 15:28
@jesuswr
jesuswr requested a review from a team as a code owner September 14, 2026 15:28
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/kibana-core (Team:Core)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting OpenTelemetry release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OTEL logs] OTel appender: custom retry budget + maxQueueSize

1 participant