Repository: prometheus/prometheus
File: rules/group.go (Go)

Code before:
		return false
	}

	for i, gr := range g.rules {
		if gr.String() != ng.rules[i].String() {
			return false
		}
	}

	return true
}

// GroupKey group names need not be unique across filenames.
func GroupKey(file, name string) string {
	return file + ";" + name
}

// Constants for instrumentation.
const namespace = "prometheus"

// Metrics for rule evaluation.
type Metrics struct {
	EvalDuration               prometheus.Summary
	EvalHistogramDuration      prometheus.Histogram
	IterationDuration          prometheus.Summary
	IterationHistogramDuration prometheus.Histogram
	IterationsMissed           *prometheus.CounterVec
	IterationsScheduled        *prometheus.CounterVec
	EvalTotal                  *prometheus.CounterVec
	EvalFailures               *prometheus.CounterVec
	GroupInterval              *prometheus.GaugeVec
	GroupLastEvalTime          *prometheus.GaugeVec
	GroupLastDuration          *prometheus.GaugeVec
	GroupLastRuleDurationSum   *prometheus.GaugeVec
	GroupLastRestoreDuration   *prometheus.GaugeVec
	GroupRules                 *prometheus.GaugeVec
	GroupSamples               *prometheus.GaugeVec
}

// NewGroupMetrics creates a new instance of Metrics and registers it with the provided registerer,
// if not nil.
func NewGroupMetrics(reg prometheus.Registerer) *Metrics {
	m := &Metrics{
		EvalDuration: prometheus.NewSummary(
			prometheus.SummaryOpts{
				Namespace:  namespace,
				Name:       "rule_evaluation_duration_seconds",
				Help:       "The duration for a rule to execute.",
				Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
			}),
		EvalHistogramDuration: prometheus.NewHistogram(prometheus.HistogramOpts{

Review comment (suggestion):
```suggestion
	IterationDurationHistogram prometheus.Histogram
```

Code after:
		return false
	}

	for i, gr := range g.rules {
		if gr.String() != ng.rules[i].String() {
			return false
		}
	}

	return true
}

// GroupKey group names need not be unique across filenames.
func GroupKey(file, name string) string {
	return file + ";" + name
}

// Constants for instrumentation.
const namespace = "prometheus"

// Metrics for rule evaluation.
type Metrics struct {
	EvalDuration               prometheus.Summary
	EvalDurationHistogram      prometheus.Histogram
	IterationDuration          prometheus.Summary
	IterationDurationHistogram prometheus.Histogram
	IterationsMissed           *prometheus.CounterVec
	IterationsScheduled        *prometheus.CounterVec
	EvalTotal                  *prometheus.CounterVec
	EvalFailures               *prometheus.CounterVec
	GroupInterval              *prometheus.GaugeVec
	GroupLastEvalTime          *prometheus.GaugeVec
	GroupLastDuration          *prometheus.GaugeVec
	GroupLastRuleDurationSum   *prometheus.GaugeVec
	GroupLastRestoreDuration   *prometheus.GaugeVec
	GroupRules                 *prometheus.GaugeVec
	GroupSamples               *prometheus.GaugeVec
}

// NewGroupMetrics creates a new instance of Metrics and registers it with the provided registerer,
// if not nil.
func NewGroupMetrics(reg prometheus.Registerer) *Metrics {
	m := &Metrics{
		EvalDuration: prometheus.NewSummary(
			prometheus.SummaryOpts{
				Namespace:  namespace,
				Name:       "rule_evaluation_duration_seconds",
				Help:       "The duration for a rule to execute.",
				Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
			}),
		EvalDurationHistogram: prometheus.NewHistogram(prometheus.HistogramOpts{