@cryptotaxi247 / netdata-1 / commits / 3e6a7909e

Don't send zeroes for empty groups (#5540)

Vladimir Kobal committed Mar 5, 2019 at 16:54 UTC 3e6a7909ef8cf4d11f29e9a901adfd24e92772d6
1 file changed +18 -18
collectors/apps.plugin/apps_plugin.c
+18 -18
@@ -3176,21 +3176,21 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3176
3177 send_BEGIN(type, "cpu", dt);
3178 for (w = root; w ; w = w->next) {
3179 - if(unlikely(w->exposed))
3179 + if(unlikely(w->exposed && w->processes))
3180 send_SET(w->name, (kernel_uint_t)(w->utime * utime_fix_ratio) + (kernel_uint_t)(w->stime * stime_fix_ratio) + (kernel_uint_t)(w->gtime * gtime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cutime * cutime_fix_ratio) + (kernel_uint_t)(w->cstime * cstime_fix_ratio) + (kernel_uint_t)(w->cgtime * cgtime_fix_ratio)):0ULL));
3181 }
3182 send_END();
3183
3184 send_BEGIN(type, "cpu_user", dt);
3185 for (w = root; w ; w = w->next) {
3186 - if(unlikely(w->exposed))
3186 + if(unlikely(w->exposed && w->processes))
3187 send_SET(w->name, (kernel_uint_t)(w->utime * utime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cutime * cutime_fix_ratio)):0ULL));
3188 }
3189 send_END();
3190
3191 send_BEGIN(type, "cpu_system", dt);
3192 for (w = root; w ; w = w->next) {
3193 - if(unlikely(w->exposed))
3193 + if(unlikely(w->exposed && w->processes))
3194 send_SET(w->name, (kernel_uint_t)(w->stime * stime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cstime * cstime_fix_ratio)):0ULL));
3195 }
3196 send_END();
@@ -3198,7 +3198,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3198 if(show_guest_time) {
3199 send_BEGIN(type, "cpu_guest", dt);
3200 for (w = root; w ; w = w->next) {
3201 - if(unlikely(w->exposed))
3201 + if(unlikely(w->exposed && w->processes))
3202 send_SET(w->name, (kernel_uint_t)(w->gtime * gtime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cgtime * cgtime_fix_ratio)):0ULL));
3203 }
3204 send_END();
@@ -3206,28 +3206,28 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3206
3207 send_BEGIN(type, "threads", dt);
3208 for (w = root; w ; w = w->next) {
3209 - if(unlikely(w->exposed))
3209 + if(unlikely(w->exposed && w->processes))
3210 send_SET(w->name, w->num_threads);
3211 }
3212 send_END();
3213
3214 send_BEGIN(type, "processes", dt);
3215 for (w = root; w ; w = w->next) {
3216 - if(unlikely(w->exposed))
3216 + if(unlikely(w->exposed && w->processes))
3217 send_SET(w->name, w->processes);
3218 }
3219 send_END();
3220
3221 send_BEGIN(type, "mem", dt);
3222 for (w = root; w ; w = w->next) {
3223 - if(unlikely(w->exposed))
3223 + if(unlikely(w->exposed && w->processes))
3224 send_SET(w->name, (w->status_vmrss > w->status_vmshared)?(w->status_vmrss - w->status_vmshared):0ULL);
3225 }
3226 send_END();
3227
3228 send_BEGIN(type, "vmem", dt);
3229 for (w = root; w ; w = w->next) {
3230 - if(unlikely(w->exposed))
3230 + if(unlikely(w->exposed && w->processes))
3231 send_SET(w->name, w->status_vmsize);
3232 }
3233 send_END();
@@ -3235,7 +3235,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3235 #ifndef __FreeBSD__
3236 send_BEGIN(type, "swap", dt);
3237 for (w = root; w ; w = w->next) {
3238 - if(unlikely(w->exposed))
3238 + if(unlikely(w->exposed && w->processes))
3239 send_SET(w->name, w->status_vmswap);
3240 }
3241 send_END();
@@ -3243,14 +3243,14 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3243
3244 send_BEGIN(type, "minor_faults", dt);
3245 for (w = root; w ; w = w->next) {
3246 - if(unlikely(w->exposed))
3246 + if(unlikely(w->exposed && w->processes))
3247 send_SET(w->name, (kernel_uint_t)(w->minflt * minflt_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cminflt * cminflt_fix_ratio)):0ULL));
3248 }
3249 send_END();
3250
3251 send_BEGIN(type, "major_faults", dt);
3252 for (w = root; w ; w = w->next) {
3253 - if(unlikely(w->exposed))
3253 + if(unlikely(w->exposed && w->processes))
3254 send_SET(w->name, (kernel_uint_t)(w->majflt * majflt_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cmajflt * cmajflt_fix_ratio)):0ULL));
3255 }
3256 send_END();
@@ -3258,14 +3258,14 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3258 #ifndef __FreeBSD__
3259 send_BEGIN(type, "lreads", dt);
3260 for (w = root; w ; w = w->next) {
3261 - if(unlikely(w->exposed))
3261 + if(unlikely(w->exposed && w->processes))
3262 send_SET(w->name, w->io_logical_bytes_read);
3263 }
3264 send_END();
3265
3266 send_BEGIN(type, "lwrites", dt);
3267 for (w = root; w ; w = w->next) {
3268 - if(unlikely(w->exposed))
3268 + if(unlikely(w->exposed && w->processes))
3269 send_SET(w->name, w->io_logical_bytes_written);
3270 }
3271 send_END();
@@ -3273,14 +3273,14 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3273
3274 send_BEGIN(type, "preads", dt);
3275 for (w = root; w ; w = w->next) {
3276 - if(unlikely(w->exposed))
3276 + if(unlikely(w->exposed && w->processes))
3277 send_SET(w->name, w->io_storage_bytes_read);
3278 }
3279 send_END();
3280
3281 send_BEGIN(type, "pwrites", dt);
3282 for (w = root; w ; w = w->next) {
3283 - if(unlikely(w->exposed))
3283 + if(unlikely(w->exposed && w->processes))
3284 send_SET(w->name, w->io_storage_bytes_written);
3285 }
3286 send_END();
@@ -3288,21 +3288,21 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3288 if(enable_file_charts) {
3289 send_BEGIN(type, "files", dt);
3290 for (w = root; w; w = w->next) {
3291 - if (unlikely(w->exposed))
3291 + if (unlikely(w->exposed && w->processes))
3292 send_SET(w->name, w->openfiles);
3293 }
3294 send_END();
3295
3296 send_BEGIN(type, "sockets", dt);
3297 for (w = root; w; w = w->next) {
3298 - if (unlikely(w->exposed))
3298 + if (unlikely(w->exposed && w->processes))
3299 send_SET(w->name, w->opensockets);
3300 }
3301 send_END();
3302
3303 send_BEGIN(type, "pipes", dt);
3304 for (w = root; w; w = w->next) {
3305 - if (unlikely(w->exposed))
3305 + if (unlikely(w->exposed && w->processes))
3306 send_SET(w->name, w->openpipes);
3307 }
3308 send_END();