dont add all nodes to registry action hello (#15390)
Costa Tsaousis committed
Jul 13, 2023 at 22:52 UTC
c5b6c59928327e1a139d4cfe4f921bb104131587
1 file changed
+18
-11
registry/registry.c
+18
-11
@@ -58,7 +58,7 @@ static inline void registry_set_person_cookie(struct web_client *w, REGISTRY_PER
58
static inline void registry_json_header(RRDHOST *host, struct web_client *w, const char *action, const char *status) {
59
buffer_flush(w->response.data);
60
w->response.data->content_type = CT_APPLICATION_JSON;
61
- buffer_json_initialize(w->response.data, "\"", "\"", 0, true, false);
61
+ buffer_json_initialize(w->response.data, "\"", "\"", 0, true, true);
62
buffer_json_member_add_string(w->response.data, "action", action);
63
buffer_json_member_add_string(w->response.data, "status", status);
64
buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(host));
@@ -190,18 +190,25 @@ int registry_request_hello_json(RRDHOST *host, struct web_client *w) {
190
buffer_json_member_add_boolean(w->response.data, "anonymous_statistics", netdata_anonymous_statistics_enabled);
191
192
buffer_json_member_add_array(w->response.data, "nodes");
193
- RRDHOST *h;
194
- dfe_start_read(rrdhost_root_index, h) {
193
+ {
194
buffer_json_add_array_item_object(w->response.data);
196
- buffer_json_member_add_string(w->response.data, "machine_guid", h->machine_guid);
197
-
198
- if(h->node_id)
199
- buffer_json_member_add_uuid(w->response.data, "node_id", h->node_id);
200
-
201
- buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(h));
202
- buffer_json_object_close(w->response.data);
195
+ buffer_json_member_add_string(w->response.data, "machine_guid", host->machine_guid);
196
+ buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(host));
197
}
204
- dfe_done(h);
198
+ buffer_json_object_close(w->response.data); // nodes
199
+
200
+// RRDHOST *h;
201
+// dfe_start_read(rrdhost_root_index, h) {
202
+// buffer_json_add_array_item_object(w->response.data);
203
+// buffer_json_member_add_string(w->response.data, "machine_guid", h->machine_guid);
204
+//
205
+// if(h->node_id)
206
+// buffer_json_member_add_uuid(w->response.data, "node_id", h->node_id);
207
+//
208
+// buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(h));
209
+// buffer_json_object_close(w->response.data);
210
+// }
211
+// dfe_done(h);
212
buffer_json_array_close(w->response.data);
213
214
registry_json_footer(w);