summaryrefslogtreecommitdiffstats
path: root/registry/registry.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:00 +0000
commit03bf87dcb06f7021bfb2df2fa8691593c6148aff (patch)
treee16b06711a2ed77cafb4b7754be0220c3d14a9d7 /registry/registry.c
parentAdding upstream version 1.36.1. (diff)
downloadnetdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.tar.xz
netdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.zip
Adding upstream version 1.37.0.upstream/1.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'registry/registry.c')
-rw-r--r--registry/registry.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/registry/registry.c b/registry/registry.c
index a4f9c6de..e6c2172b 100644
--- a/registry/registry.c
+++ b/registry/registry.c
@@ -61,7 +61,7 @@ static inline void registry_json_header(RRDHOST *host, struct web_client *w, con
buffer_flush(w->response.data);
w->response.data->contenttype = CT_APPLICATION_JSON;
buffer_sprintf(w->response.data, "{\n\t\"action\": \"%s\",\n\t\"status\": \"%s\",\n\t\"hostname\": \"%s\",\n\t\"machine_guid\": \"%s\"",
- action, status, host->registry_hostname, host->machine_guid);
+ action, status, rrdhost_registry_hostname(host), host->machine_guid);
}
static inline void registry_json_footer(struct web_client *w) {
@@ -108,9 +108,7 @@ static int registry_json_person_url_callback(void *entry, void *data) {
}
// callback for rendering MACHINE_URLs
-static int registry_json_machine_url_callback(const char *name, void *entry, void *data) {
- (void)name;
-
+static int registry_json_machine_url_callback(const DICTIONARY_ITEM *item __maybe_unused, void *entry, void *data) {
REGISTRY_MACHINE_URL *mu = (REGISTRY_MACHINE_URL *)entry;
struct registry_json_walk_person_urls_callback *c = (struct registry_json_walk_person_urls_callback *)data;
struct web_client *w = c->w;
@@ -166,10 +164,12 @@ void registry_update_cloud_base_url()
int registry_request_hello_json(RRDHOST *host, struct web_client *w) {
registry_json_header(host, w, "hello", REGISTRY_STATUS_OK);
+ const char *cloud_ui_url = appconfig_get(&cloud_config, CONFIG_SECTION_GLOBAL, "cloud ui url", DEFAULT_CLOUD_UI_URL);
+
buffer_sprintf(w->response.data,
",\n\t\"registry\": \"%s\",\n\t\"cloud_base_url\": \"%s\",\n\t\"anonymous_statistics\": %s",
registry.registry_to_announce,
- registry.cloud_base_url, netdata_anonymous_statistics_enabled?"true":"false");
+ cloud_ui_url, netdata_anonymous_statistics_enabled?"true":"false");
registry_json_footer(w);
return 200;
@@ -379,7 +379,6 @@ void registry_statistics(void) {
rrddim_add(sts, "sessions", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
}
- else rrdset_next(sts);
rrddim_set(sts, "sessions", registry.usages_count);
rrdset_done(sts);
@@ -408,7 +407,6 @@ void registry_statistics(void) {
rrddim_add(stc, "persons_urls", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(stc, "machines_urls", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
}
- else rrdset_next(stc);
rrddim_set(stc, "persons", registry.persons_count);
rrddim_set(stc, "machines", registry.machines_count);
@@ -441,10 +439,9 @@ void registry_statistics(void) {
rrddim_add(stm, "persons_urls", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(stm, "machines_urls", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
}
- else rrdset_next(stm);
- rrddim_set(stm, "persons", registry.persons_memory + dictionary_stats_allocated_memory(registry.persons));
- rrddim_set(stm, "machines", registry.machines_memory + dictionary_stats_allocated_memory(registry.machines));
+ rrddim_set(stm, "persons", registry.persons_memory + dictionary_stats_for_registry(registry.persons));
+ rrddim_set(stm, "machines", registry.machines_memory + dictionary_stats_for_registry(registry.machines));
rrddim_set(stm, "urls", registry.urls_memory);
rrddim_set(stm, "persons_urls", registry.persons_urls_memory);
rrddim_set(stm, "machines_urls", registry.machines_urls_memory);