Ilia Choly 10 anni fa
parent
commit
264f2cd475
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      registry.go

+ 8 - 0
registry.go

@@ -169,6 +169,14 @@ func Register(name string, i interface{}) error {
 	return DefaultRegistry.Register(name, i)
 }
 
+// Register the given metric under the given name.  Panics if a metric by the
+// given name is already registered.
+func MustRegister(name string, i interface{}) {
+	if err := Register(name, i); err != nil {
+		panic(err)
+	}
+}
+
 // Run all registered healthchecks.
 func RunHealthchecks() {
 	DefaultRegistry.RunHealthchecks()