rules/manager.go
func NewGroup(name, file string, interval time.Duration, rules []Rule, shouldRestore bool, opts *ManagerOptions) *Group {
	metrics := opts.Metrics
	if metrics == nil {
		metrics = NewGroupMetrics(opts.Registerer)
	}

	metrics.groupLastEvalTime.WithLabelValues(groupKey(file, name))
	metrics.groupLastDuration.WithLabelValues(groupKey(file, name))
	metrics.groupRules.WithLabelValues(groupKey(file, name)).Set(float64(len(rules)))

	return &Group{
		name:                 name,
		file:                 file,
		interval:             interval,
		rules:                rules,
		shouldRestore:        shouldRestore,
		opts:                 opts,
		seriesInPreviousEval: make([]map[string]labels.Labels, len(rules)),
		done:                 make(chan struct{}),
		terminated:           make(chan struct{}),
		logger:               log.With(opts.Logger, "group", name),
		metrics:              metrics,
	}
}
func NewGroup(name, file string, interval time.Duration, rules []Rule, shouldRestore bool, opts *ManagerOptions) *Group {
	metrics := opts.Metrics
	if metrics == nil {
		metrics = NewGroupMetrics(opts.Registerer)
	}

	metrics.groupLastEvalTime.WithLabelValues(groupKey(file, name))
	metrics.groupLastDuration.WithLabelValues(groupKey(file, name))
	metrics.groupRules.WithLabelValues(groupKey(file, name)).Set(float64(len(rules)))

	return &Group{
		name:                 name,
		file:                 file,
		interval:             interval,
		rules:                rules,
		shouldRestore:        shouldRestore,
		opts:                 opts,
		seriesInPreviousEval: make([]map[string]labels.Labels, len(rules)),
		done:                 make(chan struct{}),
		terminated:           make(chan struct{}),
		logger:               log.With(opts.Logger, "group", name),
		metrics:              metrics,
	}
}
// NewGroup makes a new Group with the given name, options, and rules.