fix: correct competitive bench line counting for OTLP and NDJSON#613
Conversation
|
Caution Review failedPull request was closed or merged during review WalkthroughThe blackhole benchmark's request counting for Possibly related PRs
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/logfwd-competitive-bench/src/blackhole.rs`:
- Around line 109-116: The OTLP counting currently calls count_otlp_log_records
and count_otlp_body_keys unconditionally; change to lazy-evaluate the fallback
so you only run the heavier substring/scan when the JSON parse returned no
records: first call count_otlp_log_records(body) and if it returns a positive
count return it immediately; only if it returns 0 then call
count_otlp_body_keys(body) and return that if >0; otherwise fall back to
ndjson_line_count(body, newlines). Update the logic around the otlp_count/return
path (the block guarded by url.contains("/v1/logs")) to reflect this
short-circuit behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f33bedf7-c108-4817-84e2-5c993dbb012a
📒 Files selected for processing (1)
crates/logfwd-competitive-bench/src/blackhole.rs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
/v1/logsrecords by parsingresourceLogs[].scopeLogs[].logRecords[]"body":scan when OTLP JSON parsing is unavailableWhy
Benchmark throughput can be under-reported when payloads do not end with
\n(notably affecting jsonline senders like vlagent), and OTLP payload counting should use log-record semantics rather than newline heuristics.Validation
cargo test -p logfwd-competitive-benchcargo check -p logfwd-competitive-benchjust ciin this environment is blocked by pre-existingcargo denyduplicate warnings unrelated to this patchNotes
I attempted focused docker benchmark runs for
otelcolandvlagent, but benchmark execution is blocked/hangs in this environment. The code path and regression tests are in place for deterministic counting behavior.