hbrewster-fluent-plugin-kubernetes-metrics 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,269 @@
1
+ # Metrics Information
2
+
3
+ ## The foillowing table describes common terminology used in this topic.
4
+
5
+ | Terminology | Definition |
6
+ | --- | --- |
7
+ | Node | A single machine in a kubernetes cluster. |
8
+ | imagefs | Stats for the underlying filesystem where container images are stored. Usage here refers to the total number of bytes occupied by images on the filesystem. |
9
+ | fs | Stats pertaining to total usage of filesystem resources on the rootfs used by node Kubernetes components. |
10
+ | sys-container | Stats for system daemons tracked as raw containers. |
11
+ | runtime | Stats for the underlying container runtime. |
12
+ | volume | Stats for volume usage of filesystem resources. |
13
+ | ephemeral-storage | Reports the total filesystem usage for the containers and emptyDir-backed volumes in the measured Pod. |
14
+ | rootfs | Stats pertaining to container rootfs usage of filesystem resources. |
15
+
16
+ Reference: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/apis/stats/v1alpha1/types.go
17
+
18
+
19
+ ## Aggregated Metrics
20
+
21
+ Metrics based on values extracted from aggregated files and field data.
22
+
23
+ | Metric Name | Metric Type | Metric Format | Metric Description |
24
+ | --- | --- | --- | --- |
25
+ | kube.container.cpu.limit | float | millicpu | The container's CPU limit. |
26
+ | kube.container.cpu.request| float| millicpu| Container's CPU request. |
27
+ | kube.container.memory.limit | float | megabyte | The container's memory limit. |
28
+ | kube.container.memory.request | float | megabyte | The container's memory request. |
29
+ | kube.pod.cpu.limit | float | millicpu | The pod's CPU limit. |
30
+ | kube.pod.cpu.request | float | millicpu | The pod's CPU request. |
31
+ | kube.pod.memory.limit | float | megabyte | The pod's memory limit. |
32
+ | kube.pod.memory.request | float | megabyte | The pod's memory request. |
33
+ | kube.namespace.cpu.limit | float | millicpu | The namespace's CPU limit. |
34
+ | kube.namespace.cpu.request | float | millicpu | The namespace's CPU request. |
35
+ | kube.namespace.memory.limit | float | megabyte | The namespace's memory limit. |
36
+ | kube.namespace.memory.request | float | megabyte | The namespace's memory request. |
37
+ | kube.cluster.cpu.limit | float | millicpu | The cluster's CPU limit. |
38
+ | kube.cluster.cpu.request | float | millicpu | The cluster's CPU request. |
39
+ | kube.cluster.memory.limit | float | megabyte | The cluster's memory limit. |
40
+ | kube.cluster.memory.request | float | megabyte | The cluster's memory request. |
41
+ | kube.node.cpu.capacity| float | millicpu | The node's CPU capacity. |
42
+ | kube.node.cpu.allocatable | float | millicpu | The node's allocatable CPU . |
43
+ | kube.node.memory.capacity | float | megabyte | The node's memory capacity. |
44
+ | kube.node.memory.allocatable | float | megabyte | The node's allocatable memory. |
45
+ | kube.node.cpu.reservation | float | millicpu | The node's CPU reservation. |
46
+ | kube.node.cpu.utilization | float | millicpu | The node's CPU utilization. |
47
+ | kube.node.memory.reservation | float | megabyte | The node's memory reservation. |
48
+ | kube.node.memory.utilization | float | megabyte | The node's memory utilization. |
49
+ | kube.namespace.cpu.usage | float | millicpu | The namespace's CPU usage. |
50
+ | kube.namespace.memory.usage | float | megabyte | The namespace's memory usage. |
51
+ | kube.cluster.cpu.usage | float | millicpu | The cluster's CPU usage. |
52
+ | kube.cluster.memory.usage | float | bytes | The cluster's memory usage. |
53
+ | kube.node.runtime | | | |
54
+
55
+ ## Summary Metrics
56
+
57
+ Provides metrics as a sum of all observed values.
58
+
59
+ | Metric Name | Metric Type | Metric Format | Metric Description |
60
+ | --- | --- | --- | --- |
61
+ | kube.node.uptime | float | seconds | The node uptime. |
62
+ | kube.node.cpu.usage_rate | float | millicpu | Total CPU usage (sum of all cores) averaged over the sample window. |
63
+ | kube.node.cpu.usage | float | nanocpu | Total CPU usage (sum of all cores) averaged over the sample window. |
64
+ | kube.node.memory.available_bytes | float | bytes | The node available memory for use in bytes. |
65
+ | kube.node.memory.usage_bytes | float | bytes | The node memory in use in bytes. |
66
+ | kube.node.memory.rss_bytes | float | bytes | The amount of anonymous and swap cache memory in bytes in the node. |
67
+ | kube.node.memory.page_faults | integer | | The cumulative number of minor page faults in the node. |
68
+ | kube.node.memory.major_page_faults | integer | | The cumulative number of major page faults in the node. |
69
+ | kube.node.network.rx_bytes | float | bytes | The cumulative count of bytes received in the node. |
70
+ | kube.node.network.rx_errors | integer | | The cumulative count of receive errors encountered in the node. |
71
+ | kube.node.network.tx_bytes | float | bytes | The cumulative count of bytes transmitted in the node. |
72
+ | kube.node.network.tx_errors | integer | | The cumulative count of transmit errors encountered in the node. |
73
+ | kube.node.fs.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem on the node. |
74
+ | kube.node.fs.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystem's underlying storage on the node. |
75
+ | kube.node.fs.used_bytes | float | bytes | The bytes used for a specific task on the filesystem on the node. |
76
+ | kube.node.fs.inodes_free | integer | | The free inodes in the filesystem on the node. |
77
+ | kube.node.fs.inodes | integer | | The total inodes in the filesystem on the node. |
78
+ | kube.node.fs.inodes_used | integer | | The inodes used by the filesystem on the node. |
79
+ | kube.node.imagefs.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem on the node. |
80
+ | kube.node.imagefs.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystems underlying storage on the node. |
81
+ | kube.node.imagefs.used_bytes | float | bytes | The bytes used for a specific task on the filesystem on the node. |
82
+ | kube.node.imagefs.inodes_free | integer | | The free inodes in the filesystem on the node. |
83
+ | kube.node.imagefs.inodes | integer | | The free inodes in the filesystem on the node. |
84
+ | kube.node.imagefs.inodes_used | integer | | The free inodes in the filesystem on the node. |
85
+ | kube.node.runtime.imagefs.maxpid | integer | | The max PID for the OS. |
86
+ | kube.node.runtime.imagefs.curproc | integer | | The number of running process in the OS. |
87
+ | kube.sys-container.uptime | float | seconds | The sys-container uptime. |
88
+ | kube.sys-container.cpu.usage_rate | float | millicpu | Total CPU usage (sum of all cores) averaged over the sample window for sys-container. |
89
+ | kube.sys-container.cpu.usage | float | millicpu | Total CPU usage rate (sum of all cores) averaged over the sample window for sys-container. |
90
+ | kube.sys-container.memory.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem for sys-container. |
91
+ | kube.sys-container.memory.usage_bytes | float | bytes | The node memory, in bytes, in use for the sys-container. |
92
+ | kube.sys-container.memory.rss_bytes | float | bytes | The amount of anonymous and swap cache memory, in bytes, for the sys-container. |
93
+ | kube.sys-container.memory.rss_bytes | float | bytes | The amount of anonymous and swap cache memory, in bytes, for the sys-container. |
94
+ | kube.sys-container.memory.page_faults | integer | | The cumulative number of minor page faults for the sys-container. |
95
+ | kube.sys-container.memory.major_page_faults | integer | | The cumulative number of major page faults for the sys-container. |
96
+ | kube.pod.uptime | float | seconds | The pod's uptime. |
97
+ | kube.pod.cpu.usage_rate | float | millicpu | Total CPU usage (sum of all cores), averaged over the sample window for the pod. |
98
+ | kube.pod.cpu.usage | float | nanocpu | Total CPU usage rate (sum of all cores), averaged over the sample window for the pod. |
99
+ | kube.pod.memory.available_bytes | float | bytes | Represents the storage space available, in bytes, for the filesystem on the pod. |
100
+ | kube.pod.memory.usage_bytes | float | bytes | The bytes used for a specific task in the filesystem on the pod. |
101
+ | kube.pod.memory.rss_bytes | float | bytes | The amount of anonymous and swap cache memory, in bytes, in the pod. |
102
+ | kube.pod.memory.page_faults | integer | | The cumulative number of minor page faults in the pod. |
103
+ | kube.pod.memory.major_page_faults | integer | | The cumulative number of minor page faults in the pod. |
104
+ | kube.pod.network.rx_bytes | float | bytes | The cumulative count of bytes received in the pod. |
105
+ | kube.pod.network.rx_errors | integer | | The cumulative count of receive errors encountered in the pod. |
106
+ | kube.pod.network.tx_bytes | float | bytes | The cumulative count of bytes transmitted in the pod. |
107
+ | kube.pod.network.tx_errors | integer | | The cumulative count of transmit errors in the pod. |
108
+ | kube.pod.ephemeral-storage.available_bytes | float | bytes | The node's available memory for use, in bytes, in the pod's ephemeral storage. |
109
+ | kube.pod.ephemeral-storage.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystem's underlying storage in the pod's ephemeral storage. |
110
+ | kube.pod.ephemeral-storage.used_bytes | float | bytes | The bytes used for a specific task on the filesystem in the pod's ephemeral storage. |
111
+ | kube.pod.ephemeral-storage.inodes_free |integer | | The free inodes in the filesystem in the pod's ephemeral storage. |
112
+ | kube.pod.ephemeral-storage.inodes | integer | | The inodes in the filesystem in the pod's ephemeral storage. |
113
+ | kube.pod.ephemeral-storage.inodes_used | integer | | The inodes used in the filesystem in the pod's ephemeral storage. |
114
+ | kube.pod.volume.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem in the pod's volume. |
115
+ | kube.pod.volume.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystems underlying storage for the pod's volume. |
116
+ | kube.pod.volume.used_bytes | float | bytes | The bytes used for a specific task on the filesystem for the pod's volume. |
117
+ | kube.pod.volume.inodes_free | integer | | The free inodes in the filesystem for the pod's volume. |
118
+ | kube.pod.volume.inodes | integer | | The inodes in the filesystem for the pod's volume. |
119
+ | kube.pod.volume.inodes_used | integer | | The used inodes in the filesystem for the pod's volume. |
120
+ | kube.container.uptime | float | seconds | The container's uptime. |
121
+ | kube.container.cpu.usage_rate | float | millicpu | Total CPU usage rate (sum of all cores) averaged over the sample window for the container. |
122
+ | kube.container.cpu.usage | float | nanocpu | Total CPU usage rate (sum of all cores) averaged over the sample window
123
+ for the container. |
124
+ | kube.container.memory.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem in the container. |
125
+ | kube.container.memory.usage_bytes | float | bytes | The bytes used for a specific task on the filesystem in the container. |
126
+ | kube.container.memory.rss_bytes | float | bytes | The amount of anonymous and swap cache memory in bytes in the container. |
127
+ | kube.container.memory.page_faults | integer | | The cumulative number of minor page faults in the container. |
128
+ | kube.container.memory.major_page_faults | integer | | The cumulative number of major page faults in the container. |
129
+ | kube.container.rootfs.available_bytes | float | bytes | The storage space available, in bytes, in the filesystem in the container's rootfs. |
130
+ | kube.container.rootfs.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystem's underlying storage in the container's rootfs. |
131
+ | kube.container.rootfs.used_bytes | float | bytes | The bytes used for a specific task in the filesystem on the container's rootfs. |
132
+ | kube.container.rootfs.inodes_free | integer | | The free inodes in the filesystem on the container's rootfs. |
133
+ | kube.container.rootfs.inodes | integer | | The inodes in the filesystem on the container's rootfs. |
134
+ | kube.container.rootfs.inodes_used | integer | | Represents the used inodes in the filesystem on the container's rootfs. |
135
+ | kube.container.logs.available_bytes | float | bytes | The storage space available, in bytes, for the filesystem on the container's logs. |
136
+ | kube.container.logs.capacity_bytes | float | bytes | The total capacity, in bytes, of the filesystem's underlying storage in the container's logs. |
137
+ | kube.container.logs.used_bytes | float | bytes | The bytes used for a specific task on the filesystem in the container's logs. |
138
+ | kube.container.logs.inodes_free | integer | | The free inodes in the filesystem in the container's logs. |
139
+ | kube.container.logs.inodes | integer | | The inodes in the filesystem in the container's logs. |
140
+ | kube.container.logs.inodes_used | integer | | The used inodes in the filesystem in the container's logs. |
141
+
142
+
143
+ ## Stats Metrics
144
+
145
+ Metrics based on measures and recording of data points and views.
146
+
147
+
148
+ | Metric Name | Metric Type | Metric Format | Metric Description |
149
+ | --- | --- | --- | --- |
150
+ | kube.node.cpu.cfs.periods | ThrottlingData | uint64 | CPU Completely Fair Scheduler statistics. Total number of elapsed enforcement intervals. |
151
+ | kube.node.cpu.cfs.throttled_periods | ThrottlingData | uint64 | CPU Completely Fair Scheduler statistics. Total number of times tasks in the cgroup have been throttled. |
152
+ | kube.node.cpu.cfs.throttled_time | ThrottlingData | uint64 | CPU Completely Fair Scheduler statistics. Total time duration, in nanoseconds, for which tasks in the cgroup have been throttled. |
153
+ | kube.node.cpu.usage.total | CPUUsage | uint64 | CPU usage time statistics in nanoseconds. |
154
+ | per_cpu_usage | CPUUsage | uint64 | CPU usage time statistics. Per CPU/core usage of the container in nanoseconds. |
155
+ | kube.node.cpu.usage.user | CPUUsage | uint64 | CPU usage time statistics. Time spent in user space in nanoseconds. |
156
+ | kube.node.cpu.usage.system | CPUUsage | uint64 | CPU usage time statistics. Time spent in kernel space in nanoseconds. |
157
+ | kube.node.cpu.load_average | | | Smoothed average of number of runnable threads x 1000. Splunk software multiplies by a thousand to avoid using floats while preserving precision. Load is smoothed over the last 10 seconds. Instantaneous value can be read from LoadStats.NrRunning. |
158
+ | kube.node.cpu.schedstat.run_time | | | The CPU Aggregated scheduler statistics, time spent on the CPU. |
159
+ | kube.node.cpu.schedstat.runqueue_time | | | The CPU Aggregated scheduler statistics, time spent waiting on a runqueue. |
160
+ | kube.node.cpu.schedstat.run_periods | | | The CPU Aggregated scheduler statistics, number of timeslices run on the CPU reservation. |
161
+ | kube.node.diskio.<disk_category>.stats.Async | | | |
162
+ | kube.node.diskio.<disk_category>.stats.Read | | | |
163
+ | kube.node.diskio.<disk_category>.Sync | | | |
164
+ | kube.node.diskio.<disk_category>.stats.Total | | | |
165
+ | kube.node.diskio.<disk_category>.stats.Write | | | |
166
+ | kube.node.diskio.<disk_category>.minor | | | |
167
+ | kube.node.diskio.<disk_category>.major | | | |
168
+ | kube.node.filesystem.available | | bytes | The bytes available for non-root user. |
169
+ | kube.node.filesystem.base_usage | integer | | Base usage consumed by the container's writable layer. At this time, this value is only applicable for Docker containers. |
170
+ | kube.node.filesystem.capacity | | bytes | Bytes that can be consumed by the container on this filesystem. |
171
+ | kube.node.filesystem.inodes | integer | | Number of inodes. |
172
+ | kube.node.filesystem.inodes_free | integer | | Number of available inodes. |
173
+ | kube.node.filesystem.io_in_progress | integer | | Number of I/Os currently in progress. It is the only field that should go to zero. Value is incremented as requests are given to appropriate struct request_queue and decremented as they finish. |
174
+ | kube.node.filesystem.io_time | | | Number of milliseconds spent doing I/Os. This field increases so long as field 9 is nonzero. |
175
+ | kube.node.filesystem.read_time | | | Number of milliseconds spent reading, total number of milliseconds spent by all reads (as measured from make_request() to end_that_request_last()). |
176
+ | kube.node.filesystem.reads_completed | | integer | The total number of reads completed successfully. |
177
+ | kube.node.filesystem.reads_merged | | integer | Number of reads merged. Reads and writes which are adjacent to each other and may be merged for efficiency. For example, two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O. This field lets you know how often this was done. |
178
+ | kube.node.filesystem.sectors_read | | integer | Total number of successfully read sectors. |
179
+ | kube.node.filesystem.sectors_written | | integer| The total number of successfully written sectors. |
180
+ | kube.node.filesystem.usage | | bytes | Number of bytes consumed by the container on this filesystem. |
181
+ | kube.node.filesystem.weighted_io_time | | | Weighted number of milliseconds spent doing I/Os. This field is incremented at each I/O start, I/O completion, I/O merge. Or the field can read these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field. This can provide an easy measure of both I/O completion time and of the backlog that may be accumulating. |
182
+ | kube.node.filesystem.write_time | | | Total number of milliseconds spent by all writes, as measured from make_request() to end_that_request_last(). |
183
+ | kube.node.filesystem.writes_completed | integer | | Total number of writes completed successfully. |
184
+ | kube.node.filesystem.writes_merged | integer | | Number of writes merged. |
185
+ | kube.node.memory.cache | | bytes | Number of bytes of page cache memory in bytes. |
186
+ | kube.node.memory.container_data.pgfault | | | |
187
+ | kube.node.memory.container_data.pgmajfault | | | |
188
+ | kube.node.memory.failcnt | | | |
189
+ | kube.node.memory.hierarchical_data.pgfault | | | |
190
+ | kube.node.memory.hierarchical_data.pgmajfault | | | |
191
+ | kube.node.memory.max_usage | | bytes | Maximum memory usage recorded in bytes. |
192
+ | kube.node.memory.rss | | bytes | The amount of anonymous and swap cache memory, including transparent hugepages, in bytes. |
193
+ | kube.node.memory.swap | | bytes | The amount of swap, in bytes, currently used by the processes in this cgroup. |
194
+ | kube.node.memory.usage | | bytes | Current memory usage, in bytes. This includes all memory regardless of when it was accessed. |
195
+ | kube.node.memory.working_set | | | The amount of working set memory, in bytes. This includes recently accessed memory, dirty memory, and kernel memory. Working set is <= "usage". |
196
+ | kube.node.memory.mapped_file | | | |
197
+ | kube.node.tasks_stats.nr_io_wait | integer | | Number of tasks waiting on IO. |
198
+ | kube.node.tasks_stats.nr_running | integer | | Number of running tasks. |
199
+ | kube.node.tasks_stats.nr_sleeping | integer | | Number of sleeping tasks. |
200
+ | kube.node.tasks_stats.nr_stopped | integer | | Number of tasks in stopped state. |
201
+ | kube.node.tasks_stats.nr_uninterruptible | integer | | Number of tasks in uninterruptible state. |
202
+ | kube.node.network.<interface_id>.rx_bytes | | bytes | Cumulative count of bytes received. |
203
+ | kube.node.network.<interface_id>.rx_dropped | | | Cumulative count of packets dropped while receiving. |
204
+ | kube.node.network.<interface_id>.rx_errors | | | Cumulative count of receive errors encountered. |
205
+ | kube.node.network.<interface_id>.rx_packets | | | Cumulative count of packets received. |
206
+ | kube.node.network.<interface_id>.tx_bytes | | | Cumulative count of bytes transmitted. |
207
+ | kube.node.network.<interface_id>.tx_dropped | | | Cumulative count of packets dropped while transmitting. |
208
+ | kube.node.network.<interface_id>.tx_errors | | | Cumulative count of transmit errors encountered. |
209
+ | kube.node.network.<interface_id>.tx_packets | | | Cumulative count of packets transmitted. |
210
+
211
+ ## cAdvisor Metrics
212
+
213
+ Performance and usage information for running containers.
214
+
215
+ | Metric Name | Metric Description |
216
+ | --- | --- |
217
+ | cadvisor_version_info | A metric with a constant "1" value labeled by kernel version, OS version, Docker version, cAdvisor version and cAdvisor revision. |
218
+ | container_cpu_load_average_10s | Value of container CPU load average over the last 10 seconds. |
219
+ | container_cpu_system_seconds_total | Cumulative system CPU time consumed in seconds. |
220
+ | container_cpu_usage_seconds_total | Cumulative CPU time consumed in seconds. |
221
+ | container_cpu_user_seconds_total | Cumulative user CPU time consumed in seconds. |
222
+ | container_fs_inodes_free | Number of available inodes. |
223
+ | container_fs_inodes_total | Number of inodes in use. |
224
+ | container_fs_io_current | Number of in progress I/Os. |
225
+ | container_fs_io_time_seconds_total | Cumulative count of seconds spent doing I/Os. |
226
+ | container_fs_io_time_weighted_seconds_total | Cumulative weighted I/O time in seconds. |
227
+ | container_fs_limit_bytes | Number of bytes that can be consumed by the container on this filesystem. |
228
+ | container_fs_read_seconds_total | Cumulative count of seconds spent reading. |
229
+ | container_fs_reads_bytes_total | Cumulative count of bytes read. |
230
+ | container_fs_reads_merged_total | Cumulative count of reads merged. |
231
+ | container_fs_reads_total | Cumulative count of reads completed. |
232
+ | container_fs_sector_reads_total | Cumulative count of sector writes completed. |
233
+ | container_fs_sector_writes_total | Number of bytes that are consumed by the container on this filesystem. |
234
+ | container_fs_usage_bytes | Cumulative count of seconds spent writing. |
235
+ | container_fs_write_seconds_total | Cumulative count of bytes written. |
236
+ | container_fs_writes_bytes_total | Cumulative count of writes merged. |
237
+ | container_fs_writes_merged_total | Cumulative count of writes completed. |
238
+ | container_fs_writes_total | Last time a container was seen by the exporter. |
239
+ | container_last_seen | Last time a container was seen by the exporter. |
240
+ | container_memory_cache | Number of bytes of page cache memory. |
241
+ | container_memory_failcnt | Number of memory usage hits limits. |
242
+ | container_memory_failures_total | Cumulative count of memory allocation failures. |
243
+ | container_memory_max_usage_bytes | Maximum memory usage recorded in bytes. |
244
+ | container_memory_rss | Size of RSS in bytes. |
245
+ | container_memory_swap | Container swap usage in bytes. |
246
+ | container_memory_usage_bytes | Current memory usage in bytes, including all memory regardless of when it was accessed. |
247
+ | container_memory_working_set_bytes | Current working set in bytes. |
248
+ | container_network_receive_bytes_total | Cumulative count of bytes received. |
249
+ | container_network_receive_errors_total | Cumulative count of errors encountered while receiving. |
250
+ | container_network_receive_packets_dropped_total | Cumulative count of packets dropped while receiving. |
251
+ | container_network_receive_packets_total | Cumulative count of packets received. |
252
+ | container_network_tcp_usage_total | tcp connection usage statistic for container. |
253
+ | container_network_transmit_bytes_total | Cumulative count of bytes transmitted. |
254
+ | container_network_transmit_errors_total | Cumulative count of errors encountered while transmitting. |
255
+ | container_network_transmit_packets_dropped_total | Cumulative count of packets dropped while transmitting. |
256
+ | container_network_transmit_packets_total | Cumulative count of packets transmitted. |
257
+ | container_network_udp_usage_total | UDP connection usage statistic for container. |
258
+ | container_scrape_error | "1" indicates an error while getting container metrics, "0" indicates no error. |
259
+ | container_spec_cpu_period | CPU period of the container. |
260
+ | container_spec_cpu_shares | CPU share of the container. |
261
+ | container_spec_memory_limit_bytes | Memory limit for the container. |
262
+ | container_spec_memory_reservation_limit_bytes | Memory reservation limit for the container. |
263
+ | container_spec_memory_swap_limit_bytes | Memory swap limit for the container. |
264
+ | container_start_time_seconds | Start time of the container since Unix epoch in seconds. |
265
+ | container_tasks_state | Number of tasks in given state. |
266
+ | machine_cpu_cores | Number of CPU cores on the machine. |
267
+ | machine_memory_bytes | Amount of memory installed on the machine. |
268
+ | container_cpu_cfs_throttled_seconds_total | Total time that the container has been throttled. |
269
+
data/test/helper.rb ADDED
@@ -0,0 +1,151 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ $LOAD_PATH.unshift(File.expand_path('..', __dir__))
5
+ require 'test-unit'
6
+ require 'fluent/test'
7
+ require 'fluent/test/driver/input'
8
+ require 'fluent/test/helpers'
9
+ require 'webmock/test_unit'
10
+
11
+ # require "minitest/autorun"
12
+ # require "webmock/minitest"
13
+
14
+ Test::Unit::TestCase.include(Fluent::Test::Helpers)
15
+ Test::Unit::TestCase.extend(Fluent::Test::Helpers)
16
+
17
+ # WebMock.allow_net_connect!
18
+
19
+ module PluginTestHelper
20
+ def k8s_host
21
+ 'generics-aws-node-name'
22
+ end
23
+
24
+ def k8s_port
25
+ '10255'
26
+ end
27
+
28
+ def k8s_url(path = 'api')
29
+ "https://#{k8s_host}:#{k8s_port}/#{path}"
30
+ end
31
+
32
+ def kubelet_summary_api_url
33
+ 'http://generics-aws-node-name:10255/stats/summary'
34
+ end
35
+
36
+ def kubelet_stats_api_url
37
+ 'http://generics-aws-node-name:10255/stats'
38
+ end
39
+
40
+ def kubelet_cadvisor_api_url
41
+ 'http://generics-aws-node-name:10255/metrics/cadvisor'
42
+ end
43
+
44
+ def stub_k8s_requests
45
+ ENV['KUBERNETES_SERVICE_HOST'] = k8s_host
46
+ ENV['KUBERNETES_SERVICE_PORT'] = k8s_port
47
+ # all stub response bodies are from real k8s 1.8 API calls
48
+ stub_k8s_api
49
+ stub_k8s_v1
50
+ stub_kubelet_summary_api
51
+ stub_k8s_proxy_summary_api
52
+ stub_metrics_cadvisor
53
+ stub_k8s_proxy_cadvisor_api
54
+ stub_metrics_stats
55
+ stub_metrics_proxy_stats
56
+ end
57
+
58
+ def stub_k8s_proxy_summary_api
59
+ open(File.expand_path('unit.json', __dir__)).tap do |f|
60
+ stub_request(:get, "#{k8s_url}/v1/nodes/generics-aws-node-name:10255/proxy/stats/summary")
61
+ .to_return(body: f.read)
62
+ end.close
63
+ end
64
+
65
+ def stub_k8s_api
66
+ open(File.expand_path('api.json', __dir__)).tap do |f|
67
+ stub_request(:get, k8s_url)
68
+ .to_return(body: f.read)
69
+ end.close
70
+ end
71
+
72
+ def stub_k8s_v1
73
+ open(File.expand_path('v1.json', __dir__)).tap do |f|
74
+ stub_request(:get, "#{k8s_url}/v1")
75
+ .to_return(body: f.read)
76
+ end.close
77
+ end
78
+
79
+ def stub_kubelet_summary_api
80
+ open(File.expand_path('unit.json', __dir__)).tap do |f|
81
+ stub_request(:get, kubelet_summary_api_url.to_s)
82
+ .to_return(body: f.read)
83
+ end.close
84
+ end
85
+
86
+ def stub_kubelet_summary_api_missing_timestamps
87
+ open(File.expand_path('unit_without_time.json', __dir__)).tap do |f|
88
+ stub_request(:get, kubelet_summary_api_url.to_s)
89
+ .to_return(body: f.read)
90
+ end.close
91
+ end
92
+
93
+ def stub_metrics_cadvisor
94
+ open(File.expand_path('metrics_cadvisor.txt', __dir__)).tap do |f|
95
+ stub_request(:get, kubelet_cadvisor_api_url.to_s)
96
+ .to_return(body: f.read)
97
+ end.close
98
+ end
99
+
100
+ def stub_k8s_proxy_cadvisor_api
101
+ open(File.expand_path('metrics_cadvisor.txt', __dir__)).tap do |f|
102
+ stub_request(:get, "#{k8s_url}/v1/nodes/generics-aws-node-name:10255/proxy/metrics/cadvisor")
103
+ .to_return(body: f.read)
104
+ end.close
105
+ end
106
+
107
+ def stub_metrics_stats
108
+ open(File.expand_path('stats.json', __dir__)).tap do |f|
109
+ stub_request(:get, kubelet_stats_api_url.to_s)
110
+ .to_return(body: f.read)
111
+ end.close
112
+ end
113
+
114
+ def stub_metrics_proxy_stats
115
+ open(File.expand_path('stats.json', __dir__)).tap do |f|
116
+ stub_request(:get, "#{k8s_url}/v1/nodes/generics-aws-node-name:10255/proxy/stats")
117
+ .to_return(body: f.read)
118
+ end.close
119
+ end
120
+
121
+ def get_unit_parsed_string
122
+ parsed_string = nil
123
+ open(File.expand_path('unit.json', __dir__)).tap do |f|
124
+ parsed_string = f.read
125
+ end.close
126
+ parsed_string
127
+ end
128
+
129
+ def get_unit_parsed_string_missing_timestamps
130
+ parsed_string = nil
131
+ open(File.expand_path('unit_without_time.json', __dir__)).tap do |f|
132
+ parsed_string = f.read
133
+ end.close
134
+ parsed_string
135
+ end
136
+
137
+ def get_stats_parsed_string
138
+ get_stats_parsed_string = nil
139
+ open(File.expand_path('stats.json', __dir__)).tap do |f|
140
+ get_stats_parsed_string = f.read
141
+ end.close
142
+ get_stats_parsed_string
143
+ end
144
+
145
+ def generate_tag(item_name, tag)
146
+ tag_prefix, tag_suffix = tag.split('*') if tag.include?('*')
147
+ return tag unless tag_prefix
148
+
149
+ [tag_prefix, item_name, tag_suffix].join
150
+ end
151
+ end