Skip to content

fix(observability): Promtail template uses ToLower (capital T) - #51

Merged
agjs merged 1 commit into
mainfrom
fix/promtail-toLower-template
May 29, 2026
Merged

fix(observability): Promtail template uses ToLower (capital T)#51
agjs merged 1 commit into
mainfrom
fix/promtail-toLower-template

Conversation

@agjs

@agjs agjs commented May 29, 2026

Copy link
Copy Markdown
Contributor

Hot-fix for a real regression introduced in commit 716de4e (PR #47,
the log/trace correlation work): the Pino-level template was written
as {{ .level | toLower }} (Sprig-style lowercase), but Promtail's
template stage doesn't register Sprig — it only exposes Go's
strings.ToLower as a function named ToLower (capital T).

The result was the Promtail container failed to start with:

failed to make Docker service discovery target manager:
invalid template stage config:
template: pipeline_template:1: function "toLower" not defined

…and has been crashlooping in dev / restart-looping in any other
deployment since PR #47 landed. Net effect: Loki has been receiving
zero log lines for that window — the structured-logging pipeline
silently went dark.

Fix: capitalised function name + a comment so the same mistake
doesn't happen again on future template changes.

Verification: grafana/promtail:3.2.1 -check-syntax clean, and the
container now starts (logs Starting Promtail without the
function-not-defined error) against this config.

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

Hot-fix for a real regression introduced in commit 716de4e (PR #47,
the log/trace correlation work): the Pino-level template was written
as `{{ .level | toLower }}` (Sprig-style lowercase), but Promtail's
template stage doesn't register Sprig — it only exposes Go's
strings.ToLower as a function named `ToLower` (capital T).

The result was the Promtail container failed to start with:

  failed to make Docker service discovery target manager:
  invalid template stage config:
  template: pipeline_template:1: function "toLower" not defined

…and has been crashlooping in dev / restart-looping in any other
deployment since PR #47 landed. Net effect: Loki has been receiving
zero log lines for that window — the structured-logging pipeline
silently went dark.

Fix: capitalised function name + a comment so the same mistake
doesn't happen again on future template changes.

Verification: `grafana/promtail:3.2.1 -check-syntax` clean, and the
container now starts (logs `Starting Promtail` without the
function-not-defined error) against this config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@agjs
agjs enabled auto-merge (squash) May 29, 2026 11:00
@agjs
agjs merged commit 474656b into main May 29, 2026
23 of 24 checks passed
@agjs
agjs deleted the fix/promtail-toLower-template branch May 29, 2026 11:08
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