@cryptotaxi247 / netdata-1 / commits / 7afe8ad49

proc/diskstats and diskspace: remove "ignore zero metrics" (#17775)

Ilya Mashchenko committed May 30, 2024 at 09:36 UTC 7afe8ad4958104a6b1c74772af71f9f710925380
2 files changed +18 -56
src/collectors/diskspace.plugin/plugin_diskspace.c
+2 -6
@@ -212,9 +212,7 @@ static void calculate_values_and_show_charts(
212
213 int rendered = 0;
214
215 - if(m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO &&
216 - (bavail || breserved_root || bused ||
217 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
215 + if (m->do_space == CONFIG_BOOLEAN_YES || m->do_space == CONFIG_BOOLEAN_AUTO) {
216 if(unlikely(!m->st_space) || m->st_space->update_every != update_every) {
217 m->do_space = CONFIG_BOOLEAN_YES;
218 m->st_space = rrdset_find_active_bytype_localhost("disk_space", disk);
@@ -252,9 +250,7 @@ static void calculate_values_and_show_charts(
250 rendered++;
251 }
252
255 - if(m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO &&
256 - (favail || freserved_root || fused ||
257 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
253 + if (m->do_inodes == CONFIG_BOOLEAN_YES || m->do_inodes == CONFIG_BOOLEAN_AUTO) {
254 if(unlikely(!m->st_inodes) || m->st_inodes->update_every != update_every) {
255 m->do_inodes = CONFIG_BOOLEAN_YES;
256 m->st_inodes = rrdset_find_active_bytype_localhost("disk_inodes", disk);
src/collectors/proc.plugin/proc_diskstats.c
+16 -50
@@ -1570,9 +1570,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1570
1571 // --------------------------------------------------------------------------
1572 // Do performance metrics
1573 - if(d->do_io == CONFIG_BOOLEAN_YES || (d->do_io == CONFIG_BOOLEAN_AUTO &&
1574 - (readsectors || writesectors || discardsectors ||
1575 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1573 + if (d->do_io == CONFIG_BOOLEAN_YES || d->do_io == CONFIG_BOOLEAN_AUTO) {
1574 d->do_io = CONFIG_BOOLEAN_YES;
1575
1576 last_readsectors = d->disk_io.rd_io_reads ? d->disk_io.rd_io_reads->collector.last_collected_value / SECTOR_SIZE : 0;
@@ -1614,9 +1612,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1612 rrdset_done(d->st_ext_io);
1613 }
1614
1617 - if(d->do_ops == CONFIG_BOOLEAN_YES || (d->do_ops == CONFIG_BOOLEAN_AUTO &&
1618 - (reads || writes || discards || flushes ||
1619 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1615 + if (d->do_ops == CONFIG_BOOLEAN_YES || d->do_ops == CONFIG_BOOLEAN_AUTO) {
1616 d->do_ops = CONFIG_BOOLEAN_YES;
1617
1618 if(unlikely(!d->st_ops)) {
@@ -1680,8 +1676,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1676 rrdset_done(d->st_ext_ops);
1677 }
1678
1683 - if(d->do_qops == CONFIG_BOOLEAN_YES || (d->do_qops == CONFIG_BOOLEAN_AUTO &&
1684 - (queued_ios || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1679 + if (d->do_qops == CONFIG_BOOLEAN_YES || d->do_qops == CONFIG_BOOLEAN_AUTO) {
1680 d->do_qops = CONFIG_BOOLEAN_YES;
1681
1682 if(unlikely(!d->st_qops)) {
@@ -1711,8 +1706,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1706 rrdset_done(d->st_qops);
1707 }
1708
1714 - if(d->do_backlog == CONFIG_BOOLEAN_YES || (d->do_backlog == CONFIG_BOOLEAN_AUTO &&
1715 - (backlog_ms || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1709 + if (d->do_backlog == CONFIG_BOOLEAN_YES || d->do_backlog == CONFIG_BOOLEAN_AUTO) {
1710 d->do_backlog = CONFIG_BOOLEAN_YES;
1711
1712 if(unlikely(!d->st_backlog)) {
@@ -1742,8 +1736,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1736 rrdset_done(d->st_backlog);
1737 }
1738
1745 - if(d->do_util == CONFIG_BOOLEAN_YES || (d->do_util == CONFIG_BOOLEAN_AUTO &&
1746 - (busy_ms || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1739 + if (d->do_util == CONFIG_BOOLEAN_YES || d->do_util == CONFIG_BOOLEAN_AUTO) {
1740 d->do_util = CONFIG_BOOLEAN_YES;
1741
1742 if(unlikely(!d->st_busy)) {
@@ -1803,9 +1796,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1796 rrdset_done(d->st_util);
1797 }
1798
1806 - if(d->do_mops == CONFIG_BOOLEAN_YES || (d->do_mops == CONFIG_BOOLEAN_AUTO &&
1807 - (mreads || mwrites || mdiscards ||
1808 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1799 + if (d->do_mops == CONFIG_BOOLEAN_YES || d->do_mops == CONFIG_BOOLEAN_AUTO) {
1800 d->do_mops = CONFIG_BOOLEAN_YES;
1801
1802 if(unlikely(!d->st_mops)) {
@@ -1867,8 +1858,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1858 rrdset_done(d->st_ext_mops);
1859 }
1860
1870 - if(d->do_iotime == CONFIG_BOOLEAN_YES || (d->do_iotime == CONFIG_BOOLEAN_AUTO &&
1871 - (readms || writems || discardms || flushms || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1861 + if (d->do_iotime == CONFIG_BOOLEAN_YES || d->do_iotime == CONFIG_BOOLEAN_AUTO) {
1862 d->do_iotime = CONFIG_BOOLEAN_YES;
1863
1864 if(unlikely(!d->st_iotime)) {
@@ -1936,13 +1926,8 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1926 // only if this is not the first time we run
1927
1928 if(likely(dt)) {
1939 - if( (d->do_iotime == CONFIG_BOOLEAN_YES || (d->do_iotime == CONFIG_BOOLEAN_AUTO &&
1940 - (readms || writems ||
1941 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) &&
1942 - (d->do_ops == CONFIG_BOOLEAN_YES || (d->do_ops == CONFIG_BOOLEAN_AUTO &&
1943 - (reads || writes ||
1944 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))) {
1945 -
1929 + if ((d->do_iotime == CONFIG_BOOLEAN_YES || d->do_iotime == CONFIG_BOOLEAN_AUTO) &&
1930 + (d->do_ops == CONFIG_BOOLEAN_YES || d->do_ops == CONFIG_BOOLEAN_AUTO)) {
1931 if(unlikely(!d->st_await)) {
1932 d->st_await = rrdset_create_localhost(
1933 "disk_await"
@@ -2010,11 +1995,8 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1995 rrdset_done(d->st_ext_await);
1996 }
1997
2013 - if( (d->do_io == CONFIG_BOOLEAN_YES || (d->do_io == CONFIG_BOOLEAN_AUTO &&
2014 - (readsectors || writesectors || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) &&
2015 - (d->do_ops == CONFIG_BOOLEAN_YES || (d->do_ops == CONFIG_BOOLEAN_AUTO &&
2016 - (reads || writes || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))) {
2017 -
1998 + if ((d->do_io == CONFIG_BOOLEAN_YES || d->do_io == CONFIG_BOOLEAN_AUTO) &&
1999 + (d->do_ops == CONFIG_BOOLEAN_YES || d->do_ops == CONFIG_BOOLEAN_AUTO)) {
2000 if(unlikely(!d->st_avgsz)) {
2001 d->st_avgsz = rrdset_create_localhost(
2002 "disk_avgsz"
@@ -2075,13 +2057,8 @@ int do_proc_diskstats(int update_every, usec_t dt) {
2057 rrdset_done(d->st_ext_avgsz);
2058 }
2059
2078 - if( (d->do_util == CONFIG_BOOLEAN_YES || (d->do_util == CONFIG_BOOLEAN_AUTO &&
2079 - (busy_ms ||
2080 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) &&
2081 - (d->do_ops == CONFIG_BOOLEAN_YES || (d->do_ops == CONFIG_BOOLEAN_AUTO &&
2082 - (reads || writes ||
2083 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))) {
2084 -
2060 + if ((d->do_util == CONFIG_BOOLEAN_YES || d->do_util == CONFIG_BOOLEAN_AUTO) &&
2061 + (d->do_ops == CONFIG_BOOLEAN_YES || d->do_ops == CONFIG_BOOLEAN_AUTO)) {
2062 if(unlikely(!d->st_svctm)) {
2063 d->st_svctm = rrdset_create_localhost(
2064 "disk_svctm"
@@ -2328,12 +2305,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
2305 rrdset_done(d->st_bcache_cache_read_races);
2306 }
2307
2331 - if(d->do_bcache == CONFIG_BOOLEAN_YES || (d->do_bcache == CONFIG_BOOLEAN_AUTO &&
2332 - (stats_total_cache_hits ||
2333 - stats_total_cache_misses ||
2334 - stats_total_cache_miss_collisions ||
2335 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
2336 -
2308 + if (d->do_bcache == CONFIG_BOOLEAN_YES || d->do_bcache == CONFIG_BOOLEAN_AUTO) {
2309 if(unlikely(!d->st_bcache)) {
2310 d->st_bcache = rrdset_create_localhost(
2311 "disk_bcache"
@@ -2367,11 +2339,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
2339 rrdset_done(d->st_bcache);
2340 }
2341
2370 - if(d->do_bcache == CONFIG_BOOLEAN_YES || (d->do_bcache == CONFIG_BOOLEAN_AUTO &&
2371 - (stats_total_cache_bypass_hits ||
2372 - stats_total_cache_bypass_misses ||
2373 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
2374 -
2342 + if (d->do_bcache == CONFIG_BOOLEAN_YES || d->do_bcache == CONFIG_BOOLEAN_AUTO) {
2343 if(unlikely(!d->st_bcache_bypass)) {
2344 d->st_bcache_bypass = rrdset_create_localhost(
2345 "disk_bcache_bypass"
@@ -2410,9 +2378,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
2378 netdata_mutex_unlock(&diskstats_dev_mutex);
2379 // update the system total I/O
2380
2413 - if(global_do_io == CONFIG_BOOLEAN_YES || (global_do_io == CONFIG_BOOLEAN_AUTO &&
2414 - (system_read_kb || system_write_kb ||
2415 - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
2381 + if (global_do_io == CONFIG_BOOLEAN_YES || global_do_io == CONFIG_BOOLEAN_AUTO) {
2382 common_system_io(system_read_kb * 1024, system_write_kb * 1024, update_every);
2383 }
2384