Δont use wc στρθψτ if it may not exist (#11820)
Emmanuel Vasilakis committed
Nov 22, 2021 at 20:58 UTC
d13b918ad065528063c19d8d608ead180a923ead
3 files changed
+8
-8
database/sqlite/sqlite_aclk_alert.c
+5
-5
@@ -304,7 +304,7 @@ void aclk_send_alarm_health_log(char *node_id)
304
aclk_database_enq_cmd(wc, &cmd);
305
else {
306
if (aclk_worker_enq_cmd(node_id, &cmd))
307
- error_report("ACLK synchronization thread is not active for node id %s", node_id);
307
+ log_access("AC [%s (N/A)]: ACLK synchronization thread is not active.", node_id);
308
}
309
return;
310
}
@@ -515,7 +515,7 @@ int aclk_push_alert_config_event(struct aclk_database_worker_config *wc, struct
515
destroy_aclk_alarm_configuration(&alarm_config);
516
}
517
else
518
- info("Alert config for %s not found", config_hash);
518
+ log_access("AC [%s (%s)]: Alert config for %s not found.", wc->node_id, wc->host ? wc->host->hostname : "N/A", config_hash);
519
520
bind_fail:
521
rc = sqlite3_finalize(res);
@@ -549,7 +549,7 @@ void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start
549
rrd_unlock();
550
551
if (unlikely(!host->health_enabled)) {
552
- log_access("AC [%s (%s)]: Ignoring request to stream alert state changes, health is disabled.", node_id, wc->host ? wc->host->hostname : "N/A");
552
+ log_access("AC [%s (N/A)]: Ignoring request to stream alert state changes, health is disabled.", node_id);
553
return;
554
}
555
@@ -562,7 +562,7 @@ void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start
562
__sync_synchronize();
563
}
564
else
565
- log_access("AC [%s (%s)]: ACLK synchronization thread is not active.", node_id, wc->host ? wc->host->hostname : "N/A");
565
+ log_access("AC [%s (N/A)]: ACLK synchronization thread is not active.", node_id);
566
567
#else
568
UNUSED(node_id);
@@ -648,7 +648,7 @@ void aclk_process_send_alarm_snapshot(char *node_id, char *claim_id, uint64_t sn
648
cmd.completion = NULL;
649
aclk_database_enq_cmd(wc, &cmd);
650
} else
651
- error("ACLK synchronization thread is not active for host %s", host->hostname);
651
+ log_access("AC [%s (N/A)]: ACLK synchronization thread is not active.", node_id);
652
#else
653
UNUSED(node_id);
654
UNUSED(snapshot_id);
database/sqlite/sqlite_aclk_chart.c
+2
-2
@@ -647,7 +647,7 @@ static void aclk_submit_param_command(char *node_id, enum aclk_database_opcode a
647
aclk_database_enq_cmd(wc, &cmd);
648
else {
649
if (aclk_worker_enq_cmd(node_id, &cmd))
650
- log_access("AC [%s (%s)]: ACLK synchronization thread is not active.", node_id, host ? host->hostname : "N/A");
650
+ log_access("AC [%s (N/A)]: ACLK synchronization thread is not active.", node_id);
651
}
652
return;
653
}
@@ -727,7 +727,7 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at
727
}
728
}
729
else
730
- log_access("AC [%s (%s)]: ACLK synchronization thread is not active.", wc->node_id, wc->host ? wc->host->hostname : "N/A");
730
+ log_access("AC [%s (N/A)]: ACLK synchronization thread is not active.", node_id);
731
return;
732
}
733
host = host->next;
database/sqlite/sqlite_aclk_node.c
+1
-1
@@ -52,7 +52,7 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
52
node_info.data.host_labels_head = labels->head;
53
54
aclk_update_node_info(&node_info);
55
- log_access("OG [%s (%s)]: Sending node info for guid [%s] (%s).", wc->node_id, wc->host ? wc->host->hostname : "N/A", wc->host_guid, wc->host == localhost ? "parent" : "child");
55
+ log_access("OG [%s (%s)]: Sending node info for guid [%s] (%s).", wc->node_id, wc->host->hostname, wc->host_guid, wc->host == localhost ? "parent" : "child");
56
57
netdata_rwlock_unlock(&labels->labels_rwlock);
58
rrd_unlock();