This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Design
Izabella Raulin edited this page Jun 21, 2016
·
18 revisions
For discussions regarding design please visit: https://github.com/intelsdi-x/kubesnap/issues/2
Currently Heapster collects from cadvisor StandardMetrics and LabeledMetrics. It makes sense to support the same (or at least similar) metric set.
This format is the same as exposed by kubelet, an example below.
All STANDARD METRIC and LABELED METRIC must be exposed by snap:
- STANDARD METRICS
cadvisor | snap |
---|---|
"docker name" : "spec" : "creation_time" | /intel/docker/<docker_id>/spec/creation_time |
"docker name" : "stats" : "cpu" : "usage" : "total" | /intel/docker/<docker_id>/cgroups/cpu_stats/cpu_usage/total_usage |
"docker name" : "stats" : "memory" : "usage" | /intel/docker/<docker_id>/cgroups/memory_stats/usage/usage |
"docker name" : "stats" : "memory" : "working_set" | /intel/docker/<docker_id>/cgroups/memory_stats/stats/working_set |
"docker name" : "stats" : "memory" : "container_data" : "pgfault" | /intel/docker/<docker_id>/cgroups/memory_stats/stats/pgfault |
"docker name" : "stats" : "memory" : "container_data" : "pgmajfault" | /intel/docker/<docker_id>/cgroups/memory_stats/stats/pgmajfault |
"docker name" : "stats" : "network" : "rx_bytes" | /intel/docker/<docker_id>/network/<interface_name>/rx_bytes |
"docker name" : "stats" : "network" : "rx_errors" | /intel/docker/<docker_id>/network/<interface_name>/rx_errors |
"docker name" : "stats" : "network" : "tx_bytes" | /intel/docker/<docker_id>/network/<interface_name>/tx_bytes |
"docker name" : "stats" : "network" : "tx_errors" | /intel/docker/<docker_id>/network/<interface_name>/tx_errors |
- LABELED METRICS
cadvisor | snap |
---|---|
"docker name" : "stats" : "filesystem" : "capacity" | /intel/docker/<docker_id>/filesystem/<device_name>/capacity |
"docker name" : "stats" : "filesystem" : "usage" | /intel/docker/<docker_id>/filesystem/<device_name>/usage |
"docker name" : "stats" : "filesystem" : "available" | /intel/docker/<docker_id>/filesystem/<device_name>/available |
- For details regarding STANDARD METRIC see: https://github.com/kubernetes/heapster/blob/master/metrics/core/metrics.go#L82
- For details regarding LABELED METRIC see: https://github.com/kubernetes/heapster/blob/master/metrics/core/metrics.go#L425
In addition CUSTOM METRICS must be also supported (see example below).
- all metrics returned by snap-collector-docker plugin (which are not STANDARD or LABELED METRICS) will be put into "custom_metrics" section
- for "/" container other snap metrics will be put in "custom_metrics" section
{
"/": {
"name": "/",
"subcontainers": [
{
"name": "/docker"
},
{
"name": "/init.scope"
},
{
"name": "/system.slice"
},
{
"name": "/user.slice"
}
],
"spec": {
"creation_time": "2016-04-12T09:24:10.610525399-04:00",
"has_cpu": true,
"cpu": {
"limit": 1024,
"max_limit": 0,
"mask": "0-47",
"period": 100000
},
"has_memory": true,
"memory": {
"limit": 270382407680,
"swap_limit": 4294963200
},
"has_network": true,
"has_filesystem": true,
"has_diskio": true,
"has_custom_metrics": true,
"custom_metrics":[
{
"name":"SNAP",
"type":"gauge",
"format":"int",
"units":"SNAP_UNIT"
}
]
},
"stats": [
{
"timestamp": "2016-04-29T03:13:05.64656208-04:00",
"custom_metrics":{
"SNAP":[
{
"timestamp":"2016-04-25T09:52:39.626563663-04:00",
"int_value":5
}
]
},
"cpu": {
"usage": {
"total": 1414635370517792,
"per_cpu_usage": [
47532641283909,
15298716473293
],
"user": 1356077240000000,
"system": 35946190000000
},
"load_average": 0
},
"diskio": {
"io_service_bytes": [
{
"major": 1,
"minor": 3,
"stats": {
"Async": 12288,
"Read": 12288,
"Sync": 0,
"Total": 12288,
"Write": 0
}
}
],
"io_serviced": [
{
"major": 1,
"minor": 4,
"stats": {
"Async": 3,
"Read": 3,
"Sync": 0,
"Total": 3,
"Write": 0
}
}
]
},
"memory": {
"usage": 25972142080,
"cache": 1532944384,
"rss": 618106880,
"working_set": 20886654976,
"failcnt": 0,
"container_data": {
"pgfault": 4967179,
"pgmajfault": 2948
},
"hierarchical_data": {
"pgfault": 4967179,
"pgmajfault": 2948
}
},
"network": {
"name": "enp4s0f1",
"rx_bytes": 0,
"rx_packets": 0,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 64962659,
"tx_packets": 350502,
"tx_errors": 0,
"tx_dropped": 0,
"interfaces": [
{
"name": "enp4s0f0",
"rx_bytes": 3542851672,
"rx_packets": 3560220,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 456867715,
"tx_packets": 2639343,
"tx_errors": 0,
"tx_dropped": 0
}
],
"tcp": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
},
"tcp6": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
}
},
"filesystem": [
{
"device": "/dev/mapper/os-root",
"type": "vfs",
"capacity": 52710469632,
"usage": 26413805568,
"base_usage": 0,
"available": 23595532288,
"inodes_free": 2834644,
"reads_completed": 0,
"reads_merged": 0,
"sectors_read": 0,
"read_time": 0,
"writes_completed": 0,
"writes_merged": 0,
"sectors_written": 0,
"write_time": 0,
"io_in_progress": 0,
"io_time": 0,
"weighted_io_time": 0
}
],
"task_stats": {
"nr_sleeping": 0,
"nr_running": 0,
"nr_stopped": 0,
"nr_uninterruptible": 0,
"nr_io_wait": 0
}
}
]
},
"/docker": {
"name": "/docker",
"subcontainers": [
{
"name": "/docker/0bda74d99b10cb45a42dbdf323a8b6025fd3d2697dab3c3f6c562e36e767301f"
},
{
"name": "/docker/6061ec0baab1fd5e6b687c41e979dd0203a9f591b94f7a17b6351d087b98883d"
},
{
"name": "/docker/614fdd95964a695d30b6ab0c86d2be232a4ad59a98ded024d8f963f0ad4fd664"
}
],
"spec": {
"creation_time": "2016-04-12T09:24:10.610525399-04:00",
"has_cpu": true,
"cpu": {
"limit": 1024,
"max_limit": 0,
"mask": "0-47",
"period": 100000
},
"has_memory": true,
"memory": {
"limit": 9223372036854771712
},
"has_network": false,
"has_filesystem": false,
"has_diskio": true,
"has_custom_metrics": false
},
"stats": [
{
"timestamp": "2016-04-29T03:12:55.735076483-04:00",
"cpu": {
"usage": {
"total": 13287801975471,
"per_cpu_usage": [
421213154297,
213244083385
],
"user": 10446470000000,
"system": 1965640000000
},
"load_average": 0
},
"diskio": {
"io_service_bytes": [
{
"major": 252,
"minor": 1,
"stats": {
"Async": 0,
"Read": 0,
"Sync": 0,
"Total": 0,
"Write": 0
}
}
],
"io_serviced": [
{
"major": 252,
"minor": 2,
"stats": {
"Async": 0,
"Read": 0,
"Sync": 0,
"Total": 0,
"Write": 0
}
}
]
},
"memory": {
"usage": 7944175616,
"cache": 0,
"rss": 0,
"working_set": 7938174976,
"failcnt": 0,
"container_data": {
"pgfault": 0,
"pgmajfault": 0
},
"hierarchical_data": {
"pgfault": 0,
"pgmajfault": 0
}
},
"network": {
"name": "",
"rx_bytes": 0,
"rx_packets": 0,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 0,
"tx_packets": 0,
"tx_errors": 0,
"tx_dropped": 0,
"tcp": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
},
"tcp6": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
}
},
"task_stats": {
"nr_sleeping": 0,
"nr_running": 0,
"nr_stopped": 0,
"nr_uninterruptible": 0,
"nr_io_wait": 0
}
}
]
},
"/docker/0bda74d99b10cb45a42dbdf323a8b6025fd3d2697dab3c3f6c562e36e767301f": {
"id": "0bda74d99b10cb45a42dbdf323a8b6025fd3d2697dab3c3f6c562e36e767301f",
"name": "/docker/0bda74d99b10cb45a42dbdf323a8b6025fd3d2697dab3c3f6c562e36e767301f",
"aliases": [
"k8s_influxdb.4e522a38_influxdb-grafana-jnr9h_default_7ebf70fc-0dd7-11e6-b0fc-001e6776b197_ca26fd32",
"0bda74d99b10cb45a42dbdf323a8b6025fd3d2697dab3c3f6c562e36e767301f"
],
"namespace": "docker",
"labels": {
"io.kubernetes.container.hash": "4e522a38",
"io.kubernetes.container.name": "influxdb",
"io.kubernetes.container.restartCount": "0",
"io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
"io.kubernetes.pod.name": "influxdb-grafana-jnr9h",
"io.kubernetes.pod.namespace": "default",
"io.kubernetes.pod.terminationGracePeriod": "30",
"io.kubernetes.pod.uid": "7ebf70fc-0dd7-11e6-b0fc-001e6776b197"
},
"spec": {
"creation_time": "2016-04-29T06:56:27.947754402Z",
"labels": {
"io.kubernetes.container.hash": "4e522a38",
"io.kubernetes.container.name": "influxdb",
"io.kubernetes.container.restartCount": "0",
"io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
"io.kubernetes.pod.name": "influxdb-grafana-jnr9h",
"io.kubernetes.pod.namespace": "default",
"io.kubernetes.pod.terminationGracePeriod": "30",
"io.kubernetes.pod.uid": "7ebf70fc-0dd7-11e6-b0fc-001e6776b197"
},
"has_cpu": true,
"cpu": {
"limit": 2,
"max_limit": 0,
"mask": "0-47"
},
"has_memory": true,
"memory": {
"limit": 18446744073709551615,
"swap_limit": 18446744073709551615
},
"has_network": false,
"has_filesystem": true,
"has_diskio": true,
"has_custom_metrics": false,
"image": "kube_inf/ak:1"
},
"stats": [
{
"timestamp": "2016-04-29T03:13:07.259723901-04:00",
"cpu": {
"usage": {
"total": 1854342801,
"per_cpu_usage": [
1557669,
33058270
],
"user": 940000000,
"system": 350000000
},
"load_average": 0
},
"diskio": {
"io_service_bytes": [
{
"major": 252,
"minor": 1,
"stats": {
"Async": 8192,
"Read": 0,
"Sync": 6287360,
"Total": 6295552,
"Write": 6295552
}
}
],
"io_serviced": [
{
"major": 252,
"minor": 1,
"stats": {
"Async": 2,
"Read": 0,
"Sync": 1238,
"Total": 1240,
"Write": 1240
}
}
]
},
"memory": {
"usage": 15577088,
"cache": 266240,
"rss": 15310848,
"working_set": 15568896,
"failcnt": 0,
"container_data": {
"pgfault": 1564,
"pgmajfault": 0
},
"hierarchical_data": {
"pgfault": 1564,
"pgmajfault": 0
}
},
"network": {
"name": "",
"rx_bytes": 0,
"rx_packets": 0,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 0,
"tx_packets": 0,
"tx_errors": 0,
"tx_dropped": 0,
"tcp": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
},
"tcp6": {
"Established": 0,
"SynSent": 0,
"SynRecv": 0,
"FinWait1": 0,
"FinWait2": 0,
"TimeWait": 0,
"Close": 0,
"CloseWait": 0,
"LastAck": 0,
"Listen": 0,
"Closing": 0
}
},
"filesystem": [
{
"device": "/dev/mapper/os-root",
"type": "vfs",
"capacity": 52710469632,
"usage": 94208,
"base_usage": 32768,
"available": 0,
"inodes_free": 0,
"reads_completed": 0,
"reads_merged": 0,
"sectors_read": 0,
"read_time": 0,
"writes_completed": 0,
"writes_merged": 0,
"sectors_written": 0,
"write_time": 0,
"io_in_progress": 0,
"io_time": 0,
"weighted_io_time": 0
}
],
"task_stats": {
"nr_sleeping": 0,
"nr_running": 0,
"nr_stopped": 0,
"nr_uninterruptible": 0,
"nr_io_wait": 0
}
}
]
},
}
- Method: POST
- URL (sample IP): http://127.0.0.1:8777/stats/container/
- Proto: HTTP/1.1
- Header: Content-Type: application/json
- Body (sample start and end):
{
"containerName":"/",
"num_stats":1,
"start":"2016-04-28T09:58:30-04:00",
"end":"2016-04-28T09:59:00-04:00",
"subcontainers":true
}