fix(vector config): Compression field incorrectly nested under TLS in OpenTelemetryProtocol TOML serialization, causing collector crashloops with LokiStack + Otel + tuning.#3320
Conversation
When LokiStack uses Otel datamodel with tuning+compression, the field was incorrectly nested under [protocol.tls] instead of [protocol], causing Vector to reject the config. Root cause: In go-toml, struct fields serialize in declaration order. TLS field (a struct pointer creating a TOML table) was before Compression (scalar field), causing compression to nest inside TLS. Changes: - Move Compression before TLS in OpenTelemetryProtocol struct - Add test case for LokiStack + Otel + tuning - Add lokistack_otel_tuning.toml test fixture
📝 WalkthroughWalkthroughAdds a complete Vector TOML configuration ( ChangesLokiStack OpenTelemetry data model and tuning
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/generator/vector/output/lokistack/lokistack_otel_tuning.toml`:
- Around line 540-542: The OVN token guards in the lokistack OTEL tuning
template are off by one and can still index past the available elements. Update
the length checks around the `ovnTokens` reads so the `log.sequence` assignment
in the `ovnTokens[1]` branch only runs when there is at least a second token,
and the `k8s.ovn.component` assignment in the `ovnTokens[2]` branch only runs
when there is at least a third token. Keep the fix localized to the `ovnTokens`
parsing block in `lokistack_otel_tuning.toml`.
- Around line 36-54: The regex fallback in lokistack_otel_tuning.toml does not
match quoted JSON keys, so common trace fields like "traceId" or "trace.flags"
are missed when the separator is not immediately adjacent. Update the
parse_regex patterns in the trace_context.trace_id, trace_context.span_id, and
trace_context.trace_flags blocks to allow optional quotes around the key names
while preserving the existing aliases and value capture groups. Keep the fix
localized to the regex fallback logic so the existing JSON branch and
assignments to trace_context remain unchanged.
In `@internal/generator/vector/output/lokistack/lokistack_test.go`:
- Around line 164-165: The retry duration values in the Lokistack test are using
raw time.Duration literals, which makes them nanoseconds instead of seconds.
Update the MaxRetryDuration and MinRetryDuration setup in lokistack_test.go to
use second-based durations so the test exercises the intended retry bounds, and
keep the change localized to the retry config in the test case.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: d795473c-f9ff-4cde-a8ab-910cd91cd743
📒 Files selected for processing (3)
internal/generator/vector/api/sinks/opentelemetry_sink.gointernal/generator/vector/output/lokistack/lokistack_otel_tuning.tomlinternal/generator/vector/output/lokistack/lokistack_test.go
|
/test e2e-using-bundle |
1 similar comment
|
/test e2e-using-bundle |
… which was the missing coverage
|
/retest |
|
/test ci-index-cluster-logging-operator-bundle |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jcantrill, vparfonov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@vparfonov: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Root Cause
In
go-toml, struct fields serialize in declaration order. TheTLSfield (struct pointer creating a TOML table) was declared beforeCompression(scalar), causing compression to nest inside the TLS section.Solution
Reorder
OpenTelemetryProtocolfields: moveCompressionbeforeTLS.Changes:
opentelemetry_sink.golokistack_otel_tuning.toml/cc
/assign @jcantrill
Links
Summary by CodeRabbit
New Features
Tests