diff options
author | vkalintiris <vasilis@netdata.cloud> | 2024-02-06 22:48:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 22:48:48 +0200 |
commit | b0bbaff33d526518274d4f8801c7982753119cad (patch) | |
tree | 2ac9de4828b22755dae57c59bd4f1e35c21845bb | |
parent | c7f60b17882a3c9b2480f5e7d0a1896f65971db6 (diff) |
Remove tags field from RRD hosts. (#16894)
* Remove tags field from RRD hosts.
My understanding is that this field has been
deprecated in favour of RRD labels.
* Remove unused config
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.c | 1 | ||||
-rw-r--r-- | src/daemon/unit_test.c | 1 | ||||
-rw-r--r-- | src/database/rrd.h | 4 | ||||
-rw-r--r-- | src/database/rrdhost.c | 40 | ||||
-rw-r--r-- | src/database/sqlite/sqlite_aclk.c | 6 | ||||
-rw-r--r-- | src/database/sqlite/sqlite_metadata.c | 3 | ||||
-rw-r--r-- | src/exporting/graphite/graphite.c | 8 | ||||
-rw-r--r-- | src/exporting/json/json.c | 36 | ||||
-rw-r--r-- | src/exporting/opentsdb/opentsdb.c | 16 | ||||
-rw-r--r-- | src/streaming/receiver.c | 7 | ||||
-rw-r--r-- | src/streaming/rrdpush.c | 3 | ||||
-rw-r--r-- | src/streaming/rrdpush.h | 1 | ||||
-rw-r--r-- | src/streaming/sender.c | 2 |
13 files changed, 21 insertions, 107 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index 2ed46198a6..8d50b93ef0 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -184,7 +184,6 @@ static inline PARSER_RC pluginsd_host_define_end(char **words __maybe_unused, si netdata_configured_timezone, netdata_configured_abbrev_timezone, netdata_configured_utc_offset, - NULL, program_name, program_version, default_rrd_update_every, diff --git a/src/daemon/unit_test.c b/src/daemon/unit_test.c index 2dcfa4f0c6..1b350fecd3 100644 --- a/src/daemon/unit_test.c +++ b/src/daemon/unit_test.c @@ -1831,7 +1831,6 @@ static RRDHOST *dbengine_rrdhost_find_or_create(char *name) netdata_configured_timezone, netdata_configured_abbrev_timezone, netdata_configured_utc_offset, - "", program_name, program_version, default_rrd_update_every, diff --git a/src/database/rrd.h b/src/database/rrd.h index ff2699d17a..8ab8430ba0 100644 --- a/src/database/rrd.h +++ b/src/database/rrd.h @@ -1151,7 +1151,6 @@ struct rrdhost { STRING *hostname; // the hostname of this host STRING *registry_hostname; // the registry hostname for this host STRING *os; // the O/S type of the host - STRING *tags; // tags for this host STRING *timezone; // the timezone of the host STRING *abbrev_timezone; // the abbriviated timezone of the host STRING *program_name; // the program name that collects metrics for this host @@ -1388,7 +1387,6 @@ RRDHOST *rrdhost_find_or_create( const char *timezone, const char *abbrev_timezone, int32_t utc_offset, - const char *tags, const char *prog_name, const char *prog_version, int update_every, @@ -1580,7 +1578,7 @@ void rrdset_reset(RRDSET *st); void set_host_properties( RRDHOST *host, int update_every, RRD_MEMORY_MODE memory_mode, const char *registry_hostname, - const char *os, const char *tags, const char *tzone, const char *abbrev_tzone, int32_t utc_offset, + const char *os, const char *tzone, const char *abbrev_tzone, int32_t utc_offset, const char *prog_name, const char *prog_version); size_t get_tier_grouping(size_t tier); diff --git a/src/database/rrdhost.c b/src/database/rrdhost.c index adcb9cd803..7a5558e360 100644 --- a/src/database/rrdhost.c +++ b/src/database/rrdhost.c @@ -178,15 +178,6 @@ static inline RRDHOST *rrdhost_index_add_hostname(RRDHOST *host) { // ---------------------------------------------------------------------------- // RRDHOST - internal helpers -static inline void rrdhost_init_tags(RRDHOST *host, const char *tags) { - if(host->tags && tags && !strcmp(rrdhost_tags(host), tags)) - return; - - STRING *old = host->tags; - host->tags = string_strdupz((tags && *tags)?tags:NULL); - string_freez(old); -} - static inline void rrdhost_init_hostname(RRDHOST *host, const char *hostname, bool add_to_index) { if(unlikely(hostname && !*hostname)) hostname = NULL; @@ -229,8 +220,8 @@ static inline void rrdhost_init_timezone(RRDHOST *host, const char *timezone, co } void set_host_properties(RRDHOST *host, int update_every, RRD_MEMORY_MODE memory_mode, - const char *registry_hostname, const char *os, const char *tags, - const char *tzone, const char *abbrev_tzone, int32_t utc_offset, const char *prog_name, + const char *registry_hostname, const char *os, const char *tzone, + const char *abbrev_tzone, int32_t utc_offset, const char *prog_name, const char *prog_version) { @@ -239,7 +230,6 @@ void set_host_properties(RRDHOST *host, int update_every, RRD_MEMORY_MODE memory rrdhost_init_os(host, os); rrdhost_init_timezone(host, tzone, abbrev_tzone, utc_offset); - rrdhost_init_tags(host, tags); host->program_name = string_strdupz((prog_name && *prog_name) ? prog_name : "unknown"); host->program_version = string_strdupz((prog_version && *prog_version) ? prog_version : "unknown"); @@ -287,7 +277,6 @@ static RRDHOST *rrdhost_create( const char *timezone, const char *abbrev_timezone, int32_t utc_offset, - const char *tags, const char *prog_name, const char *prog_version, int update_every, @@ -326,7 +315,7 @@ int is_legacy = 1; strncpyz(host->machine_guid, guid, GUID_LEN + 1); set_host_properties(host, (update_every > 0)?update_every:1, memory_mode, registry_hostname, os, - tags, timezone, abbrev_timezone, utc_offset, + timezone, abbrev_timezone, utc_offset, prog_name, prog_version); @@ -539,7 +528,6 @@ int is_legacy = 1; "Host '%s' (at registry as '%s') with guid '%s' initialized" ", os '%s'" ", timezone '%s'" - ", tags '%s'" ", program_name '%s'" ", program_version '%s'" ", update every %d" @@ -556,7 +544,6 @@ int is_legacy = 1; , host->machine_guid , rrdhost_os(host) , rrdhost_timezone(host) - , rrdhost_tags(host) , rrdhost_program_name(host) , rrdhost_program_version(host) , host->rrd_update_every @@ -590,7 +577,6 @@ static void rrdhost_update(RRDHOST *host , const char *timezone , const char *abbrev_timezone , int32_t utc_offset - , const char *tags , const char *prog_name , const char *prog_version , int update_every @@ -680,9 +666,6 @@ static void rrdhost_update(RRDHOST *host host->rrd_history_entries, history); - // update host tags - rrdhost_init_tags(host, tags); - if(!host->rrdvars) host->rrdvars = rrdvariables_create(); @@ -734,7 +717,6 @@ RRDHOST *rrdhost_find_or_create( , const char *timezone , const char *abbrev_timezone , int32_t utc_offset - , const char *tags , const char *prog_name , const char *prog_version , int update_every @@ -779,10 +761,9 @@ RRDHOST *rrdhost_find_or_create( , timezone , abbrev_timezone , utc_offset - , tags - , - prog_name, - prog_version, update_every + , prog_name + , prog_version + , update_every , history , mode , health_enabled @@ -808,10 +789,9 @@ RRDHOST *rrdhost_find_or_create( , timezone , abbrev_timezone , utc_offset - , tags - , - prog_name, - prog_version, update_every + , prog_name + , prog_version + , update_every , history , mode , health_enabled @@ -1087,7 +1067,6 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info, bool unitt , netdata_configured_timezone , netdata_configured_abbrev_timezone , netdata_configured_utc_offset - , "" , program_name , program_version , default_rrd_update_every @@ -1307,7 +1286,6 @@ void rrdhost_free___while_having_rrd_wrlock(RRDHOST *host, bool force) { pthread_mutex_destroy(&host->aclk_state_lock); freez(host->aclk_state.claimed_id); freez(host->aclk_state.prev_claimed_id); - string_freez(host->tags); rrdlabels_destroy(host->rrdlabels); string_freez(host->os); string_freez(host->timezone); diff --git a/src/database/sqlite/sqlite_aclk.c b/src/database/sqlite/sqlite_aclk.c index ac574879cc..33ce0f3512 100644 --- a/src/database/sqlite/sqlite_aclk.c +++ b/src/database/sqlite/sqlite_aclk.c @@ -61,7 +61,6 @@ enum { IDX_UPDATE_EVERY, IDX_OS, IDX_TIMEZONE, - IDX_TAGS, IDX_HOPS, IDX_MEMORY_MODE, IDX_ABBREV_TIMEZONE, @@ -120,7 +119,6 @@ static int create_host_callback(void *data, int argc, char **argv, char **column (const char *)argv[IDX_TIMEZONE], (const char *)argv[IDX_ABBREV_TIMEZONE], (int32_t)(argv[IDX_UTC_OFFSET] ? str2uint32_t(argv[IDX_UTC_OFFSET], NULL) : 0), - (const char *)argv[IDX_TAGS], (const char *)(argv[IDX_PROGRAM_NAME] ? argv[IDX_PROGRAM_NAME] : "unknown"), (const char *)(argv[IDX_PROGRAM_VERSION] ? argv[IDX_PROGRAM_VERSION] : "unknown"), argv[IDX_UPDATE_EVERY] ? str2i(argv[IDX_UPDATE_EVERY]) : 1, @@ -557,7 +555,7 @@ void sql_create_aclk_table(RRDHOST *host __maybe_unused, uuid_t *host_uuid __may #define SQL_FETCH_ALL_HOSTS \ "SELECT host_id, hostname, registry_hostname, update_every, os, " \ - "timezone, tags, hops, memory_mode, abbrev_timezone, utc_offset, program_name, " \ + "timezone, hops, memory_mode, abbrev_timezone, utc_offset, program_name, " \ "program_version, entries, health_enabled, last_connected, " \ "(SELECT CASE WHEN hl.label_value = 'true' THEN 1 ELSE 0 END FROM " \ "host_label hl WHERE hl.host_id = h.host_id AND hl.label_key = '_is_ephemeral') " \ @@ -675,4 +673,4 @@ void unregister_node(const char *machine_guid) cmd.completion = NULL; aclk_database_enq_cmd(&cmd); } -#endif
\ No newline at end of file +#endif diff --git a/src/database/sqlite/sqlite_metadata.c b/src/database/sqlite/sqlite_metadata.c index 02361a0a61..6cb9bdf9cc 100644 --- a/src/database/sqlite/sqlite_metadata.c +++ b/src/database/sqlite/sqlite_metadata.c @@ -354,7 +354,8 @@ static int store_host_metadata(RRDHOST *host) if (unlikely(rc != SQLITE_OK)) goto bind_fail; - rc = bind_text_null(res, ++param, rrdhost_tags(host), 1); + // TODO: remove/migrate + rc = bind_text_null(res, ++param, "", 1); if (unlikely(rc != SQLITE_OK)) goto bind_fail; diff --git a/src/exporting/graphite/graphite.c b/src/exporting/graphite/graphite.c index 254db982e5..9edde4503a 100644 --- a/src/exporting/graphite/graphite.c +++ b/src/exporting/graphite/graphite.c @@ -133,13 +133,11 @@ int format_dimension_collected_graphite_plaintext(struct instance *instance, RRD buffer_sprintf( instance->buffer, - "%s.%s.%s.%s%s%s%s " COLLECTED_NUMBER_FORMAT " %llu\n", + "%s.%s.%s.%s%s " COLLECTED_NUMBER_FORMAT " %llu\n", instance->config.prefix, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), chart_name, dimension_name, - (host->tags) ? ";" : "", - (host->tags) ? rrdhost_tags(host) : "", (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : "", rd->collector.last_collected_value, (unsigned long long)rd->collector.last_collected_time.tv_sec); @@ -179,13 +177,11 @@ int format_dimension_stored_graphite_plaintext(struct instance *instance, RRDDIM buffer_sprintf( instance->buffer, - "%s.%s.%s.%s%s%s%s " NETDATA_DOUBLE_FORMAT " %llu\n", + "%s.%s.%s.%s%s " NETDATA_DOUBLE_FORMAT " %llu\n", instance->config.prefix, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), chart_name, dimension_name, - (host->tags) ? ";" : "", - (host->tags) ? rrdhost_tags(host) : "", (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : "", value, (unsigned long long)last_t); diff --git a/src/exporting/json/json.c b/src/exporting/json/json.c index d916fe7741..e9c4db6353 100644 --- a/src/exporting/json/json.c +++ b/src/exporting/json/json.c @@ -144,20 +144,6 @@ int format_dimension_collected_json_plaintext(struct instance *instance, RRDDIM RRDSET *st = rd->rrdset; RRDHOST *host = st->rrdhost; - const char *tags_pre = "", *tags_post = "", *tags = rrdhost_tags(host); - if (!tags) - tags = ""; - - if (*tags) { - if (*tags == '{' || *tags == '[' || *tags == '"') { - tags_pre = "\"host_tags\":"; - tags_post = ","; - } else { - tags_pre = "\"host_tags\":\""; - tags_post = "\","; - } - } - if (instance->config.type == EXPORTING_CONNECTOR_TYPE_JSON_HTTP) { if (buffer_strlen((BUFFER *)instance->buffer) > 2) buffer_strcat(instance->buffer, ",\n"); @@ -169,7 +155,6 @@ int format_dimension_collected_json_plaintext(struct instance *instance, RRDDIM "{" "\"prefix\":\"%s\"," "\"hostname\":\"%s\"," - "%s%s%s" "%s" "\"chart_id\":\"%s\"," @@ -187,9 +172,6 @@ int format_dimension_collected_json_plaintext(struct instance *instance, RRDDIM instance->config.prefix, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - tags_pre, - tags, - tags_post, instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : "", rrdset_id(st), @@ -229,20 +211,6 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd if(isnan(value)) return 0; - const char *tags_pre = "", *tags_post = "", *tags = rrdhost_tags(host); - if (!tags) - tags = ""; - - if (*tags) { - if (*tags == '{' || *tags == '[' || *tags == '"') { - tags_pre = "\"host_tags\":"; - tags_post = ","; - } else { - tags_pre = "\"host_tags\":\""; - tags_post = "\","; - } - } - if (instance->config.type == EXPORTING_CONNECTOR_TYPE_JSON_HTTP) { if (buffer_strlen((BUFFER *)instance->buffer) > 2) buffer_strcat(instance->buffer, ",\n"); @@ -253,7 +221,6 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd "{" "\"prefix\":\"%s\"," "\"hostname\":\"%s\"," - "%s%s%s" "%s" "\"chart_id\":\"%s\"," @@ -271,9 +238,6 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd instance->config.prefix, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - tags_pre, - tags, - tags_post, instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : "", rrdset_id(st), diff --git a/src/exporting/opentsdb/opentsdb.c b/src/exporting/opentsdb/opentsdb.c index ffccb5b223..41f8e200a0 100644 --- a/src/exporting/opentsdb/opentsdb.c +++ b/src/exporting/opentsdb/opentsdb.c @@ -186,15 +186,13 @@ int format_dimension_collected_opentsdb_telnet(struct instance *instance, RRDDIM buffer_sprintf( instance->buffer, - "put %s.%s.%s %llu " COLLECTED_NUMBER_FORMAT " host=%s%s%s%s\n", + "put %s.%s.%s %llu " COLLECTED_NUMBER_FORMAT " host=%s%s\n", instance->config.prefix, chart_name, dimension_name, (unsigned long long)rd->collector.last_collected_time.tv_sec, rd->collector.last_collected_value, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - (host->tags) ? " " : "", - (host->tags) ? rrdhost_tags(host) : "", (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : ""); return 0; @@ -232,15 +230,13 @@ int format_dimension_stored_opentsdb_telnet(struct instance *instance, RRDDIM *r buffer_sprintf( instance->buffer, - "put %s.%s.%s %llu " NETDATA_DOUBLE_FORMAT " host=%s%s%s%s\n", + "put %s.%s.%s %llu " NETDATA_DOUBLE_FORMAT " host=%s%s\n", instance->config.prefix, chart_name, dimension_name, (unsigned long long)last_t, value, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - (host->tags) ? " " : "", - (host->tags) ? rrdhost_tags(host) : "", (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : ""); return 0; @@ -326,7 +322,7 @@ int format_dimension_collected_opentsdb_http(struct instance *instance, RRDDIM * "\"timestamp\":%llu," "\"value\":"COLLECTED_NUMBER_FORMAT"," "\"tags\":{" - "\"host\":\"%s%s%s\"%s" + "\"host\":\"%s\"%s" "}" "}", instance->config.prefix, @@ -335,8 +331,6 @@ int format_dimension_collected_opentsdb_http(struct instance *instance, RRDDIM * (unsigned long long)rd->collector.last_collected_time.tv_sec, rd->collector.last_collected_value, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - (host->tags) ? " " : "", - (host->tags) ? rrdhost_tags(host) : "", instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : ""); return 0; @@ -382,7 +376,7 @@ int format_dimension_stored_opentsdb_http(struct instance *instance, RRDDIM *rd) "\"timestamp\":%llu," "\"value\":" NETDATA_DOUBLE_FORMAT "," "\"tags\":{" - "\"host\":\"%s%s%s\"%s" + "\"host\":\"%s\"%s" "}" "}", instance->config.prefix, @@ -391,8 +385,6 @@ int format_dimension_stored_opentsdb_http(struct instance *instance, RRDDIM *rd) (unsigned long long)last_t, value, (host == localhost) ? instance->config.hostname : rrdhost_hostname(host), - (host->tags) ? " " : "", - (host->tags) ? rrdhost_tags(host) : "", instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : ""); return 0; diff --git a/src/streaming/receiver.c b/src/streaming/receiver.c index 5fd607646d..20f9342df0 100644 --- a/src/streaming/receiver.c +++ b/src/streaming/receiver.c @@ -14,7 +14,6 @@ void receiver_state_free(struct receiver_state *rpt) { freez(rpt->os); freez(rpt->timezone); freez(rpt->abbrev_timezone); - freez(rpt->tags); freez(rpt->client_ip); freez(rpt->client_port); freez(rpt->program_name); @@ -628,8 +627,6 @@ static void rrdpush_receive(struct receiver_state *rpt) rrdpush_parse_compression_order(rpt, order); } - (void)appconfig_set_default(&stream_config, rpt->machine_guid, "host tags", (rpt->tags)?rpt->tags:""); - // find the host for this receiver { // this will also update the host with our system_info @@ -641,7 +638,6 @@ static void rrdpush_receive(struct receiver_state *rpt) rpt->timezone, rpt->abbrev_timezone, rpt->utc_offset, - rpt->tags, rpt->program_name, rpt->program_version, rpt->config.update_every, @@ -694,7 +690,7 @@ static void rrdpush_receive(struct receiver_state *rpt) #ifdef NETDATA_INTERNAL_CHECKS netdata_log_info("STREAM '%s' [receive from [%s]:%s]: " "client willing to stream metrics for host '%s' with machine_guid '%s': " - "update every = %d, history = %d, memory mode = %s, health %s,%s tags '%s'" + "update every = %d, history = %d, memory mode = %s, health %s,%s" , rpt->hostname , rpt->client_ip , rpt->client_port @@ -709,7 +705,6 @@ static void rrdpush_receive(struct receiver_state *rpt) #else , "" #endif - , rrdhost_tags(rpt->host) ); #endif // NETDATA_INTERNAL_CHECKS diff --git a/src/streaming/rrdpush.c b/src/streaming/rrdpush.c index 7efc4fa9c9..874d4eb2fc 100644 --- a/src/streaming/rrdpush.c +++ b/src/streaming/rrdpush.c @@ -875,9 +875,6 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *decoded_query_stri else if(!strcmp(name, "mc_version")) rpt->system_info->mc_version = strtoul(value, NULL, 0); - else if(!strcmp(name, "tags") && !rpt->tags) - rpt->tags = strdupz(value); - else if(!strcmp(name, "ver") && (rpt->capabilities & STREAM_CAP_INVALID)) rpt->capabilities = convert_stream_version_to_capabilities(strtoul(value, NULL, 0), NULL, false); diff --git a/src/streaming/rrdpush.h b/src/streaming/rrdpush.h index 72e20bd744..c738771345 100644 --- a/src/streaming/rrdpush.h +++ b/src/streaming/rrdpush.h @@ -347,7 +347,6 @@ struct receiver_state { char *timezone; // Unused? char *abbrev_timezone; int32_t utc_offset; - char *tags; char *client_ip; // Duplicated in pluginsd char *client_port; // Duplicated in pluginsd char *program_name; // Duplicated in pluginsd diff --git a/src/streaming/sender.c b/src/streaming/sender.c index 31dbb6cd0f..31eed95fa1 100644 --- a/src/streaming/sender.c +++ b/src/streaming/sender.c @@ -786,7 +786,6 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p "&ml_capable=%d" "&ml_enabled=%d" "&mc_version=%d" - "&tags=%s" "&ver=%u" "&NETDATA_INSTANCE_CLOUD_TYPE=%s" "&NETDATA_INSTANCE_CLOUD_INSTANCE_TYPE=%s" @@ -832,7 +831,6 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p , host->system_info->ml_capable , host->system_info->ml_enabled , host->system_info->mc_version - , rrdhost_tags(host) , s->capabilities , (host->system_info->cloud_provider_type) ? host->system_info->cloud_provider_type : "" , (host->system_info->cloud_instance_type) ? host->system_info->cloud_instance_type : "" |