diff options
author | vkalintiris <vasilis@netdata.cloud> | 2023-07-26 15:30:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 15:30:49 +0300 |
commit | 440bd51e08fdfa2a4daa191fb68643456028a753 (patch) | |
tree | 1d2cc2b0afc24b6b77f95f2cf3a1bdbaa544e278 /health | |
parent | 3829b4c48ade535aa2d0a1153d45b49184b27a4b (diff) |
Refactor RRD code. (#15423)
* Storage engine.
* Host indexes to rrdb
* Move globals to rrdb
* Move storage_tiers_backfill to rrdb
* default_rrd_update_every to rrdb
* default_rrd_history_entries to rrdb
* gap_when_lost_iterations_above to rrdb
* rrdset_free_obsolete_time_s to rrdb
* libuv_worker_threads to rrdb
* ieee754_doubles to rrdb
* rrdhost_free_orphan_time_s to rrdb
* rrd_rwlock to rrdb
* localhost to rrdb
* rm extern from func decls
* mv rrd macro under rrd.h
* default_rrdeng_page_cache_mb to rrdb
* default_rrdeng_extent_cache_mb to rrdb
* db_engine_journal_check to rrdb
* default_rrdeng_disk_quota_mb to rrdb
* default_multidb_disk_quota_mb to rrdb
* multidb_ctx to rrdb
* page_type_size to rrdb
* tier_page_size to rrdb
* No storage_engine_id in rrdim functions
* storage_engine_id is provided by st
* Update to fix merge conflict.
* Update field name
* Remove unnecessary macros from rrd.h
* Rm unused type decls
* Rm duplicate func decls
* make internal function static
* Make the rest of public dbengine funcs accept a storage_instance.
* No more rrdengine_instance :)
* rm rrdset_debug from rrd.h
* Use rrdb to access globals in ML and ACLK
Missed due to not having the submodules in the
worktree.
* rm total_number
* rm RRDVAR_TYPE_TOTAL
* rm unused inline
* Rm names from typedef'd enums
* rm unused header include
* Move include
* Rm unused header include
* s/rrdhost_find_or_create/rrdhost_get_or_create/g
* s/find_host_by_node_id/rrdhost_find_by_node_id/
Also, remove duplicate definition in rrdcontext.c
* rm macro used only once
* rm macro used only once
* Reduce rrd.h api by moving funcs into a collector specific utils header
* Remove unused func
* Move parser specific function out of rrd.h
* return storage_number instead of void pointer
* move code related to rrd initialization out of rrdhost.c
* Remove tier_grouping from rrdim_tier
Saves 8 * storage_tiers bytes per dimension.
* Fix rebase
* s/rrd_update_every/update_every/
* Mark functions as static and constify args
* Add license notes and file to build systems.
* Remove remaining non-log/config mentions of memory mode
* Move rrdlabels api to separate file.
Also, move localhost functions that loads
labels outside of database/ and into daemon/
* Remove function decl in rrd.h
* merge rrdhost_cache_dir_for_rrdset_alloc into rrdset_cache_dir
* Do not expose internal function from rrd.h
* Rm NETDATA_RRD_INTERNALS
Only one function decl is covered. We have more
database internal functions that we currently
expose for no good reason. These will be placed
in a separate internal header in follow up PRs.
* Add license note
* Include libnetdata.h instead of aral.h
* Use rrdb to access localhost
* Fix builds without dbengine
* Add header to build system files
* Add rrdlabels.h to build systems
* Move func def from rrd.h to rrdhost.c
* Fix macos build
* Rm non-existing function
* Rebase master
* Define buffer length macro in ad_charts.
* Fix FreeBSD builds.
* Mark functions static
* Rm func decls without definitions
* Rebase master
* Rebase master
* Properly initialize value of storage tiers.
* Fix build after rebase.
Diffstat (limited to 'health')
-rw-r--r-- | health/health.c | 16 | ||||
-rw-r--r-- | health/health.h | 7 | ||||
-rw-r--r-- | health/health_config.c | 2 |
3 files changed, 9 insertions, 16 deletions
diff --git a/health/health.c b/health/health.c index d94c33161d..e45501bce0 100644 --- a/health/health.c +++ b/health/health.c @@ -254,7 +254,7 @@ static inline void unlink_alarm_notify_in_progress(ALARM_ENTRY *ae) * * @return a pointer to the user config directory */ -inline char *health_user_config_dir(void) { +static const char *health_user_config_dir(void) { char buffer[FILENAME_MAX + 1]; snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_user_config_dir); return config_get(CONFIG_SECTION_DIRECTORIES, "health config", buffer); @@ -267,7 +267,7 @@ inline char *health_user_config_dir(void) { * * @return a pointer to the stock config directory. */ -inline char *health_stock_config_dir(void) { +static const char *health_stock_config_dir(void) { char buffer[FILENAME_MAX + 1]; snprintfz(buffer, FILENAME_MAX, "%s/health.d", netdata_configured_stock_config_dir); return config_get(CONFIG_SECTION_DIRECTORIES, "stock health config", buffer); @@ -344,8 +344,8 @@ static void health_reload_host(RRDHOST *host) { netdata_log_health("[%s]: Reloading health.", rrdhost_hostname(host)); - char *user_path = health_user_config_dir(); - char *stock_path = health_stock_config_dir(); + const char *user_path = health_user_config_dir(); + const char *stock_path = health_stock_config_dir(); // free all running alarms rrdcalc_delete_all(host); @@ -403,7 +403,7 @@ void health_reload(void) { sql_refresh_hashes(); RRDHOST *host; - dfe_start_reentrant(rrdhost_root_index, host){ + dfe_start_reentrant(rrdb.rrdhost_root_index, host){ health_reload_host(host); } dfe_done(host); @@ -1080,7 +1080,7 @@ void *health_main(void *ptr) { } worker_is_busy(WORKER_HEALTH_JOB_RRD_LOCK); - dfe_start_reentrant(rrdhost_root_index, host) { + dfe_start_reentrant(rrdb.rrdhost_root_index, host) { if(unlikely(!service_running(SERVICE_HEALTH))) break; @@ -1114,7 +1114,7 @@ void *health_main(void *ptr) { } // wait until cleanup of obsolete charts on children is complete - if (host != localhost) { + if (host != rrdb.localhost) { if (unlikely(host->trigger_chart_obsoletion_check == 1)) { netdata_log_health("[%s]: Waiting for chart obsoletion check.", rrdhost_hostname(host)); continue; @@ -1611,7 +1611,7 @@ void *health_main(void *ptr) { } void health_add_host_labels(void) { - DICTIONARY *labels = localhost->rrdlabels; + DICTIONARY *labels = rrdb.localhost->rrdlabels; // The source should be CONF, but when it is set, these labels are exported by default ('send configured labels' in exporting.conf). // Their export seems to break exporting to Graphite, see https://github.com/netdata/netdata/issues/14084. diff --git a/health/health.h b/health/health.h index 7ec966ffe5..02bf397346 100644 --- a/health/health.h +++ b/health/health.h @@ -51,15 +51,12 @@ void health_reload(void); void health_aggregate_alarms(RRDHOST *host, BUFFER *wb, BUFFER* context, RRDCALC_STATUS status); void health_alarms2json(RRDHOST *host, BUFFER *wb, int all); -void health_alert2json_conf(RRDHOST *host, BUFFER *wb, CONTEXTS_V2_OPTIONS all); void health_alarms_values2json(RRDHOST *host, BUFFER *wb, int all); void health_api_v1_chart_variables2json(RRDSET *st, BUFFER *buf); void health_api_v1_chart_custom_variables2json(RRDSET *st, BUFFER *buf); -int health_alarm_log_open(RRDHOST *host); void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae); -void health_alarm_log_load(RRDHOST *host); ALARM_ENTRY* health_create_alarm_entry( RRDHOST *host, @@ -91,14 +88,10 @@ ALARM_ENTRY* health_create_alarm_entry( void health_alarm_log_add_entry(RRDHOST *host, ALARM_ENTRY *ae); void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path, const char *subpath); -char *health_user_config_dir(void); -char *health_stock_config_dir(void); void health_alarm_log_free(RRDHOST *host); void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae); -void *health_cmdapi_thread(void *ptr); - char *health_edit_command_from_source(const char *source); void sql_refresh_hashes(void); diff --git a/health/health_config.c b/health/health_config.c index 4e93235e2a..8434a0ce1b 100644 --- a/health/health_config.c +++ b/health/health_config.c @@ -452,7 +452,7 @@ char *health_edit_command_from_source(const char *source) netdata_configured_user_config_dir, file_no_path + 1, temp, - rrdhost_registry_hostname(localhost)); + rrdhost_registry_hostname(rrdb.localhost)); } else buffer[0] = '\0'; |