-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude vector queries from being counted in metric for rules with zero fetched series #6544
Exclude vector queries from being counted in metric for rules with zero fetched series #6544
Conversation
dcc414d
to
6f0f8db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd imagine there are other queries that fetch 0 series. Any constant expression or any of the promql functions that don't take any args (week()
day_of_week()
time()
). Do we want to account for them too?
One way to do that is to parse the promql query and find if it has any vector selector. This an example of doing this in the query-frontend
mimir/pkg/frontend/querymiddleware/stats.go
Lines 49 to 63 in 3543b63
if expr, err := parser.ParseExpr(req.GetQuery()); err == nil { | |
for _, selectors := range parser.ExtractSelectors(expr) { | |
for _, matcher := range selectors { | |
if matcher.Type != labels.MatchRegexp && matcher.Type != labels.MatchNotRegexp { | |
continue | |
} | |
s.regexpMatcherCount.Inc() | |
if matcher.IsRegexOptimized() { | |
s.regexpMatcherOptimizedCount.Inc() | |
} | |
} | |
} | |
} |
6f0f8db
to
1200508
Compare
Thanks, good suggestion! |
The CHANGELOG has just been cut to prepare for the next Mimir release. Please rebase |
66984b0
to
a703bab
Compare
…ro fetched series
… code review and add more tests
Co-authored-by: Dimitar Dimitrov <[email protected]>
a703bab
to
213866c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
What this PR does
We have a counter metric that tracks rules with zero fetched series. This PR excludes queries that are just
vector(number)
from being counted in there, as those are not expected to fetch any series and are not an indication of late data that may affect the rules.Which issue(s) this PR fixes or relates to
Follow up to #5925
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]