Hi,
i'm trying to send metrics of same type but with different value, but facing this error
duplicate metrics collector registration attempted.
Code snippet
// A CPUStat contains statistics for an individual CPU.
type CPUStat struct {
// The ID of the CPU.
ID string
// Value of cpu usage
Value int
}
func main() {
for i:=0; i<=100000; i++ {
opts := new(CPUStat)
opts.ID = "1"
opts.Value = i
// Make Prometheus client aware of our collector.
c := newCollector(*opts)
prometheus.MustRegister(c)
if err := push.New("
http://xxx.xx.xx.xxx:30091/", "db_usage").
Collector(c).
//Grouping("db", "customers").
Push(); err != nil {
fmt.Println("Could not push completion time to Pushgateway:", err)
}
How To register multiple collector for same metrics?