Rename "execution time" to "evaluation time". (#401)

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
This commit is contained in:
Peter Štibraný 2023-01-19 16:11:44 +01:00 committed by GitHub
parent 806e71e828
commit 44904a663c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 66 deletions

View file

@ -141,7 +141,7 @@ type RuleGroup struct {
Limit int `yaml:"limit,omitempty"` Limit int `yaml:"limit,omitempty"`
Rules []RuleNode `yaml:"rules"` Rules []RuleNode `yaml:"rules"`
SourceTenants []string `yaml:"source_tenants,omitempty"` SourceTenants []string `yaml:"source_tenants,omitempty"`
AlignExecutionTimeOnInterval bool `yaml:"align_execution_time_on_interval,omitempty"` AlignEvaluationTimeOnInterval bool `yaml:"align_evaluation_time_on_interval,omitempty"`
} }
// Rule describes an alerting or recording rule. // Rule describes an alerting or recording rule.

View file

@ -1,13 +1,13 @@
groups: groups:
- name: aligned - name: aligned
align_execution_time_on_interval: true align_evaluation_time_on_interval: true
interval: 5m interval: 5m
rules: rules:
- record: job:http_requests:rate5m - record: job:http_requests:rate5m
expr: sum by (job)(rate(http_requests_total[5m])) expr: sum by (job)(rate(http_requests_total[5m]))
- name: aligned_with_crazy_interval - name: aligned_with_crazy_interval
align_execution_time_on_interval: true align_evaluation_time_on_interval: true
interval: 1m27s interval: 1m27s
rules: rules:
- record: job:http_requests:rate5m - record: job:http_requests:rate5m
@ -21,7 +21,7 @@ groups:
- name: unaligned_explicit - name: unaligned_explicit
interval: 5m interval: 5m
align_execution_time_on_interval: false align_evaluation_time_on_interval: false
rules: rules:
- record: job:http_requests:rate5m - record: job:http_requests:rate5m
expr: sum by (job)(rate(http_requests_total[5m])) expr: sum by (job)(rate(http_requests_total[5m]))

View file

@ -271,7 +271,7 @@ type Group struct {
metrics *Metrics metrics *Metrics
ruleGroupPostProcessFunc RuleGroupPostProcessFunc ruleGroupPostProcessFunc RuleGroupPostProcessFunc
alignExecutionTimeOnInterval bool alignEvaluationTimeOnInterval bool
} }
// This function will be used before each rule group evaluation if not nil. // This function will be used before each rule group evaluation if not nil.
@ -289,7 +289,7 @@ type GroupOptions struct {
EvaluationDelay *time.Duration EvaluationDelay *time.Duration
done chan struct{} done chan struct{}
RuleGroupPostProcessFunc RuleGroupPostProcessFunc RuleGroupPostProcessFunc RuleGroupPostProcessFunc
AlignExecutionTimeOnInterval bool AlignEvaluationTimeOnInterval bool
} }
// NewGroup makes a new Group with the given name, options, and rules. // NewGroup makes a new Group with the given name, options, and rules.
@ -327,7 +327,7 @@ func NewGroup(o GroupOptions) *Group {
logger: log.With(o.Opts.Logger, "file", o.File, "group", o.Name), logger: log.With(o.Opts.Logger, "file", o.File, "group", o.Name),
metrics: metrics, metrics: metrics,
ruleGroupPostProcessFunc: o.RuleGroupPostProcessFunc, ruleGroupPostProcessFunc: o.RuleGroupPostProcessFunc,
alignExecutionTimeOnInterval: o.AlignExecutionTimeOnInterval, alignEvaluationTimeOnInterval: o.AlignEvaluationTimeOnInterval,
} }
} }
@ -551,7 +551,7 @@ func (g *Group) setLastEvaluation(ts time.Time) {
// EvalTimestamp returns the immediately preceding consistently slotted evaluation time. // EvalTimestamp returns the immediately preceding consistently slotted evaluation time.
func (g *Group) EvalTimestamp(startTime int64) time.Time { func (g *Group) EvalTimestamp(startTime int64) time.Time {
var offset int64 var offset int64
if !g.alignExecutionTimeOnInterval { if !g.alignEvaluationTimeOnInterval {
offset = int64(g.hash() % uint64(g.interval)) offset = int64(g.hash() % uint64(g.interval))
} }
@ -933,7 +933,7 @@ func (g *Group) Equals(ng *Group) bool {
return false return false
} }
if g.alignExecutionTimeOnInterval != ng.alignExecutionTimeOnInterval { if g.alignEvaluationTimeOnInterval != ng.alignEvaluationTimeOnInterval {
return false return false
} }
@ -1216,7 +1216,7 @@ func (m *Manager) LoadGroups(
EvaluationDelay: (*time.Duration)(rg.EvaluationDelay), EvaluationDelay: (*time.Duration)(rg.EvaluationDelay),
done: m.done, done: m.done,
RuleGroupPostProcessFunc: ruleGroupPostProcessFunc, RuleGroupPostProcessFunc: ruleGroupPostProcessFunc,
AlignExecutionTimeOnInterval: rg.AlignExecutionTimeOnInterval, AlignEvaluationTimeOnInterval: rg.AlignEvaluationTimeOnInterval,
}) })
} }
} }

View file

@ -1045,7 +1045,7 @@ type ruleGroupTest struct {
Limit int `yaml:"limit,omitempty"` Limit int `yaml:"limit,omitempty"`
Rules []rulefmt.Rule `yaml:"rules"` Rules []rulefmt.Rule `yaml:"rules"`
SourceTenants []string `yaml:"source_tenants,omitempty"` SourceTenants []string `yaml:"source_tenants,omitempty"`
AlignExecutionTimeOnInterval bool `yaml:"align_execution_time_on_interval,omitempty"` AlignEvaluationTimeOnInterval bool `yaml:"align_evaluation_time_on_interval,omitempty"`
} }
func formatRules(r *rulefmt.RuleGroups) ruleGroupsTest { func formatRules(r *rulefmt.RuleGroups) ruleGroupsTest {
@ -1069,7 +1069,7 @@ func formatRules(r *rulefmt.RuleGroups) ruleGroupsTest {
Limit: g.Limit, Limit: g.Limit,
Rules: rtmp, Rules: rtmp,
SourceTenants: g.SourceTenants, SourceTenants: g.SourceTenants,
AlignExecutionTimeOnInterval: g.AlignExecutionTimeOnInterval, AlignEvaluationTimeOnInterval: g.AlignEvaluationTimeOnInterval,
}) })
} }
return ruleGroupsTest{ return ruleGroupsTest{