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

@Goutham-Annem
Goutham-Annem force-pushed the rule-log-promql-info-at-debug branch 3 times, most recently from 0bb7fda to 46a09b8 Compare July 5, 2026 14:45
Goutham-Annem added a commit to Goutham-Annem/thanos that referenced this pull request Jul 5, 2026
…ssue 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 from ca55bf2 to a9d9658 Compare July 10, 2026 10:41
Goutham-Annem added a commit to Goutham-Annem/thanos that referenced this pull request Jul 10, 2026
…ssue thanos-io#8229

Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
@Goutham-Annem

Copy link
Copy Markdown
Author

The failing 'Documentation' CI check is a pre-existing repo-wide issue — the dead URL at docs/getting-started.md:161 (blog.openshift.com returning 403) was present before this PR. This PR's changes are limited to the rule component logging. Happy to address any other feedback.

Goutham-Annem added a commit to Goutham-Annem/thanos that referenced this pull request Jul 18, 2026
…ssue 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 from a9d9658 to 784ebc6 Compare July 18, 2026 17:37
@Goutham-Annem

Copy link
Copy Markdown
Author

The failing CI check (Thanos end-to-end tests (8, 2)) is TestQueryExternalPrefixAndRoutePrefix in test/e2e — this is in the query/querier path and is completely unrelated to the pkg/rule changes in this PR. This looks like a pre-existing flake. Could a maintainer trigger a re-run?

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>
Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
…ssue 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 from 784ebc6 to 2a583e0 Compare July 23, 2026 02:56
@Goutham-Annem

Copy link
Copy Markdown
Author

The failing check (Thanos end-to-end tests) appears to be a pre-existing flake unrelated to changes in pkg/rule. Could a maintainer re-run the CI when convenient? Thank you!

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