Parcourir la source

Add GraphiteOnce() for single submissions to Graphite

Fixes #82
Peter Teichman il y a 11 ans
Parent
commit
9d02e6c8d5
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      graphite.go

+ 7 - 0
graphite.go

@@ -45,6 +45,13 @@ func GraphiteWithConfig(c GraphiteConfig) {
 	}
 }
 
+// GraphiteOnce performs a single submission to Graphite, returning a
+// non-nil error on failed connections. This can be used in a loop
+// similar to GraphiteWithConfig for custom error handling.
+func GraphiteOnce(c GraphiteConfig) error {
+	return graphite(&c)
+}
+
 func graphite(c *GraphiteConfig) error {
 	now := time.Now().Unix()
 	du := float64(c.DurationUnit)