diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index a2a092a8..7a345337 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -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) diff --git a/aggregator/init.go b/aggregator/init.go new file mode 100644 index 00000000..05c23f78 --- /dev/null +++ b/aggregator/init.go @@ -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 +} diff --git a/cmd/carbon-relay-ng/carbon-relay-ng.go b/cmd/carbon-relay-ng/carbon-relay-ng.go index ea7445eb..b6a81344 100644 --- a/cmd/carbon-relay-ng/carbon-relay-ng.go +++ b/cmd/carbon-relay-ng/carbon-relay-ng.go @@ -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" @@ -57,6 +58,7 @@ func init() { destination.SetLogger(log) telnet.SetLogger(log) web.SetLogger(log) + aggregator.SetLogger(log) } func usage() {