Skip to content

fix: keep newline before OTLP receiver block in collector config - #86

Merged
dannykopping merged 1 commit into
mainfrom
fix/otlp-receiver-newline
Oct 6, 2026
Merged

dannykopping merged 1 commit into
mainfrom
fix/otlp-receiver-newline

Conversation

@coder

@coder coder Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

If you set grafana-agent.withOTLPReceiver: true, the collector config the chart renders is invalid River.

In _collector-config.tpl, the trailing -}} on {{- if $agent.withOTLPReceiver -}} also strips the newline that follows it. Together with the leading {{-, that glues the OTLP receiver onto the closing brace of prometheus.remote_write:

}otelcol.receiver.otlp "otlp_receiver" {

grafana-agent can't parse this:

$ AGENT_MODE=flow grafana-agent fmt config.river   # v0.40.3
config.river:486:2: expected TERMINATOR, got IDENT

The fix removes the trailing chomp, which keeps the newline.

Testing

I rendered helm template -f coder-observability/values.yaml on main and ran grafana-agent fmt (v0.40.3) on the collector config.river:

withOTLPReceiver: false (default) withOTLPReceiver: true
before ok fails (above)
after ok, output byte-identical ok

The default render doesn't change, so compiled/ doesn't either. helm lint --strict passes.

Needed for coder/dogfood#655, which turns on the OTLP receiver in dogfood. That PR also needs a chart release that includes this fix.

@coder
coder Bot requested a review from dannykopping as a code owner October 6, 2026 12:26
@dannykopping
dannykopping merged commit 4640510 into main Oct 6, 2026
1 check passed
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