mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-11 02:35:18 +00:00
21 lines
480 B
Go
21 lines
480 B
Go
package metricshelper
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
// RegisterCollectors registers the collectors with reg ignoring
|
|
// reregistration error and panics on any other error
|
|
func RegisterCollectors(reg prometheus.Registerer, collectors ...prometheus.Collector) {
|
|
for _, c := range collectors {
|
|
err := reg.Register(c)
|
|
if err != nil {
|
|
if ok := errors.As(err, &prometheus.AlreadyRegisteredError{}); !ok {
|
|
panic(err)
|
|
}
|
|
}
|
|
}
|
|
}
|