Skip to content

Commit e8e2b2b

Browse files
authored
Merge pull request #2361 from parthyadav3105/master
Add timestamp support in stdout storage driver
2 parents 7dfa1d0 + 591b16e commit e8e2b2b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

storage/stdout/stdout.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package stdout
1717
import (
1818
"bytes"
1919
"fmt"
20+
"time"
2021

2122
info "github.com/google/cadvisor/info/v1"
2223
"github.com/google/cadvisor/storage"
@@ -31,6 +32,8 @@ type stdoutStorage struct {
3132
}
3233

3334
const (
35+
colTimestamp = "timestamp"
36+
// CPU Uasge
3437
colCpuCumulativeUsage = "cpu_cumulative_usage"
3538
// Memory Usage
3639
colMemoryUsage = "memory_usage"
@@ -59,6 +62,9 @@ func new() (storage.StorageDriver, error) {
5962
func (driver *stdoutStorage) containerStatsToValues(stats *info.ContainerStats) (series map[string]uint64) {
6063
series = make(map[string]uint64)
6164

65+
// Unix Timestamp
66+
series[colTimestamp] = uint64(time.Now().UnixNano())
67+
6268
// Cumulative Cpu Usage
6369
series[colCpuCumulativeUsage] = stats.Cpu.Usage.Total
6470

0 commit comments

Comments
 (0)