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

Code before:
	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{
			Namespace:                       namespace,
			Name:                            "rule_evaluation_histogram_duration_seconds",
			Help:                            "The duration for a rule to execute.",
			Buckets:                         []float64{.01, .1, 1, 10},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		}),
		IterationDuration: prometheus.NewSummary(prometheus.SummaryOpts{
			Namespace:  namespace,
			Name:       "rule_group_duration_seconds",
			Help:       "The duration of rule group evaluations.",
			Objectives: map[float64]float64{0.01: 0.001, 0.05: 0.005, 0.5: 0.05, 0.90: 0.01, 0.99: 0.001},
		}),
		IterationHistogramDuration: prometheus.NewHistogram(prometheus.HistogramOpts{
			Namespace:                       namespace,
			Name:                            "rule_group_histogram_duration_seconds",
			Help:                            "The duration of rule group evaluations.",
			Buckets:                         []float64{.01, .1, 1, 10},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		}),
		IterationsMissed: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Namespace: namespace,
				Name:      "rule_group_iterations_missed_total",

Review comment (suggestion):
```suggestion
			Name:                            "rule_evaluation_duration_histogram_seconds",
```

Code after:
	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{
			Namespace:                       namespace,
			Name:                            "rule_evaluation_duration_histogram_seconds",
			Help:                            "The duration for a rule to execute.",
			Buckets:                         []float64{.01, .1, 1, 10},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		}),
		IterationDuration: prometheus.NewSummary(prometheus.SummaryOpts{
			Namespace:  namespace,
			Name:       "rule_group_duration_seconds",
			Help:       "The duration of rule group evaluations.",
			Objectives: map[float64]float64{0.01: 0.001, 0.05: 0.005, 0.5: 0.05, 0.90: 0.01, 0.99: 0.001},
		}),
		IterationDurationHistogram: prometheus.NewHistogram(prometheus.HistogramOpts{
			Namespace:                       namespace,
			Name:                            "rule_group_duration_histogram_seconds",
			Help:                            "The duration of rule group evaluations.",
			Buckets:                         []float64{.01, .1, 1, 10},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		}),
		IterationsMissed: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Namespace: namespace,
				Name:      "rule_group_iterations_missed_total",