diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-20 04:50:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-20 04:50:01 +0000 |
commit | cd4377fab21e0f500bef7f06543fa848a039c1e0 (patch) | |
tree | ba00a55e430c052d6bed0b61c0f8bbe8ebedd313 /health/health_log.c | |
parent | Releasing debian version 1.40.1-1. (diff) | |
download | netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.tar.xz netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.zip |
Merging upstream version 1.41.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'health/health_log.c')
-rw-r--r-- | health/health_log.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/health/health_log.c b/health/health_log.c index b62e0ace4..4cfbee608 100644 --- a/health/health_log.c +++ b/health/health_log.c @@ -35,9 +35,9 @@ inline ALARM_ENTRY* health_create_alarm_entry( STRING *units, STRING *info, int delay, - uint32_t flags + HEALTH_ENTRY_FLAGS flags ) { - debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id); + netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id); ALARM_ENTRY *ae = callocz(1, sizeof(ALARM_ENTRY)); ae->name = string_dup(name); @@ -47,6 +47,7 @@ inline ALARM_ENTRY* health_create_alarm_entry( uuid_copy(ae->config_hash_id, *((uuid_t *) config_hash_id)); uuid_generate_random(ae->transition_id); + ae->global_id = now_realtime_usec(); ae->family = string_dup(family); ae->classification = string_dup(class); @@ -88,19 +89,19 @@ inline void health_alarm_log_add_entry( RRDHOST *host, ALARM_ENTRY *ae ) { - debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id); + netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id); __atomic_add_fetch(&host->health_transitions, 1, __ATOMIC_RELAXED); // link it - netdata_rwlock_wrlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_write_lock(&host->health_log.spinlock); ae->next = host->health_log.alarms; host->health_log.alarms = ae; host->health_log.count++; - netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_write_unlock(&host->health_log.spinlock); // match previous alarms - netdata_rwlock_rdlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_read_lock(&host->health_log.spinlock); ALARM_ENTRY *t; for(t = host->health_log.alarms ; t ; t = t->next) { if(t != ae && t->alarm_id == ae->alarm_id) { @@ -120,7 +121,7 @@ inline void health_alarm_log_add_entry( break; } } - netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_read_unlock(&host->health_log.spinlock); health_alarm_log_save(host, ae); } @@ -144,7 +145,7 @@ inline void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae) { } inline void health_alarm_log_free(RRDHOST *host) { - netdata_rwlock_wrlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_write_lock(&host->health_log.spinlock); ALARM_ENTRY *ae; while((ae = host->health_log.alarms)) { @@ -152,5 +153,5 @@ inline void health_alarm_log_free(RRDHOST *host) { health_alarm_log_free_one_nochecks_nounlink(ae); } - netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); + rw_spinlock_write_unlock(&host->health_log.spinlock); } |