Skip to content

rule: log PromQL info annotations at debug instead of warn#8873

Open
Goutham-Annem wants to merge 4 commits into
thanos-io:mainfrom
Goutham-Annem:rule-log-promql-info-at-debug
Open

rule: log PromQL info annotations at debug instead of warn#8873
Goutham-Annem wants to merge 4 commits into
thanos-io:mainfrom
Goutham-Annem:rule-log-promql-info-at-debug

Conversation

@Goutham-Annem

Copy link
Copy Markdown
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • filterOutPromQLWarnings in cmd/thanos/rule.go logged every PromQL annotation at level.Warn, including purely informational ones like "metric might not be a counter" (annotations.PromQLInfo). Since this runs on every rule evaluation cycle for any rule whose query triggers the heuristic, it produces continuous log spam (see Rule: log warning spam from PromQL info "metric might not be a counter" #8229) rather than something an operator needs to act on.
  • Added IsPromQLInfoAnnotation to pkg/extannotations/annotations.go, mirroring the existing IsPromQLAnnotation but checking only the annotations.PromQLInfo prefix.
  • filterOutPromQLWarnings now logs info-type annotations at level.Debug and keeps true warning-type annotations (annotations.PromQLWarning) at level.Warn. Filtering behavior (which warnings get removed from the response) is unchanged — only the log level for info-type annotations changes.

Verification

  • Added TestIsPromQLInfoAnnotation (pkg/extannotations/annotations_test.go) covering info vs. warning vs. unrelated strings.
  • Added TestFilterOutPromQLWarnings_LogLevel (cmd/thanos/rule_test.go), which captures logger output via log.NewLogfmtLogger and asserts info annotations produce level=debug while warning annotations produce level=warn.
  • Existing TestFilterOutPromQLWarnings (filtering behavior) still passes unchanged.
  • make go-lint passes with 0 issues.

Closes #8229

filterOutPromQLWarnings logged every PromQL annotation at warn level,
including purely informational ones (e.g. "metric might not be a
counter"), causing log spam on every rule evaluation cycle for rules
that trigger this heuristic. Add IsPromQLInfoAnnotation to distinguish
info from warning annotations, and log info annotations at debug.

Fixes thanos-io#8229

Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
@Goutham-Annem Goutham-Annem force-pushed the rule-log-promql-info-at-debug branch 2 times, most recently from ad8003b to 0bb7fda Compare July 4, 2026 16:10
Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
@Goutham-Annem Goutham-Annem force-pushed the rule-log-promql-info-at-debug branch from 0bb7fda to 46a09b8 Compare July 5, 2026 14:45
Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
…ssue thanos-io#8229

Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule: log warning spam from PromQL info "metric might not be a counter"

1 participant