package slprober

import (
	"github.com/prometheus/client_golang/prometheus"
)

var (
	O11yDedicatedPrometheusAPIAvailableCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "dedicated_prometheus_api_available_counter",
			Help:      "Service level probe operations count for observability dedicated prometheus api available",
		}, []string{"region", "o11y_cluster_id", "tenant_id", "project_id", "application_id", "status"})

	O11ySharedVMAPIAvailableCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "shared_vm_api_available_counter",
			Help:      "Service level probe operations count for observability shared vm api available",
		}, []string{"region", "o11y_cluster_id", "status"})

	O11ySharedLokiAPIAvailableCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "shared_loki_api_available_counter",
			Help:      "Service level probe operations count for observability shared loki api available",
		}, []string{"region", "o11y_cluster_id", "status"})

	O11yCreateClusterAPIAvailableCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "create_cluster_api_available_counter",
			Help:      "Service level probe operations count for observability create cluster api available",
		}, []string{"region", "o11y_cluster_id", "status"})

	O11yGetClusterAPIAvailableCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "get_cluster_api_available_counter",
			Help:      "Service level probe operations count for observability get cluster api available",
		}, []string{"region", "o11y_cluster_id", "status"})

	O11yS3LogsUploadDelayHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "s3_logs_upload_delay_histogram",
			Help:      "Service level probe operations histogram for observability s3 logs upload delay",
		}, []string{"region", "o11y_cluster_id", "tenant_id", "project_id", "application_id", "status"})

	O11yS3MetricsUploadDelayHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "s3_metrics_upload_delay_histogram",
			Help:      "Service level probe operations histogram for observability s3 metrics upload delay",
		}, []string{"region", "o11y_cluster_id", "tenant_id", "project_id", "application_id", "status"})

	O11yPrometheusMetricsUploadDelayHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "observability",
			Subsystem: "service_level",
			Name:      "prometheus_metrics_upload_delay_histogram",
			Help:      "Service level probe operations histogram for observability prometheus metrics upload delay",
		}, []string{"region", "o11y_cluster_id", "tenant_id", "project_id", "application_id", "status"})
)

func RegisterMetric() *prometheus.Registry {
	reg := prometheus.NewRegistry()
	reg.MustRegister(O11yDedicatedPrometheusAPIAvailableCounter)
	reg.MustRegister(O11ySharedVMAPIAvailableCounter)
	reg.MustRegister(O11ySharedLokiAPIAvailableCounter)
	reg.MustRegister(O11yCreateClusterAPIAvailableCounter)
	reg.MustRegister(O11yGetClusterAPIAvailableCounter)
	reg.MustRegister(O11yS3LogsUploadDelayHistogram)
	reg.MustRegister(O11yS3MetricsUploadDelayHistogram)
	reg.MustRegister(O11yPrometheusMetricsUploadDelayHistogram)
	return reg
}
