Commit f744f49f authored by Kamil Kisiel's avatar Kamil Kisiel

Fixed aggregator creation and metric receiving

parent 7abcd625
......@@ -51,6 +51,14 @@ type MetricAggregator struct {
timers MetricListMap
}
func NewMetricAggregator(sender MetricSender, flushInterval time.Duration) (a MetricAggregator) {
a = MetricAggregator{}
a.FlushInterval = flushInterval
a.Sender = sender
a.MetricChan = make(chan Metric)
return
}
func (m *MetricAggregator) flush() (metrics MetricMap) {
metrics = make(MetricMap)
numStats := 0
......
......@@ -10,9 +10,7 @@ func ListenAndServe(metricAddr string, consoleAddr string, graphiteAddr string,
return err
}
aggregator := MetricAggregator{}
aggregator.FlushInterval = flushInterval
aggregator.Sender = &graphite
aggregator := NewMetricAggregator(&graphite, flushInterval)
f := func(metric Metric) {
aggregator.MetricChan <- metric
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment