mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-14 17:44:06 -08:00
Rename "execution time" to "evaluation time". (#401)
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
This commit is contained in:
parent
806e71e828
commit
44904a663c
|
@ -135,13 +135,13 @@ func (g *RuleGroups) Validate(node ruleGroups) (errs []error) {
|
||||||
|
|
||||||
// RuleGroup is a list of sequentially evaluated recording and alerting rules.
|
// RuleGroup is a list of sequentially evaluated recording and alerting rules.
|
||||||
type RuleGroup struct {
|
type RuleGroup struct {
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
Interval model.Duration `yaml:"interval,omitempty"`
|
Interval model.Duration `yaml:"interval,omitempty"`
|
||||||
EvaluationDelay *model.Duration `yaml:"evaluation_delay,omitempty"`
|
EvaluationDelay *model.Duration `yaml:"evaluation_delay,omitempty"`
|
||||||
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.
|
||||||
|
|
|
@ -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]))
|
||||||
|
|
|
@ -270,8 +270,8 @@ 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.
|
||||||
|
@ -279,17 +279,17 @@ type Group struct {
|
||||||
type RuleGroupPostProcessFunc func(g *Group, lastEvalTimestamp time.Time, log log.Logger) error
|
type RuleGroupPostProcessFunc func(g *Group, lastEvalTimestamp time.Time, log log.Logger) error
|
||||||
|
|
||||||
type GroupOptions struct {
|
type GroupOptions struct {
|
||||||
Name, File string
|
Name, File string
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
Limit int
|
Limit int
|
||||||
Rules []Rule
|
Rules []Rule
|
||||||
SourceTenants []string
|
SourceTenants []string
|
||||||
ShouldRestore bool
|
ShouldRestore bool
|
||||||
Opts *ManagerOptions
|
Opts *ManagerOptions
|
||||||
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.
|
||||||
|
@ -311,23 +311,23 @@ func NewGroup(o GroupOptions) *Group {
|
||||||
metrics.GroupInterval.WithLabelValues(key).Set(o.Interval.Seconds())
|
metrics.GroupInterval.WithLabelValues(key).Set(o.Interval.Seconds())
|
||||||
|
|
||||||
return &Group{
|
return &Group{
|
||||||
name: o.Name,
|
name: o.Name,
|
||||||
file: o.File,
|
file: o.File,
|
||||||
interval: o.Interval,
|
interval: o.Interval,
|
||||||
evaluationDelay: o.EvaluationDelay,
|
evaluationDelay: o.EvaluationDelay,
|
||||||
limit: o.Limit,
|
limit: o.Limit,
|
||||||
rules: o.Rules,
|
rules: o.Rules,
|
||||||
shouldRestore: o.ShouldRestore,
|
shouldRestore: o.ShouldRestore,
|
||||||
opts: o.Opts,
|
opts: o.Opts,
|
||||||
sourceTenants: o.SourceTenants,
|
sourceTenants: o.SourceTenants,
|
||||||
seriesInPreviousEval: make([]map[string]labels.Labels, len(o.Rules)),
|
seriesInPreviousEval: make([]map[string]labels.Labels, len(o.Rules)),
|
||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
managerDone: o.done,
|
managerDone: o.done,
|
||||||
terminated: make(chan struct{}),
|
terminated: make(chan struct{}),
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,18 +1205,18 @@ func (m *Manager) LoadGroups(
|
||||||
}
|
}
|
||||||
|
|
||||||
groups[GroupKey(fn, rg.Name)] = NewGroup(GroupOptions{
|
groups[GroupKey(fn, rg.Name)] = NewGroup(GroupOptions{
|
||||||
Name: rg.Name,
|
Name: rg.Name,
|
||||||
File: fn,
|
File: fn,
|
||||||
Interval: itv,
|
Interval: itv,
|
||||||
Limit: rg.Limit,
|
Limit: rg.Limit,
|
||||||
Rules: rules,
|
Rules: rules,
|
||||||
SourceTenants: rg.SourceTenants,
|
SourceTenants: rg.SourceTenants,
|
||||||
ShouldRestore: shouldRestore,
|
ShouldRestore: shouldRestore,
|
||||||
Opts: m.opts,
|
Opts: m.opts,
|
||||||
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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,12 +1040,12 @@ type ruleGroupsTest struct {
|
||||||
|
|
||||||
// ruleGroupTest forms a testing struct for running tests over rules.
|
// ruleGroupTest forms a testing struct for running tests over rules.
|
||||||
type ruleGroupTest struct {
|
type ruleGroupTest struct {
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
Interval model.Duration `yaml:"interval,omitempty"`
|
Interval model.Duration `yaml:"interval,omitempty"`
|
||||||
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 {
|
||||||
|
@ -1064,12 +1064,12 @@ func formatRules(r *rulefmt.RuleGroups) ruleGroupsTest {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
tmp = append(tmp, ruleGroupTest{
|
tmp = append(tmp, ruleGroupTest{
|
||||||
Name: g.Name,
|
Name: g.Name,
|
||||||
Interval: g.Interval,
|
Interval: g.Interval,
|
||||||
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{
|
||||||
|
|
Loading…
Reference in a new issue