summaryrefslogtreecommitdiffstats
path: root/collectors/plugins.d
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2023-08-03 13:13:36 +0300
committerGitHub <noreply@github.com>2023-08-03 13:13:36 +0300
commit0e230a260ec7d8b4d6dc5c7165da6ab103d096b3 (patch)
treeb46528e5ace00358c342ea3d571d85bda5c546ed /collectors/plugins.d
parent72549b3a2247f763180925d7c84b0eee8086fa14 (diff)
Revert "Refactor RRD code. (#15423)" (#15723)
This reverts commit 440bd51e08fdfa2a4daa191fb68643456028a753. dbengine was still being used for non-zero tiers even on non-dbengine modes.
Diffstat (limited to 'collectors/plugins.d')
-rw-r--r--collectors/plugins.d/local_listeners.c2
-rw-r--r--collectors/plugins.d/plugins_d.c4
-rw-r--r--collectors/plugins.d/pluginsd_parser.c41
3 files changed, 9 insertions, 38 deletions
diff --git a/collectors/plugins.d/local_listeners.c b/collectors/plugins.d/local_listeners.c
index 159b25f8a4..a39de79748 100644
--- a/collectors/plugins.d/local_listeners.c
+++ b/collectors/plugins.d/local_listeners.c
@@ -1,5 +1,3 @@
-// SPDX-License-Identifier: GPL-3.0-or-later
-
#include "libnetdata/libnetdata.h"
#include "libnetdata/required_dummies.h"
diff --git a/collectors/plugins.d/plugins_d.c b/collectors/plugins.d/plugins_d.c
index 36dfb5a82e..08c26a198b 100644
--- a/collectors/plugins.d/plugins_d.c
+++ b/collectors/plugins.d/plugins_d.c
@@ -293,11 +293,11 @@ void *pluginsd_main(void *ptr)
strncpyz(cd->filename, file->d_name, FILENAME_MAX);
snprintfz(cd->fullfilename, FILENAME_MAX, "%s/%s", directory_name, cd->filename);
- cd->host = rrdb.localhost;
+ cd->host = localhost;
cd->unsafe.enabled = enabled;
cd->unsafe.running = false;
- cd->update_every = (int)config_get_number(cd->id, "update every", rrdb.localhost->update_every);
+ cd->update_every = (int)config_get_number(cd->id, "update every", localhost->rrd_update_every);
cd->started_t = now_realtime_sec();
char *def = "";
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c
index 48245262c5..19aa4544b2 100644
--- a/collectors/plugins.d/pluginsd_parser.c
+++ b/collectors/plugins.d/pluginsd_parser.c
@@ -204,7 +204,7 @@ static inline RRDSET *pluginsd_find_chart(RRDHOST *host, const char *chart, cons
return NULL;
}
- RRDSET *st = rrdset_find_by_id(host, chart);
+ RRDSET *st = rrdset_find(host, chart);
if (unlikely(!st))
netdata_log_error("PLUGINSD: 'host:%s/chart:%s' got a %s but chart does not exist.",
rrdhost_hostname(host), chart, cmd);
@@ -375,38 +375,11 @@ static inline PARSER_RC pluginsd_host_labels(char **words, size_t num_words, PAR
PLUGINSD_KEYWORD_HOST_LABEL);
}
-static struct rrdhost_system_info *labels_to_system_info(DICTIONARY *labels) {
- struct rrdhost_system_info *info = callocz(1, sizeof(struct rrdhost_system_info));
- info->hops = 1;
-
- rrdlabels_get_value_strdup_or_null(labels, &info->cloud_provider_type, "_cloud_provider_type");
- rrdlabels_get_value_strdup_or_null(labels, &info->cloud_instance_type, "_cloud_instance_type");
- rrdlabels_get_value_strdup_or_null(labels, &info->cloud_instance_region, "_cloud_instance_region");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_os_name, "_os_name");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_os_version, "_os_version");
- rrdlabels_get_value_strdup_or_null(labels, &info->kernel_version, "_kernel_version");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_cores, "_system_cores");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_cpu_freq, "_system_cpu_freq");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_ram_total, "_system_ram_total");
- rrdlabels_get_value_strdup_or_null(labels, &info->host_disk_space, "_system_disk_space");
- rrdlabels_get_value_strdup_or_null(labels, &info->architecture, "_architecture");
- rrdlabels_get_value_strdup_or_null(labels, &info->virtualization, "_virtualization");
- rrdlabels_get_value_strdup_or_null(labels, &info->container, "_container");
- rrdlabels_get_value_strdup_or_null(labels, &info->container_detection, "_container_detection");
- rrdlabels_get_value_strdup_or_null(labels, &info->virt_detection, "_virt_detection");
- rrdlabels_get_value_strdup_or_null(labels, &info->is_k8s_node, "_is_k8s_node");
- rrdlabels_get_value_strdup_or_null(labels, &info->install_type, "_install_type");
- rrdlabels_get_value_strdup_or_null(labels, &info->prebuilt_arch, "_prebuilt_arch");
- rrdlabels_get_value_strdup_or_null(labels, &info->prebuilt_dist, "_prebuilt_dist");
-
- return info;
-}
-
static inline PARSER_RC pluginsd_host_define_end(char **words __maybe_unused, size_t num_words __maybe_unused, PARSER *parser) {
if(!parser->user.host_define.parsing_host)
return PLUGINSD_DISABLE_PLUGIN(parser, PLUGINSD_KEYWORD_HOST_DEFINE_END, "missing initialization, send " PLUGINSD_KEYWORD_HOST_DEFINE " before this");
- RRDHOST *host = rrdhost_get_or_create(
+ RRDHOST *host = rrdhost_find_or_create(
string2str(parser->user.host_define.hostname),
string2str(parser->user.host_define.hostname),
parser->user.host_define.machine_guid_str,
@@ -417,9 +390,9 @@ static inline PARSER_RC pluginsd_host_define_end(char **words __maybe_unused, si
NULL,
program_name,
program_version,
- rrdb.default_update_every,
- rrdb.default_rrd_history_entries,
- default_storage_engine_id,
+ default_rrd_update_every,
+ default_rrd_history_entries,
+ default_rrd_memory_mode,
default_health_enabled,
default_rrdpush_enabled,
default_rrdpush_destination,
@@ -428,7 +401,7 @@ static inline PARSER_RC pluginsd_host_define_end(char **words __maybe_unused, si
default_rrdpush_enable_replication,
default_rrdpush_seconds_to_replicate,
default_rrdpush_replication_step,
- labels_to_system_info(parser->user.host_define.rrdlabels),
+ rrdhost_labels_to_system_info(parser->user.host_define.rrdlabels),
false
);
@@ -458,7 +431,7 @@ static inline PARSER_RC pluginsd_host(char **words, size_t num_words, PARSER *pa
char *guid = get_word(words, num_words, 1);
if(!guid || !*guid || strcmp(guid, "localhost") == 0) {
- parser->user.host = rrdb.localhost;
+ parser->user.host = localhost;
return PARSER_RC_OK;
}