Skip to content

fix(querier): force layered aggregation for boolean COUNTER metrics#11799

Merged
zhens0704 merged 1 commit into
v6.6from
fix_boolean_counter
Jun 17, 2026
Merged

fix(querier): force layered aggregation for boolean COUNTER metrics#11799
zhens0704 merged 1 commit into
v6.6from
fix_boolean_counter

Conversation

@JinzhouChen-xmu

Copy link
Copy Markdown
Contributor

For COUNTER metrics with boolean DBField (containing if(..., 1, 0)), aggregation functions other than SUM/AVG produce meaningless row-level results in UNLAY mode (e.g. MAX is always 1, AVG is 0/1 ratio).

Force them to LAYERED mode: inner SUM aggregates by datasource_interval, outer applies the actual aggregation function on per-window counts. This gives meaningful semantics such as MAX(SUM(...)) for peak window rate.

This PR is for:

Server

For COUNTER metrics with boolean DBField (containing if(..., 1, 0)),
aggregation functions other than SUM/AVG produce meaningless row-level
results in UNLAY mode (e.g. MAX is always 1, AVG is 0/1 ratio).

Force them to LAYERED mode: inner SUM aggregates by datasource_interval,
outer applies the actual aggregation function on per-window counts.
This gives meaningful semantics such as MAX(SUM(...)) for peak window rate.

Co-Authored-By: Claude <noreply@anthropic.com>
@zhens0704 zhens0704 merged commit 858f151 into v6.6 Jun 17, 2026
7 checks passed
@zhens0704 zhens0704 deleted the fix_boolean_counter branch June 17, 2026 10:07
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.

3 participants