remove "ignore 0 metrics" from tc/btrfs/ksm (#17810)
* remove "ingore 0 metrics" from tc plugin * remove "ignore 0 metrics" from btrfs * and from ksm * minor
Ilya Mashchenko committed
Jun 4, 2024 at 16:42 UTC
55d12320369ae5c2d23c294724cc411fbe47c78a
4 files changed
+14
-36
src/collectors/cgroups.plugin/tests/test_cgroups_plugin.c
-1
@@ -4,7 +4,6 @@
4
#include "libnetdata/required_dummies.h"
5
6
RRDHOST *localhost;
7
-int netdata_zero_metrics_enabled = 1;
7
struct config netdata_config;
8
char *netdata_configured_primary_plugins_dir = NULL;
9
src/collectors/proc.plugin/sys_fs_btrfs.c
+7
-20
@@ -785,9 +785,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
785
// --------------------------------------------------------------------
786
// allocation/disks
787
788
- if(do_allocation_disks == CONFIG_BOOLEAN_YES || (do_allocation_disks == CONFIG_BOOLEAN_AUTO &&
789
- ((node->all_disks_total && node->allocation_data_disk_total) ||
790
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
788
+ if (do_allocation_disks == CONFIG_BOOLEAN_YES || do_allocation_disks == CONFIG_BOOLEAN_AUTO) {
789
do_allocation_disks = CONFIG_BOOLEAN_YES;
790
791
if(unlikely(!node->st_allocation_disks)) {
@@ -840,13 +838,10 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
838
rrdset_done(node->st_allocation_disks);
839
}
840
843
-
841
// --------------------------------------------------------------------
842
// allocation/data
843
847
- if(do_allocation_data == CONFIG_BOOLEAN_YES || (do_allocation_data == CONFIG_BOOLEAN_AUTO &&
848
- (node->allocation_data_total_bytes ||
849
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
844
+ if (do_allocation_data == CONFIG_BOOLEAN_YES || do_allocation_data == CONFIG_BOOLEAN_AUTO) {
845
do_allocation_data = CONFIG_BOOLEAN_YES;
846
847
if(unlikely(!node->st_allocation_data)) {
@@ -888,9 +883,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
883
// --------------------------------------------------------------------
884
// allocation/metadata
885
891
- if(do_allocation_metadata == CONFIG_BOOLEAN_YES || (do_allocation_metadata == CONFIG_BOOLEAN_AUTO &&
892
- (node->allocation_metadata_total_bytes ||
893
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
886
+ if (do_allocation_metadata == CONFIG_BOOLEAN_YES || do_allocation_metadata == CONFIG_BOOLEAN_AUTO) {
887
do_allocation_metadata = CONFIG_BOOLEAN_YES;
888
889
if(unlikely(!node->st_allocation_metadata)) {
@@ -934,9 +927,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
927
// --------------------------------------------------------------------
928
// allocation/system
929
937
- if(do_allocation_system == CONFIG_BOOLEAN_YES || (do_allocation_system == CONFIG_BOOLEAN_AUTO &&
938
- (node->allocation_system_total_bytes ||
939
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
930
+ if (do_allocation_system == CONFIG_BOOLEAN_YES || do_allocation_system == CONFIG_BOOLEAN_AUTO) {
931
do_allocation_system = CONFIG_BOOLEAN_YES;
932
933
if(unlikely(!node->st_allocation_system)) {
@@ -978,9 +969,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
969
// --------------------------------------------------------------------
970
// commit_stats
971
981
- if(do_commit_stats == CONFIG_BOOLEAN_YES || (do_commit_stats == CONFIG_BOOLEAN_AUTO &&
982
- (node->commits_total ||
983
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
972
+ if (do_commit_stats == CONFIG_BOOLEAN_YES || do_commit_stats == CONFIG_BOOLEAN_AUTO) {
973
do_commit_stats = CONFIG_BOOLEAN_YES;
974
975
if(unlikely(!node->st_commits)) {
@@ -1089,9 +1078,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
1078
// --------------------------------------------------------------------
1079
// error_stats per device
1080
1092
- if(do_error_stats == CONFIG_BOOLEAN_YES || (do_error_stats == CONFIG_BOOLEAN_AUTO &&
1093
- (node->devices ||
1094
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1081
+ if (do_error_stats == CONFIG_BOOLEAN_YES || do_error_stats == CONFIG_BOOLEAN_AUTO) {
1082
do_error_stats = CONFIG_BOOLEAN_YES;
1083
1084
for(BTRFS_DEVICE *d = node->devices ; d ; d = d->next) {
@@ -1146,7 +1133,7 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
1133
rrddim_set_by_pointer(d->st_error_stats, d->rd_generation_errs, d->generation_errs);
1134
1135
rrdset_done(d->st_error_stats);
1149
- }
1136
+ }
1137
}
1138
}
1139
src/collectors/proc.plugin/sys_kernel_mm_ksm.c
+2
-1
@@ -89,7 +89,8 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
89
offered = pages_sharing + pages_shared + pages_unshared + pages_volatile;
90
saved = pages_sharing;
91
92
- if(unlikely(!offered /*|| !pages_to_scan*/ && netdata_zero_metrics_enabled == CONFIG_BOOLEAN_NO)) return 0;
92
+ if (!offered)
93
+ return 0;
94
95
// --------------------------------------------------------------------
96
src/collectors/tc.plugin/plugin_tc.c
+5
-14
@@ -398,8 +398,7 @@ static inline void tc_device_commit(struct tc_device *d) {
398
// --------------------------------------------------------------------
399
// bytes
400
401
- if(d->enabled_bytes == CONFIG_BOOLEAN_YES || (d->enabled_bytes == CONFIG_BOOLEAN_AUTO &&
402
- (bytes_sum || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
401
+ if (d->enabled_bytes == CONFIG_BOOLEAN_YES || d->enabled_bytes == CONFIG_BOOLEAN_AUTO) {
402
d->enabled_bytes = CONFIG_BOOLEAN_YES;
403
404
if(unlikely(!d->st_bytes)) {
@@ -453,9 +452,7 @@ static inline void tc_device_commit(struct tc_device *d) {
452
// --------------------------------------------------------------------
453
// packets
454
456
- if(d->enabled_packets == CONFIG_BOOLEAN_YES || (d->enabled_packets == CONFIG_BOOLEAN_AUTO &&
457
- (packets_sum ||
458
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
455
+ if (d->enabled_packets == CONFIG_BOOLEAN_YES || d->enabled_packets == CONFIG_BOOLEAN_AUTO) {
456
d->enabled_packets = CONFIG_BOOLEAN_YES;
457
458
if(unlikely(!d->st_packets)) {
@@ -517,9 +514,7 @@ static inline void tc_device_commit(struct tc_device *d) {
514
// --------------------------------------------------------------------
515
// dropped
516
520
- if(d->enabled_dropped == CONFIG_BOOLEAN_YES || (d->enabled_dropped == CONFIG_BOOLEAN_AUTO &&
521
- (dropped_sum ||
522
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
517
+ if (d->enabled_dropped == CONFIG_BOOLEAN_YES || d->enabled_dropped == CONFIG_BOOLEAN_AUTO) {
518
d->enabled_dropped = CONFIG_BOOLEAN_YES;
519
520
if(unlikely(!d->st_dropped)) {
@@ -581,9 +576,7 @@ static inline void tc_device_commit(struct tc_device *d) {
576
// --------------------------------------------------------------------
577
// tokens
578
584
- if(d->enabled_tokens == CONFIG_BOOLEAN_YES || (d->enabled_tokens == CONFIG_BOOLEAN_AUTO &&
585
- (tokens_sum ||
586
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
579
+ if (d->enabled_tokens == CONFIG_BOOLEAN_YES || d->enabled_tokens == CONFIG_BOOLEAN_AUTO) {
580
d->enabled_tokens = CONFIG_BOOLEAN_YES;
581
582
if(unlikely(!d->st_tokens)) {
@@ -646,9 +639,7 @@ static inline void tc_device_commit(struct tc_device *d) {
639
// --------------------------------------------------------------------
640
// ctokens
641
649
- if(d->enabled_ctokens == CONFIG_BOOLEAN_YES || (d->enabled_ctokens == CONFIG_BOOLEAN_AUTO &&
650
- (ctokens_sum ||
651
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
642
+ if (d->enabled_ctokens == CONFIG_BOOLEAN_YES || d->enabled_ctokens == CONFIG_BOOLEAN_AUTO) {
643
d->enabled_ctokens = CONFIG_BOOLEAN_YES;
644
645
if(unlikely(!d->st_ctokens)) {