Skip to content

4/6 Add OtlpIngest runner with backpressure-aware retries#2137

Open
gareth-ellis wants to merge 4 commits into
masterfrom
otlp-pr4-runner
Open

4/6 Add OtlpIngest runner with backpressure-aware retries#2137
gareth-ellis wants to merge 4 commits into
masterfrom
otlp-pr4-runner

Conversation

@gareth-ellis

@gareth-ellis gareth-ellis commented May 29, 2026

Copy link
Copy Markdown
Member

Summary

Adds the OtlpIngest runner in esrally/driver/runner.py — POSTs the serialized protobuf bytes to the OTLP metrics endpoint.

Key design choices:

  • Transport-level retries disabled (es.options(max_retries=0)). The default elasticsearch-py retry loop fires 4 attempts back-to-back with no sleep, which hammers an already-overloaded ES under 429/503.
  • Explicit retry loop with exponential backoff + full jitter. Retries 429/502/503/504 and connection errors; configurable via retries-on-error (default 5) and retry-wait-period (default 0.5s, capped at 30s).
  • Non-retryable ApiErrors return a failure dict instead of propagating, so the driver records the error without crashing the worker.
  • Custom application/x-protobuf serializer + AsyncElasticsearch.perform_request bypass to avoid Rally's REST-compat Accept headers that OTLP endpoints reject.

Depends on #2135 — merge after #2135. Part 4 of 6.

Series

Test plan

  • 14 unit tests: 429 → retry → success, exhausted retries → failure dict, 400 → no retry, transport max_retries=0 is set, custom retry-wait-period honored, exponential backoff schedule verified
  • pre-commit clean

🤖 Generated with Claude Code

gareth-ellis and others added 4 commits May 29, 2026 14:41
The ApiError handler in execute_single() decodes `e.body`, `e.error`, and
`e.info` as UTF-8 to build a human-readable error message. When the body is
binary (e.g., binary protobuf returned by ES OTLP endpoints on 4xx/5xx), the
strict decode raises UnicodeDecodeError, which crashes the worker mid-task.

Switch the six decode() calls to use errors="replace" so undecodable bytes
become U+FFFD instead of aborting the worker. No semantic change for valid
UTF-8 (the common case).

This is a latent bug independent of OTLP — any operation that surfaces a
binary error body would have hit it.
Introduces OtlpProtobufFile in esrally/utils/io.py for reading/writing
length-prefixed OTLP ExportMetricsServiceRequest protobufs, plus an
offset sidecar to allow worker partitions to seek without scanning.

Wires preparation into esrally/track/loader.py and esrally/track/track.py:
- New OTLP document set fields (otlp_pb_size_in_bytes, etc.)
- prepare_otlp_document_set tries to download a .pb from the corpus base
  URL, otherwise converts a local JSON corpus to .pb on disk.
- set_absolute_data_path picks up the .pb when present.

Adds OTLP protobuf bindings to pyproject.toml (opentelemetry-proto).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
OtlpParamSource streams length-prefixed protobuf records out of an
OtlpProtobufFile, partitions them across workers using the offset
sidecar, and surfaces percent_completed so the progress bar tracks
real progress. Supports a "looped" mode that cycles the partition
indefinitely for time-bound benchmarks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
OtlpIngest POSTs serialized protobuf bytes to the OTLP metrics
endpoint, disabling transport-level fast retries in favour of an
explicit exponential-with-full-jitter backoff loop. 429/502/503/504
and connection errors are retried; non-retryable ApiErrors return a
failure dict so the driver records the error without crashing the
worker.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gareth-ellis gareth-ellis requested a review from a team as a code owner May 29, 2026 14:10
@gareth-ellis gareth-ellis changed the base branch from otlp-pr3-param-source to master May 29, 2026 14:32
@gareth-ellis gareth-ellis changed the title Add OtlpIngest runner with backpressure-aware retries 4/6 Add OtlpIngest runner with backpressure-aware retries May 29, 2026

@ebadyano ebadyano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants