Ver código fonte

Add GraphiteOnce() for single submissions to Graphite

Fixes #82
Peter Teichman 11 anos atrás
pai
commit
9d02e6c8d5
1 arquivos alterados com 7 adições e 0 exclusões
  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)