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?
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/CAOrgXNJbopELKjOYCGU1tY0D%3D57v_3BzT0oQ9cb0Cyv_O2phVA%40mail.gmail.com.