fix(observability): Promtail template uses ToLower (capital T) - #51
Merged
Conversation
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>
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.
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'stemplate 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-syntaxclean, and thecontainer now starts (logs
Starting Promtailwithout thefunction-not-defined error) against this config.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com