diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-01 06:15:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-01 06:15:04 +0000 |
commit | e970e0b37b8bd7f246feb3f70c4136418225e434 (patch) | |
tree | 0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /database/rrd.h | |
parent | Adding upstream version 1.31.0. (diff) | |
download | netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip |
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | database/rrd.h | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/database/rrd.h b/database/rrd.h index 380ccb161..7f8b91f7d 100644 --- a/database/rrd.h +++ b/database/rrd.h @@ -15,6 +15,9 @@ typedef struct rrdcalctemplate RRDCALCTEMPLATE; typedef struct alarm_entry ALARM_ENTRY; typedef struct context_param CONTEXT_PARAM; +typedef void *ml_host_t; +typedef void *ml_dimension_t; + // forward declarations struct rrddim_volatile; struct rrdset_volatile; @@ -26,20 +29,16 @@ struct rrdengine_instance; struct pg_cache_page_index; #endif -#include "../daemon/common.h" +#include "daemon/common.h" #include "web/api/queries/query.h" #include "rrdvar.h" #include "rrdsetvar.h" #include "rrddimvar.h" #include "rrdcalc.h" #include "rrdcalctemplate.h" -#include "../streaming/rrdpush.h" - -#ifndef ACLK_NG -#include "../aclk/legacy/aclk_rrdhost_state.h" -#else -#include "aclk/aclk.h" -#endif +#include "streaming/rrdpush.h" +#include "aclk/aclk_rrdhost_state.h" +#include "sqlite/sqlite_health.h" enum { CONTEXT_FLAGS_ARCHIVE = 0x01, @@ -54,6 +53,7 @@ struct context_param { uint8_t flags; }; +#define RRDSET_MINIMUM_LIVE_COUNT 3 #define META_CHART_UPDATED 1 #define META_PLUGIN_UPDATED 2 #define META_MODULE_UPDATED 4 @@ -167,7 +167,8 @@ typedef enum rrddim_flags { RRDDIM_FLAG_OBSOLETE = (1 << 2), // this is marked by the collector/module as obsolete // No new values have been collected for this dimension since agent start or it was marked RRDDIM_FLAG_OBSOLETE at // least rrdset_free_obsolete_time seconds ago. - RRDDIM_FLAG_ARCHIVED = (1 << 3) + RRDDIM_FLAG_ARCHIVED = (1 << 3), + RRDDIM_FLAG_ACLK = (1 << 4) } RRDDIM_FLAGS; #ifdef HAVE_C___ATOMIC @@ -384,7 +385,10 @@ struct rrddim_volatile { uuid_t *rrdeng_uuid; // database engine metric UUID struct pg_cache_page_index *page_index; #endif - uuid_t *metric_uuid; // global UUID for this metric (unique_across hosts) +#ifdef ENABLE_ACLK + int aclk_live_status; +#endif + uuid_t metric_uuid; // global UUID for this metric (unique_across hosts) union rrddim_collect_handle handle; // ------------------------------------------------------------------------ // function pointers that handle data collection @@ -420,6 +424,8 @@ struct rrddim_volatile { // get the timestamp of the first entry of this metric time_t (*oldest_time)(RRDDIM *rd); } query_ops; + + ml_dimension_t ml_dimension; }; // ---------------------------------------------------------------------------- @@ -427,6 +433,7 @@ struct rrddim_volatile { struct rrdset_volatile { char *old_title; char *old_context; + uuid_t hash_id; struct label *new_labels; struct label_index labels; }; @@ -655,6 +662,7 @@ struct alarm_entry { uint32_t unique_id; uint32_t alarm_id; uint32_t alarm_event_id; + uuid_t config_hash_id; time_t when; time_t duration; @@ -745,6 +753,7 @@ struct rrdhost_system_info { char *container; char *container_detection; char *is_k8s_node; + uint16_t hops; }; struct rrdhost { @@ -764,10 +773,14 @@ struct rrdhost { const char *os; // the O/S type of the host const char *tags; // tags for this host const char *timezone; // the timezone of the host + #ifdef ENABLE_ACLK - long obsolete_count; + long deleted_charts_count; #endif + const char *abbrev_timezone; // the abbriviated timezone of the host + int32_t utc_offset; // the offset in seconds from utc + RRDHOST_FLAGS flags; // flags about this RRDHOST RRDHOST_FLAGS *exporting_flags; // array of flags for exporting connector instances @@ -795,6 +808,7 @@ struct rrdhost { struct sender_state *sender; volatile unsigned int rrdpush_sender_spawn:1; // 1 when the sender thread has been spawn netdata_thread_t rrdpush_sender_thread; // the sender thread + void *dbsync_worker; volatile unsigned int rrdpush_sender_connected:1; // 1 when the sender is ready to push metrics int rrdpush_sender_socket; // the fd of the socket to the remote host, or -1 @@ -859,6 +873,8 @@ struct rrdhost { RRDSET *rrdset_root; // the host charts + unsigned int obsolete_charts_count; + // ------------------------------------------------------------------------ // locks @@ -866,6 +882,10 @@ struct rrdhost { netdata_rwlock_t rrdhost_rwlock; // lock for this RRDHOST (protects rrdset_root linked list) // ------------------------------------------------------------------------ + // ML handle + ml_host_t ml_host; + + // ------------------------------------------------------------------------ // Support for host-level labels struct label_index labels; @@ -938,6 +958,8 @@ extern RRDHOST *rrdhost_find_or_create( , const char *guid , const char *os , const char *timezone + , const char *abbrev_timezone + , int32_t utc_offset , const char *tags , const char *program_name , const char *program_version @@ -958,6 +980,8 @@ extern void rrdhost_update(RRDHOST *host , const char *guid , const char *os , const char *timezone + , const char *abbrev_timezone + , int32_t utc_offset , const char *tags , const char *program_name , const char *program_version @@ -1034,6 +1058,7 @@ extern void rrdhost_system_info_free(struct rrdhost_system_info *system_info); extern void rrdhost_free(RRDHOST *host); extern void rrdhost_save_charts(RRDHOST *host); extern void rrdhost_delete_charts(RRDHOST *host); +extern void rrd_cleanup_obsolete_charts(); extern int rrdhost_should_be_removed(RRDHOST *host, RRDHOST *protected_host, time_t now); @@ -1125,7 +1150,10 @@ static inline time_t rrdset_first_entry_t_nolock(RRDSET *st) time_t first_entry_t = LONG_MAX; rrddim_foreach_read(rd, st) { - first_entry_t = MIN(first_entry_t, rd->state->query_ops.oldest_time(rd)); + first_entry_t = + MIN(first_entry_t, + rd->state->query_ops.oldest_time(rd) > st->update_every ? + rd->state->query_ops.oldest_time(rd) - st->update_every : 0); } if (unlikely(LONG_MAX == first_entry_t)) return 0; @@ -1322,20 +1350,19 @@ extern void rrdset_save(RRDSET *st); extern void rrdset_delete_custom(RRDSET *st, int db_rotated); extern void rrdset_delete_obsolete_dimensions(RRDSET *st); -extern void rrdhost_cleanup_obsolete_charts(RRDHOST *host); extern RRDHOST *rrdhost_create( const char *hostname, const char *registry_hostname, const char *guid, const char *os, const char *timezone, - const char *tags, const char *program_name, const char *program_version, int update_every, long entries, - RRD_MEMORY_MODE memory_mode, unsigned int health_enabled, unsigned int rrdpush_enabled, char *rrdpush_destination, - char *rrdpush_api_key, char *rrdpush_send_charts_matching, struct rrdhost_system_info *system_info, + const char *abbrev_timezone, int32_t utc_offset,const char *tags, const char *program_name, const char *program_version, + int update_every, long entries, RRD_MEMORY_MODE memory_mode, unsigned int health_enabled, unsigned int rrdpush_enabled, + char *rrdpush_destination, char *rrdpush_api_key, char *rrdpush_send_charts_matching, struct rrdhost_system_info *system_info, int is_localhost); //TODO: Remove , int is_archived); #endif /* NETDATA_RRD_INTERNALS */ extern void set_host_properties( RRDHOST *host, int update_every, RRD_MEMORY_MODE memory_mode, const char *hostname, const char *registry_hostname, - const char *guid, const char *os, const char *tags, const char *tzone, const char *program_name, - const char *program_version); + const char *guid, const char *os, const char *tags, const char *tzone, const char *abbrev_tzone, int32_t utc_offset, + const char *program_name, const char *program_version); // ---------------------------------------------------------------------------- // RRD DB engine declarations @@ -1344,5 +1371,9 @@ extern void set_host_properties( #include "database/engine/rrdengineapi.h" #endif #include "sqlite/sqlite_functions.h" - +#include "sqlite/sqlite_aclk.h" +#include "sqlite/sqlite_aclk_chart.h" +#include "sqlite/sqlite_aclk_alert.h" +#include "sqlite/sqlite_aclk_node.h" +#include "sqlite/sqlite_health.h" #endif /* NETDATA_RRD_H */ |