@cryptotaxi247 / netdata-1 / commits / f59e75c9e

Minor fixes (#20263)

* Fix message * Avoid division by zero (silence coverity) * Switch to info for shutdown messages, reformat the shutdown_timing

Stelios Fragkakis committed May 9, 2025 at 16:59 UTC f59e75c9e7ab69be89910a5775b991bccae5c3ed
3 files changed +8 -4
src/daemon/daemon-shutdown-watcher.c
+5 -3
@@ -120,7 +120,7 @@ void *watcher_main(void *arg)
120
121 // wait until the agent starts the shutdown process
122 completion_wait_for(&shutdown_begin_completion);
123 - netdata_log_error("Shutdown process started");
123 + netdata_log_info("Shutdown process started");
124
125 usec_t shutdown_start_time = now_monotonic_usec();
126
@@ -150,8 +150,10 @@ void *watcher_main(void *arg)
150 usec_t shutdown_end_time = now_monotonic_usec();
151
152 usec_t shutdown_duration = shutdown_end_time - shutdown_start_time;
153 - netdata_log_error("Shutdown process ended in %llu milliseconds",
154 - shutdown_duration / USEC_PER_MS);
153 +
154 + char shutdown_timing[64];
155 + duration_snprintf(shutdown_timing, sizeof(shutdown_timing), (int64_t)shutdown_duration, "us", 1);
156 + netdata_log_info("Shutdown process ended in %s", shutdown_timing);
157
158 daemon_status_file_shutdown_step(NULL, buffer_tostring(steps_timings));
159 daemon_status_file_update_status(DAEMON_STATUS_EXITED);
src/database/rrdset-collection.c
+1 -1
@@ -682,7 +682,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
682 collected_total += rd->collector.collected_value;
683
684 if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE))) {
685 - netdata_log_error("Dimension %s in chart '%s' has the OBSOLETE or ARCHIVED flag set, but it is collected.", rrddim_name(rd), rrdset_id(st));
685 + netdata_log_error("Dimension %s in chart '%s' has the OBSOLETE flag set, but it is collected.", rrddim_name(rd), rrdset_id(st));
686 if(!spinlock_trylock(&rd->destroy_lock))
687 fatal("RRDSET: dimension '%s' of chart '%s' of host '%s' is being collected while is being destroyed.", rrddim_id(rd), rrdset_id(st), rrdhost_hostname(st->rrdhost));
688
src/database/sqlite/sqlite_metadata.c
+2
@@ -2405,6 +2405,8 @@ static void store_hosts_metadata(BUFFER *work_buffer, bool is_worker)
2405 host_count++;
2406 }
2407 dfe_done(host);
2408 + if (!host_count)
2409 + host_count = 1; // avoid division by zero
2410 }
2411
2412 size_t count = 0;