Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Commit 3298d93

Browse files
authored
Merge pull request #1541 from andyxning/add_rss_and_cache
add rss and cache
2 parents ba24db4 + 0c7a6c0 commit 3298d93

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/storage-schema.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Heapster exports the following metrics to its backends.
2626
| memory/page_faults_rate | Number of page faults per second. |
2727
| memory/request | Memory request (the guaranteed amount of resources) in bytes. |
2828
| memory/usage | Total memory usage. |
29+
| memory/cache | Cache memory usage. |
30+
| memory/rss | RSS memory usage. |
2931
| memory/working_set | Total working set usage. Working set is the memory being used and not easily dropped by the kernel. |
3032
| network/rx | Cumulative number of bytes received over the network. |
3133
| network/rx_errors | Cumulative number of errors while receiving over the network. |

metrics/core/metrics.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var StandardMetrics = []Metric{
2929
MetricUptime,
3030
MetricCpuUsage,
3131
MetricMemoryUsage,
32+
MetricMemoryRSS,
33+
MetricMemoryCache,
3234
MetricMemoryWorkingSet,
3335
MetricMemoryPageFaults,
3436
MetricMemoryMajorPageFaults,
@@ -103,6 +105,8 @@ var MemoryMetrics = []Metric{
103105
MetricMemoryPageFaultsRate,
104106
MetricMemoryRequest,
105107
MetricMemoryUsage,
108+
MetricMemoryRSS,
109+
MetricMemoryCache,
106110
MetricMemoryWorkingSet,
107111
MetricNodeMemoryAllocatable,
108112
MetricNodeMemoryCapacity,
@@ -209,6 +213,44 @@ var MetricMemoryUsage = Metric{
209213
},
210214
}
211215

216+
var MetricMemoryCache = Metric{
217+
MetricDescriptor: MetricDescriptor{
218+
Name: "memory/cache",
219+
Description: "Cache memory",
220+
Type: MetricGauge,
221+
ValueType: ValueInt64,
222+
Units: UnitsBytes,
223+
},
224+
HasValue: func(spec *cadvisor.ContainerSpec) bool {
225+
return spec.HasMemory
226+
},
227+
GetValue: func(spec *cadvisor.ContainerSpec, stat *cadvisor.ContainerStats) MetricValue {
228+
return MetricValue{
229+
ValueType: ValueInt64,
230+
MetricType: MetricGauge,
231+
IntValue: int64(stat.Memory.Cache)}
232+
},
233+
}
234+
235+
var MetricMemoryRSS = Metric{
236+
MetricDescriptor: MetricDescriptor{
237+
Name: "memory/rss",
238+
Description: "RSS memory",
239+
Type: MetricGauge,
240+
ValueType: ValueInt64,
241+
Units: UnitsBytes,
242+
},
243+
HasValue: func(spec *cadvisor.ContainerSpec) bool {
244+
return spec.HasMemory
245+
},
246+
GetValue: func(spec *cadvisor.ContainerSpec, stat *cadvisor.ContainerStats) MetricValue {
247+
return MetricValue{
248+
ValueType: ValueInt64,
249+
MetricType: MetricGauge,
250+
IntValue: int64(stat.Memory.RSS)}
251+
},
252+
}
253+
212254
var MetricMemoryWorkingSet = Metric{
213255
MetricDescriptor: MetricDescriptor{
214256
Name: "memory/working_set",

0 commit comments

Comments
 (0)