aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md120
-rw-r--r--src/stats_task.rs30
2 files changed, 95 insertions, 55 deletions
diff --git a/README.md b/README.md
index 198dcb0..2cee206 100644
--- a/README.md
+++ b/README.md
@@ -80,61 +80,71 @@ is listed below ("N/A" if there are none).
The list of ContainerSpy's currently supported items from this list is:
-| Name | Has metric-specific labels | Notes |
-|----------------------------------------------------|----------------------------|-------------------------|
-| `container_cpu_usage_seconds_total` | | |
-| `container_cpu_user_seconds_total` | | |
-| `container_cpu_system_seconds_total` | | |
-| `container_cpu_cfs_periods_total` | | |
-| `container_cpu_cfs_throttled_periods_total` | | |
-| `container_cpu_cfs_throttled_seconds_total` | | |
-| `container_fs_reads_bytes_total` | | Not reported on Windows |
-| `container_fs_writes_bytes_total` | | Not reported on Windows |
-| `container_last_seen` | | |
-| `container_network_receive_bytes_total` | `interface` | |
-| `container_network_receive_errors_total` | `interface` | Not reported on Windows |
-| `container_network_receive_packets_dropped_total` | `interface` | |
-| `container_network_receive_packets_total` | `interface` | |
-| `container_network_transmit_bytes_total` | `interface` | |
-| `container_network_transmit_errors_total` | `interface` | Not reported on Windows |
-| `container_network_transmit_packets_dropped_total` | `interface` | |
-| `container_network_transmit_packets_total` | `interface` | |
+| Name | Has metric-specific labels | Notes |
+|----------------------------------------------------|----------------------------|--------------------------------|
+| `container_cpu_usage_seconds_total` | | |
+| `container_cpu_user_seconds_total` | | |
+| `container_cpu_system_seconds_total` | | |
+| `container_cpu_cfs_periods_total` | | |
+| `container_cpu_cfs_throttled_periods_total` | | |
+| `container_cpu_cfs_throttled_seconds_total` | | |
+| `container_fs_reads_bytes_total` | | Not reported on Windows (TODO) |
+| `container_fs_writes_bytes_total` | | Not reported on Windows (TODO) |
+| `container_last_seen` | | |
+| `container_network_receive_bytes_total` | `interface` | |
+| `container_network_receive_errors_total` | `interface` | Not reported on Windows |
+| `container_network_receive_packets_dropped_total` | `interface` | |
+| `container_network_receive_packets_total` | `interface` | |
+| `container_network_transmit_bytes_total` | `interface` | |
+| `container_network_transmit_errors_total` | `interface` | Not reported on Windows |
+| `container_network_transmit_packets_dropped_total` | `interface` | |
+| `container_network_transmit_packets_total` | `interface` | |
+| `container_start_time_seconds` | | |
The list of known omitted metrics are:
-| Name | Reason |
-|--------------------------------------------------|-----------------------------------|
-| `container_cpu_load_average_10s` | Not reported by Docker Engine API |
-| `container_cpu_schedstat_run_periods_total` | Not reported by Docker Engine API |
-| `container_cpu_schedstat_runqueue_seconds_total` | Not reported by Docker Engine API |
-| `container_cpu_schedstat_run_seconds_total` | Not reported by Docker Engine API |
-| `container_file_descriptors` | Not reported by Docker Engine API |
-| `container_fs_inodes_free` | Not reported by Docker Engine API |
-| `container_fs_inodes_total` | Not reported by Docker Engine API |
-| `container_fs_io_current` | Not reported by Docker Engine API |
-| `container_fs_io_time_seconds_total` | Only reported on cgroups v1 hosts |
-| `container_fs_io_time_weighted_seconds_total` | Not reported by Docker Engine API |
-| `container_fs_limit_bytes` | Not reported by Docker Engine API |
-| `container_fs_read_seconds_total` | Only reported on cgroups v1 hosts |
-| `container_fs_reads_merged_total` | Only reported on cgroups v1 hosts |
-| `container_fs_reads_total` | Not reported by Docker Engine API |
-| `container_fs_sector_reads_total` | Only reported on cgroups v1 hosts |
-| `container_fs_write_seconds_total` | Only reported on cgroups v1 hosts |
-| `container_fs_writes_merged_total` | Only reported on cgroups v1 hosts |
-| `container_fs_writes_total` | Not reported by Docker Engine API |
-| `container_fs_sector_writes_total` | Only reported on cgroups v1 hosts |
-| `container_fs_usage_bytes` | Requires SystemDataUsage API |
-| `container_hugetlb_failcnt` | Not reported by Docker Engine API |
-| `container_hugetlb_max_usage_bytes` | Not reported by Docker Engine API |
-| `container_hugetlb_usage_bytes` | Not reported by Docker Engine API |
-| `container_llc_occupancy_bytes` | Not reported by Docker Engine API |
-| `container_memory_bandwidth_bytes` | Not reported by Docker Engine API |
-| `container_memory_bandwidth_local_bytes` | Not reported by Docker Engine API |
-| ... | |
-| `container_memory_max_usage_bytes` | Only reported on cgroups v1 hosts |
-| ... | |
-| `container_network_advance_tcp_stats_total` | Not reported by Docker Engine API |
-| `container_network_tcp6_usage_total` | Not reported by Docker Engine API |
-| `container_network_tcp_usage_total` | Not reported by Docker Engine API |
-| `container_network_udp6_usage_total` | Not reported by Docker Engine API |
-| `container_network_udp_usage_total` | Not reported by Docker Engine API |
+| Name | Reason |
+|--------------------------------------------------|-------------------------------------------------------------|
+| `container_cpu_load_average_10s` | Not reported by Docker Engine API |
+| `container_cpu_schedstat_run_periods_total` | Not reported by Docker Engine API |
+| `container_cpu_schedstat_runqueue_seconds_total` | Not reported by Docker Engine API |
+| `container_cpu_schedstat_run_seconds_total` | Not reported by Docker Engine API |
+| `container_file_descriptors` | Not reported by Docker Engine API |
+| `container_fs_inodes_free` | Not reported by Docker Engine API |
+| `container_fs_inodes_total` | Not reported by Docker Engine API |
+| `container_fs_io_current` | Not reported by Docker Engine API |
+| `container_fs_io_time_seconds_total` | Only reported on cgroups v1 hosts |
+| `container_fs_io_time_weighted_seconds_total` | Not reported by Docker Engine API |
+| `container_fs_limit_bytes` | Not reported by Docker Engine API |
+| `container_fs_read_seconds_total` | Only reported on cgroups v1 hosts |
+| `container_fs_reads_merged_total` | Only reported on cgroups v1 hosts |
+| `container_fs_reads_total` | Not reported by Docker Engine API |
+| `container_fs_sector_reads_total` | Only reported on cgroups v1 hosts |
+| `container_fs_write_seconds_total` | Only reported on cgroups v1 hosts |
+| `container_fs_writes_merged_total` | Only reported on cgroups v1 hosts |
+| `container_fs_writes_total` | Not reported by Docker Engine API |
+| `container_fs_sector_writes_total` | Only reported on cgroups v1 hosts |
+| `container_fs_usage_bytes` | Requires SystemDataUsage API |
+| `container_hugetlb_failcnt` | Not reported by Docker Engine API |
+| `container_hugetlb_max_usage_bytes` | Not reported by Docker Engine API |
+| `container_hugetlb_usage_bytes` | Not reported by Docker Engine API |
+| `container_llc_occupancy_bytes` | Not reported by Docker Engine API |
+| `container_memory_bandwidth_bytes` | Not reported by Docker Engine API |
+| `container_memory_bandwidth_local_bytes` | Not reported by Docker Engine API |
+| ... | |
+| `container_memory_max_usage_bytes` | Only reported on cgroups v1 hosts |
+| ... | |
+| `container_network_advance_tcp_stats_total` | Not reported by Docker Engine API |
+| `container_network_tcp6_usage_total` | Not reported by Docker Engine API |
+| `container_network_tcp_usage_total` | Not reported by Docker Engine API |
+| `container_network_udp6_usage_total` | Not reported by Docker Engine API |
+| `container_network_udp_usage_total` | Not reported by Docker Engine API |
+| `container_oom_events_total` | Not reported by Docker Engine API |
+| `container_perf_*`, `container_uncore_perf_*` | Not reported by Docker Engine API |
+| `container_processes` | Not reported by Docker Engine API (only threads, not procs) |
+| `container_referenced_bytes` | Collection affects paging and causes mem latency |
+| `container_sockets` | Not reported by Docker Engine API |
+| `container_spec_*` | Not reported by Docker Engine API |
+| `container_tasks_state` | Not reported by Docker Engine API |
+| `container_ulimits_soft` | Not reported by Docker Engine API |
+| `machine_*` | Out of scope, liable to be incorrect when containerised | \ No newline at end of file
diff --git a/src/stats_task.rs b/src/stats_task.rs
index f3144a7..a687a37 100644
--- a/src/stats_task.rs
+++ b/src/stats_task.rs
@@ -179,6 +179,21 @@ pub fn launch_stats_task(
let meter_container_network_transmit_packets_total = meter
.u64_counter("container_network_transmit_packets_total")
.with_description("Cumulative count of packets transmitted")
+ .build();;
+
+ let meter_container_start_time_seconds = meter
+ .u64_gauge("container_start_time_seconds")
+ .with_unit("s")
+ .with_description("Start time of the container since unix epoch")
+ .build();
+
+ let meter_container_threads = meter
+ .u64_gauge("container_threads")
+ .with_description("Number of threads running inside the container")
+ .build();
+ let meter_container_threads_max = meter
+ .u64_gauge("container_threads_max")
+ .with_description("Maximum number of threads allowed inside the container")
.build();
while let Some(val) = stats_stream.next().await {
@@ -258,6 +273,7 @@ pub fn launch_stats_task(
last_io_stats = Some(service_bytes_rec);
}
+ // TODO: handle windows storage stats
meter_container_last_seen.record(
SystemTime::now()
@@ -356,6 +372,20 @@ pub fn launch_stats_task(
}
}
last_net_stats = stats.networks;
+
+ if let Some(pid_count) = stats.pids_stats.current {
+ // pid_count is generally the *thread* count.
+ meter_container_threads.record(pid_count, shared_labels);
+ }
+ if let Some(pid_limit) = stats.pids_stats.limit {
+ // pid_count is generally the *thread* count.
+ meter_container_threads_max.record(pid_limit, shared_labels);
+ }
+
+ if let Some(Ok(secs)) = container.created.map(u64::try_from) {
+ //let date = UNIX_EPOCH + Duration::from_nanos(secs);
+ meter_container_start_time_seconds.record(secs, shared_labels);
+ }
} else {
// failed to get stats, log as such:
// TODO: use json logging or syslog so loki can understand this lol