Skip to content

Commit 3aa2ddb

Browse files
committed
Merge pull request #35 from encryptio/master
add -prefix flag to add a prefix to all stat paths
2 parents dde05a0 + f5a11fa commit 3aa2ddb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

statsdaemon.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ var (
6868
debug = flag.Bool("debug", false, "print statistics sent to graphite")
6969
showVersion = flag.Bool("version", false, "print version string")
7070
persistCountKeys = flag.Int64("persist-count-keys", 60, "number of flush-interval's to persist count keys")
71-
receiveCounter = flag.String("receive-counter", "", "Metric name for total metrics recevied per interval")
71+
receiveCounter = flag.String("receive-counter", "", "Metric name for total metrics recevied per interval")
7272
percentThreshold = Percentiles{}
73+
prefix = flag.String("prefix", "", "Prefix for all stats")
7374
)
7475

7576
func init() {
@@ -99,7 +100,7 @@ func monitor() {
99100
log.Printf("ERROR: %s", err)
100101
}
101102
case s := <-In:
102-
if (*receiveCounter != "") {
103+
if *receiveCounter != "" {
103104
v, ok := counters[*receiveCounter]
104105
if !ok || v < 0 {
105106
counters[*receiveCounter] = 0
@@ -315,7 +316,7 @@ func parseMessage(data []byte) []*Packet {
315316
}
316317

317318
packet := &Packet{
318-
Bucket: string(item[1]),
319+
Bucket: *prefix + string(item[1]),
319320
Value: value,
320321
Modifier: modifier,
321322
Sampling: float32(sampleRate),

0 commit comments

Comments
 (0)