Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
@@ -94,6 +94,7 @@ func NewCollectorDataSource(
clusterMap := newCollectorClusterMap(clusterInfo)
return &collectorDataSource{
+ config: config,
metricsQuerier: metricQuerier,
clusterInfo: clusterInfo,
clusterMap: clusterMap,
@@ -49,7 +49,11 @@ func (a *averageOverTimeAggregator) Value() []MetricValue {
a.lock.Lock()
defer a.lock.Unlock()
if a.count == 0 {
- return []MetricValue{}
+ return []MetricValue{
+ {
+ Value: 0,
+ },
+ }
}
return []MetricValue{
{a.total / float64(a.count), nil},
@@ -20,7 +20,11 @@ func TestAvgOverTimeAggregator_Value(t *testing.T) {
}{
"no update": {
updates: []update{},
- want: []MetricValue{},
+ want: []MetricValue{
},
"single update": {
updates: []update{
@@ -58,9 +58,6 @@ func (a *increaseAggregator) Update(value float64, timestamp time.Time, addition
func (a *increaseAggregator) Value() []MetricValue {
- if !a.initialized {
- }
{Value: a.current - a.initial},
@@ -20,7 +20,11 @@ func TestIncreaseAggregator_Value(t *testing.T) {
@@ -69,9 +69,6 @@ func (a *iRateMaxAggregator) Update(value float64, timestamp time.Time, addition
func (a *iRateMaxAggregator) Value() []MetricValue {
{Value: a.max},
@@ -22,7 +22,11 @@ func TestIRateMaxAggregator_Value(t *testing.T) {
@@ -43,9 +43,6 @@ func (a *maxOverTimeAggregator) Update(value float64, timestamp time.Time, addit
func (a *maxOverTimeAggregator) Value() []MetricValue {
- if a.max == 0 {
@@ -19,7 +19,11 @@ func TestMaxOverTimeAggregator_Value(t *testing.T) {
@@ -60,9 +60,6 @@ func (a *rateAggregator) Update(value float64, timestamp time.Time, additionalIn
func (a *rateAggregator) Value() []MetricValue {
seconds := a.currentTime.Sub(a.initialTime).Seconds()
if seconds == 0 {
@@ -21,7 +21,11 @@ func TestRateAggregator_Value(t *testing.T) {