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
Support lastEvaluation
and evaluationTime
in /api/v1/rules
endpoints and make order of groups stable.
#2196
Conversation
…oints and make order of groups stable. Signed-off-by: Wing924 <weihe924stephen@gmail.com>
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, however I have on nit
CHANGELOG.md
Outdated
@@ -65,7 +66,7 @@ | |||
* [BUGFIX] The gauge `cortex_overrides_last_reload_successful` is now only exported by components that use a `RuntimeConfigManager`. Previously, for components that do not initialize a `RuntimeConfigManager` (such as the compactor) the gauge was initialized with 0 (indicating error state) and then never updated, resulting in a false-negative permanent error state. #2092 | |||
* [BUGFIX] Fixed WAL metric names, added the `cortex_` prefix. | |||
* [BUGFIX] Restored histogram `cortex_configs_request_duration_seconds` #2138 | |||
* [BUGFIX] Fix wrong syntax for `url` in config-file-reference. #2148 | |||
* [ENHANCEMENT] Fix wrong syntax for `url` in config-file-reference. #2148 |
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.
This doesn't seem related to this PR?
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've fixed it.
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, one more nit
@@ -560,7 +566,7 @@ func (r *Ruler) getShardedRules(ctx context.Context, userID string) ([]*rules.Ru | |||
return nil, fmt.Errorf("unable to inject user ID into grpc request, %v", err) | |||
} | |||
|
|||
rgs := []*rules.RuleGroupDesc{} | |||
rgs := make([]*rules.RuleGroupDesc, 0, len(rulers.Ingesters)) |
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 don't think you need this change. The number of Rulers in the ring does not correlate to the number of rule groups being evaluated.
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.
The number of Rulers in the ring does not correlate to the number of rule groups being evaluated.
Yes, but it should be no more than len(rulers.Ingesters)
. This fix is for avoid realloc slice.
if the slice is empty (before my fix), the len and cap is 0
. After each append, the len increase 1 but cap will be 0, 2, 2, 4, 4..., which make malloc many times.
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.
Can you add a comment for the same? I'll merge it after!
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've added the comment.
What this PR does:
Support
lastEvaluation
andevaluationTime
in/api/v1/rules
endpoints and make order of groups stable.Which issue(s) this PR fixes:
Without
lastEvaluation
andevaluationTime
,/api/prom/new/rules
show NaN in prometheus UI.Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]