feat(otlp): add max_payload_bytes and batch payload splitting - #108
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OtlpPayloadSplitter.hppwithbuild_otlp_logs_json_payload_chunks()to split oversized OTLP JSON batches into multiple payload chunks bounded bymax_payload_bytes.OtlpHttpLogger: each chunk gets its own in-flight slot and separate HTTP POST.OtlpPayloadLogger: sync and async paths iterate over chunks, callingon_payloadper chunk.Files changed
include/logit_cpp/logit/loggers/otlp/OtlpPayloadSplitter.hpp(new)include/logit_cpp/logit/loggers/OtlpHttpLogger.hppinclude/logit_cpp/logit/loggers/OtlpPayloadLogger.hpptests/otlp_payload_splitter_test.cpp(new, 4 test cases)tests/CMakeLists.txtTest plan
otlp_payload_splitter_testpasses (4 cases: zero-limit, multi-chunk, empty batch, oversized single record)otlp_payload_logger_testpassesotlp_http_logger_callback_testpassesotlp_json_serializer_testpassesotlp_structured_attributes_testpasses🤖 Generated with Claude Code