comment
This commit is contained in:
parent
4115f73343
commit
05b997d6ec
@ -321,7 +321,7 @@ func (self *influxdbStorage) AddStats(ref info.ContainerReference, stats *info.C
|
|||||||
|
|
||||||
func (self *influxdbStorage) RecentStats(containerName string, numStats int) ([]*info.ContainerStats, error) {
|
func (self *influxdbStorage) RecentStats(containerName string, numStats int) ([]*info.ContainerStats, error) {
|
||||||
// TODO(dengnan): select only columns that we need
|
// TODO(dengnan): select only columns that we need
|
||||||
// TODO(dengnan): escape containerName
|
// TODO(dengnan): escape names
|
||||||
query := fmt.Sprintf("select * from %v where %v='%v' and %v='%v'", self.tableName, colContainerName, containerName, colMachineName, self.machineName)
|
query := fmt.Sprintf("select * from %v where %v='%v' and %v='%v'", self.tableName, colContainerName, containerName, colMachineName, self.machineName)
|
||||||
if numStats > 0 {
|
if numStats > 0 {
|
||||||
query = fmt.Sprintf("%v limit %v", query, numStats)
|
query = fmt.Sprintf("%v limit %v", query, numStats)
|
||||||
@ -348,7 +348,7 @@ func (self *influxdbStorage) RecentStats(containerName string, numStats int) ([]
|
|||||||
|
|
||||||
func (self *influxdbStorage) Samples(containerName string, numSamples int) ([]*info.ContainerStatsSample, error) {
|
func (self *influxdbStorage) Samples(containerName string, numSamples int) ([]*info.ContainerStatsSample, error) {
|
||||||
// TODO(dengnan): select only columns that we need
|
// TODO(dengnan): select only columns that we need
|
||||||
// TODO(dengnan): escape containerName
|
// TODO(dengnan): escape names
|
||||||
query := fmt.Sprintf("select * from %v where %v='%v' and %v='%v'", self.tableName, colContainerName, containerName, colMachineName, self.machineName)
|
query := fmt.Sprintf("select * from %v where %v='%v' and %v='%v'", self.tableName, colContainerName, containerName, colMachineName, self.machineName)
|
||||||
if numSamples > 0 {
|
if numSamples > 0 {
|
||||||
query = fmt.Sprintf("%v limit %v", query, numSamples)
|
query = fmt.Sprintf("%v limit %v", query, numSamples)
|
||||||
@ -383,7 +383,6 @@ func (self *influxdbStorage) Percentiles(
|
|||||||
cpuUsagePercentiles []int,
|
cpuUsagePercentiles []int,
|
||||||
memUsagePercentiles []int,
|
memUsagePercentiles []int,
|
||||||
) (*info.ContainerStatsPercentiles, error) {
|
) (*info.ContainerStatsPercentiles, error) {
|
||||||
// TODO(dengnan): Implement it
|
|
||||||
selectedCol := make([]string, 0, len(cpuUsagePercentiles)+len(memUsagePercentiles)+1)
|
selectedCol := make([]string, 0, len(cpuUsagePercentiles)+len(memUsagePercentiles)+1)
|
||||||
|
|
||||||
selectedCol = append(selectedCol, fmt.Sprintf("max(%v)", colMemoryUsage))
|
selectedCol = append(selectedCol, fmt.Sprintf("max(%v)", colMemoryUsage))
|
||||||
|
Loading…
Reference in New Issue
Block a user