package main

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

func InitMetrics() *Metrics {
	m := &Metrics{
		Total_rbd_requested_size_per_pool: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
		    Name: "total_rbd_requested_size_per_pool",
			Help: "total size of all requested RBDs in a specific pool",
			},
			[]string{"poolname"},
		),

		// total_rbd_requested_size: prometheus.NewGauge(
		// 	prometheus.GaugeOpts{
		// 	Name: "total_rbd_requested_size",
		// 	Help: "total size of all RBDs in the cluster",
		// 	},
		// ),
	}
	return m
}


func FillMetrics(pool Pool,metrics *Metrics) {
	var totalSizePerPool uint64 = 0	

	logger.Debugf("Processing pool %s",pool.Name)
	for _,v := range pool.RBDlist {
		totalSizePerPool += uint64(v.GetSize())
	}
	logger.Debugf("Total size of RBDs in pool %s is %d",pool.Name,totalSizePerPool)

	metrics.Total_rbd_requested_size_per_pool.WithLabelValues(pool.Name,
		).Set(
		float64(totalSizePerPool))
	
}