Skip to content

feat(otlp): add max_payload_bytes and batch payload splitting - #108

Merged
LimiNode merged 5 commits into
mainfrom
feat/otlp-payload-splitter
May 22, 2026
Merged

feat(otlp): add max_payload_bytes and batch payload splitting#108
LimiNode merged 5 commits into
mainfrom
feat/otlp-payload-splitter

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

  • Add OtlpPayloadSplitter.hpp with build_otlp_logs_json_payload_chunks() to split oversized OTLP JSON batches into multiple payload chunks bounded by max_payload_bytes.
  • Default limit: 1 MiB. Set to 0 to disable splitting.
  • Oversized single records are emitted as their own chunk, never dropped.
  • OtlpHttpLogger: each chunk gets its own in-flight slot and separate HTTP POST.
  • OtlpPayloadLogger: sync and async paths iterate over chunks, calling on_payload per chunk.

Files changed

  • include/logit_cpp/logit/loggers/otlp/OtlpPayloadSplitter.hpp (new)
  • include/logit_cpp/logit/loggers/OtlpHttpLogger.hpp
  • include/logit_cpp/logit/loggers/OtlpPayloadLogger.hpp
  • tests/otlp_payload_splitter_test.cpp (new, 4 test cases)
  • tests/CMakeLists.txt

Test plan

  • otlp_payload_splitter_test passes (4 cases: zero-limit, multi-chunk, empty batch, oversized single record)
  • otlp_payload_logger_test passes
  • otlp_http_logger_callback_test passes
  • otlp_json_serializer_test passes
  • otlp_structured_attributes_test passes

🤖 Generated with Claude Code

LimiNode and others added 5 commits May 22, 2026 03:02
Add Codebase Memory preflight protocol to explore, architect, debugger,
and tracer agents. Update delegation routing and tool-priority policy
to require index_status/search_graph before Grep/Glob for non-trivial
codebase discovery. This prevents subagents from bypassing the graph
when the orchestrator delegates discovery tasks.

Constraint: subagent prompts start fresh; system-reminder rules do not
propagate. Agent prompt must contain explicit preflight instructions.

Rejected: duplicating full protocol into all agent files — kept canonical
definition in tool-priority.md, concise references in debugger/tracer.

Directive: orchestrator must either preflight discovery itself or
include explicit Codebase Memory instructions in delegation prompt.

Confidence: high
Scope-risk: narrow
Not-tested: agent prompt loading validation requires manual review

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add Mandatory Codebase Discovery Preflight to CLAUDE.md with explicit
ToolSearch step, MUST keyword, and prohibition on git-status-as-discovery.
Add observable action barrier to tool-priority.md: reasoning is not
enough, the next discovery tool call must actually be Codebase Memory.

Directive: orchestrator must not start first-pass discovery with
Bash/Glob/Grep/Read; subagent prompts must contain explicit preflight.

Confidence: high
Scope-risk: narrow

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add OtlpPayloadSplitter.hpp with build_otlp_logs_json_payload_chunks() to
split oversized OTLP JSON batches into multiple payload chunks bounded by
max_payload_bytes. Default limit is 1 MiB; set to 0 to disable splitting.

Single records exceeding the limit are emitted as an oversized chunk
rather than dropped, preserving data integrity.

Changes:
- OtlpHttpLogger::Config and OtlpPayloadLogger::Config: +max_payload_bytes
- OtlpHttpLogger: submit_batch_async splits batch into chunks, each chunk
  gets its own in-flight slot and HTTP POST
- OtlpPayloadLogger: sync and async paths both iterate over chunks
- Added otlp_payload_splitter_test.cpp with 4 test cases

All OTLP tests pass; no regressions in existing serializers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
OtlpHttpLogger: enforce max_in_flight_requests per chunk instead of
per batch to prevent backpressure bypass.

OtlpPayloadLogger: wrap each on_payload(chunk) call in its own
try/catch so one failing callback does not abort remaining chunks.

Rewrite otlp_payload_logger_test.cpp without global LOGIT macros to
avoid singleton shutdown side effects. Add async and sync integration
tests for payload splitting with small max_payload_bytes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Rename sync test comment to accurately reflect behavior:
  sync mode cannot split a multi-record batch because each log()
  forms its own single-item batch.

- Add Test h to otlp_http_logger_callback_test.cpp:
  direct OtlpHttpLogger instantiation, max_payload_bytes=1024,
  50 messages with max_batch_size=256. Asserts POST count > 1
  and all 50 records are received across multiple chunks.

- Add RequestCounter::bodies vector to collect all request bodies
  for cross-chunk validation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@LimiNode
LimiNode merged commit edf2500 into main May 22, 2026
12 checks passed
@LimiNode
LimiNode deleted the feat/otlp-payload-splitter branch June 3, 2026 00:04
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.

1 participant