Skip to content

Commit

Permalink
add logging for aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Feb 16, 2017
1 parent 249e66d commit 0aaae50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (a *Aggregator) Flush(ts uint) {
if agg.ts < ts {
result := a.fn(agg.values)
metric := fmt.Sprintf("%s %f %d", string(agg.key), result, agg.ts)
log.Debug("aggregator emitting %q", metric)
a.out <- []byte(metric)
} else {
aggregations2 = append(aggregations2, agg)
Expand Down
9 changes: 9 additions & 0 deletions aggregator/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package aggregator

import logging "github.com/op/go-logging"

var log = logging.MustGetLogger("aggregator") // for tests. overridden by main

func SetLogger(l *logging.Logger) {
log = l
}
2 changes: 2 additions & 0 deletions cmd/carbon-relay-ng/carbon-relay-ng.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/BurntSushi/toml"
"github.com/Dieterbe/go-metrics"
"github.com/graphite-ng/carbon-relay-ng/aggregator"
"github.com/graphite-ng/carbon-relay-ng/badmetrics"
"github.com/graphite-ng/carbon-relay-ng/cfg"
"github.com/graphite-ng/carbon-relay-ng/destination"
Expand Down Expand Up @@ -57,6 +58,7 @@ func init() {
destination.SetLogger(log)
telnet.SetLogger(log)
web.SetLogger(log)
aggregator.SetLogger(log)
}

func usage() {
Expand Down

0 comments on commit 0aaae50

Please sign in to comment.