forked from marpaia/graphite-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
35 lines (35 loc) · 1.12 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Example of using the graphiteNop feature in action:
//
// package mylib
//
// import (
// "github.com/marpaia/graphite-golang"
// "log"
// )
//
// func init() {
//
// // load your configuration file / mechanism
// config := newConfig()
//
// // try to connect a graphite server
// if config.GraphiteEnabled {
// Graphite, err = graphite.NewGraphite(config.Graphite.Host, config.Graphite.Port)
// } else {
// Graphite = graphite.NewGraphiteNop(config.Graphite.Host, config.Graphite.Port)
// }
// // if you couldn't connect to graphite, use a nop
// if err != nil {
// Graphite = graphite.NewGraphiteNop(config.Graphite.Host, config.Graphite.Port)
// }
//
// log.Printf("Loaded Graphite connection: %#v", Graphite)
// Graphite.SimpleSend("stats.graphite_loaded", 1)
// }
//
// func doWork() {
// // this will work just fine, regardless of if you're working with a graphite
// // nop or not
// Graphite.SimpleSend("stats.doing_work", 1)
// }
package graphite