package metrics

import (
	"github.com/prometheus/client_golang/prometheus"
	"sigs.k8s.io/controller-runtime/pkg/metrics"
)

const tidbPodReschedulerComponent = "tidbpodrescheduler"

var (
	DeletePendingPodsCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: tidbPodReschedulerComponent,
			Name:      "delete_pending_pods_total",
			Help:      "Counter of deleted pending pods",
		},
		[]string{"pool_ns", "rlt"},
	)
	RescheduleSkipCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: tidbPodReschedulerComponent,
			Name:      "reschedule_skip_total",
			Help:      "Counter of reschedule skip events by reason",
		},
		[]string{"pool_ns", "reason"},
	)
	RescheduleCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: tidbPodReschedulerComponent,
			Name:      "reschedule_total",
			Help:      "Counter of reschedule events by reason",
		},
		[]string{"pool_ns", "reason"},
	)
)

func init() {
	// Register custom metrics with the global prometheus registry
	metrics.Registry.MustRegister(DeletePendingPodsCounter)
	metrics.Registry.MustRegister(RescheduleSkipCounter)
	metrics.Registry.MustRegister(RescheduleCounter)
}
