package metrics

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

const notifierComponent = "notifier"

var (
	NotifierRegisterCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: notifierComponent,
			Name:      "register_total",
			Help:      "Counter of notifier register",
		},
		[]string{},
	)
	NotifierUnregisterCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: notifierComponent,
			Name:      "unregister_total",
			Help:      "Counter of notifier unregister",
		},
		[]string{},
	)
	NotifierSendCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: notifierComponent,
			Name:      "send_total",
			Help:      "Counter of notifier send",
		},
		[]string{},
	)
	NotifierSendChanCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: notifierComponent,
			Name:      "send_chan_total",
			Help:      "Counter of notifier send to channel",
		},
		[]string{"rlt"},
	)
)

func init() {
	// Register custom metrics with the global prometheus registry
	metrics.Registry.MustRegister(NotifierRegisterCounter)
	metrics.Registry.MustRegister(NotifierUnregisterCounter)
	metrics.Registry.MustRegister(NotifierSendCounter)
	metrics.Registry.MustRegister(NotifierSendChanCounter)
}
