From 0e13061cfa5160340562c2083808e012d5447ce2 Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Tue, 18 Nov 2014 19:13:54 +0000 Subject: [PATCH] Fix issue in influxdb driver that prevented container name and hostname from being populated. --- storage/influxdb/influxdb.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/storage/influxdb/influxdb.go b/storage/influxdb/influxdb.go index b4697d6d44..227cca0bf1 100644 --- a/storage/influxdb/influxdb.go +++ b/storage/influxdb/influxdb.go @@ -62,22 +62,22 @@ const ( func (self *influxdbStorage) getSeriesDefaultValues( ref info.ContainerReference, stats *info.ContainerStats, - columns []string, - values []interface{}) { + columns *[]string, + values *[]interface{}) { // Timestamp - columns = append(columns, colTimestamp) - values = append(values, stats.Timestamp.UnixNano()/1E3) + *columns = append(*columns, colTimestamp) + *values = append(*values, stats.Timestamp.UnixNano()/1E3) // Machine name - columns = append(columns, colMachineName) - values = append(values, self.machineName) + *columns = append(*columns, colMachineName) + *values = append(*values, self.machineName) // Container name - columns = append(columns, colContainerName) + *columns = append(*columns, colContainerName) if len(ref.Aliases) > 0 { - values = append(values, ref.Aliases[0]) + *values = append(*values, ref.Aliases[0]) } else { - values = append(values, ref.Name) + *values = append(*values, ref.Name) } } @@ -91,7 +91,7 @@ func (self *influxdbStorage) containerFilesystemStatsToSeries( for _, fsStat := range stats.Filesystem { columns := make([]string, 0) values := make([]interface{}, 0) - self.getSeriesDefaultValues(ref, stats, columns, values) + self.getSeriesDefaultValues(ref, stats, &columns, &values) columns = append(columns, colFsDevice) values = append(values, fsStat.Device) @@ -110,7 +110,7 @@ func (self *influxdbStorage) containerStatsToValues( ref info.ContainerReference, stats *info.ContainerStats, ) (columns []string, values []interface{}) { - self.getSeriesDefaultValues(ref, stats, columns, values) + self.getSeriesDefaultValues(ref, stats, &columns, &values) // Cumulative Cpu Usage columns = append(columns, colCpuCumulativeUsage) values = append(values, stats.Cpu.Usage.Total)