summaryrefslogtreecommitdiffstats
path: root/web/api/formatters
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/formatters')
-rw-r--r--web/api/formatters/charts2json.c4
-rw-r--r--web/api/formatters/csv/csv.c7
-rw-r--r--web/api/formatters/json/json.c7
-rw-r--r--web/api/formatters/json_wrapper.c15
-rw-r--r--web/api/formatters/rrdset2json.c8
-rw-r--r--web/api/formatters/ssv/ssv.c4
6 files changed, 24 insertions, 21 deletions
diff --git a/web/api/formatters/charts2json.c b/web/api/formatters/charts2json.c
index 4b6b095c2..2ad068d89 100644
--- a/web/api/formatters/charts2json.c
+++ b/web/api/formatters/charts2json.c
@@ -10,7 +10,7 @@ const char* get_release_channel() {
if (use_stable == -1) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s/.environment", netdata_configured_user_config_dir);
- procfile *ff = procfile_open(filename, "=", PROCFILE_FLAG_ERROR_ON_ERROR_LOG);
+ procfile *ff = procfile_open(filename, "=", PROCFILE_FLAG_NO_ERROR_ON_FILE_IO);
if (ff) {
procfile_set_quotes(ff, "'\"");
ff = procfile_readall(ff);
@@ -53,7 +53,7 @@ void charts2json(RRDHOST *host, BUFFER *wb, int skip_volatile, int show_archived
",\n\t\"os\": \"%s\""
",\n\t\"timezone\": \"%s\""
",\n\t\"update_every\": %d"
- ",\n\t\"history\": %ld"
+ ",\n\t\"history\": %d"
",\n\t\"memory_mode\": \"%s\""
",\n\t\"custom_info\": \"%s\""
",\n\t\"charts\": {"
diff --git a/web/api/formatters/csv/csv.c b/web/api/formatters/csv/csv.c
index 8f4950ddd..d81ddb34e 100644
--- a/web/api/formatters/csv/csv.c
+++ b/web/api/formatters/csv/csv.c
@@ -4,7 +4,7 @@
#include "csv.h"
void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const char *startline, const char *separator, const char *endline, const char *betweenlines) {
- //info("RRD2CSV(): %s: BEGIN", r->st->id);
+ //netdata_log_info("RRD2CSV(): %s: BEGIN", r->st->id);
long c, i;
const long used = (long)r->d;
@@ -79,7 +79,8 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const
else {
// generate the local date time
struct tm tmbuf, *tm = localtime_r(&now, &tmbuf);
- if(!tm) { error("localtime() failed."); continue; }
+ if(!tm) {
+ netdata_log_error("localtime() failed."); continue; }
buffer_date(wb, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
}
@@ -104,5 +105,5 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const
buffer_strcat(wb, endline);
}
- //info("RRD2CSV(): %s: END", r->st->id);
+ //netdata_log_info("RRD2CSV(): %s: END", r->st->id);
}
diff --git a/web/api/formatters/json/json.c b/web/api/formatters/json/json.c
index 3a7a23ba1..7e3f400e9 100644
--- a/web/api/formatters/json/json.c
+++ b/web/api/formatters/json/json.c
@@ -6,7 +6,7 @@
#define JSON_DATES_TIMESTAMP 2
void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) {
- //info("RRD2JSON(): %s: BEGIN", r->st->id);
+ //netdata_log_info("RRD2JSON(): %s: BEGIN", r->st->id);
int row_annotations = 0, dates, dates_with_new = 0;
char kq[2] = "", // key quote
sq[2] = "", // string quote
@@ -159,7 +159,8 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) {
if(dates == JSON_DATES_JS) {
// generate the local date time
struct tm tmbuf, *tm = localtime_r(&now, &tmbuf);
- if(!tm) { error("localtime_r() failed."); continue; }
+ if(!tm) {
+ netdata_log_error("localtime_r() failed."); continue; }
if(likely(i != start)) buffer_fast_strcat(wb, ",\n", 2);
buffer_fast_strcat(wb, pre_date, pre_date_len);
@@ -241,7 +242,7 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) {
}
buffer_strcat(wb, finish);
- //info("RRD2JSON(): %s: END", r->st->id);
+ //netdata_log_info("RRD2JSON(): %s: END", r->st->id);
}
void rrdr2json_v2(RRDR *r, BUFFER *wb) {
diff --git a/web/api/formatters/json_wrapper.c b/web/api/formatters/json_wrapper.c
index 6bcbb8d5a..6a66cbcca 100644
--- a/web/api/formatters/json_wrapper.c
+++ b/web/api/formatters/json_wrapper.c
@@ -250,7 +250,7 @@ static void query_target_summary_nodes_v2(BUFFER *wb, QUERY_TARGET *qt, const ch
QUERY_NODE *qn = query_node(qt, c);
RRDHOST *host = qn->rrdhost;
buffer_json_add_array_item_object(wb);
- buffer_json_node_add_v2(wb, host, qn->slot, qn->duration_ut);
+ buffer_json_node_add_v2(wb, host, qn->slot, qn->duration_ut, true);
query_target_instance_counts(wb, &qn->instances);
query_target_metric_counts(wb, &qn->metrics);
query_target_alerts_counts(wb, &qn->alerts, NULL, false);
@@ -615,7 +615,7 @@ static void query_target_summary_alerts_v2(BUFFER *wb, QUERY_TARGET *qt, const c
QUERY_INSTANCE *qi = query_instance(qt, c);
RRDSET *st = rrdinstance_acquired_rrdset(qi->ria);
if (st) {
- netdata_rwlock_rdlock(&st->alerts.rwlock);
+ rw_spinlock_read_lock(&st->alerts.spinlock);
if (st->alerts.base) {
for (RRDCALC *rc = st->alerts.base; rc; rc = rc->next) {
z = dictionary_set(dict, string2str(rc->name), NULL, sizeof(*z));
@@ -642,7 +642,7 @@ static void query_target_summary_alerts_v2(BUFFER *wb, QUERY_TARGET *qt, const c
}
}
}
- netdata_rwlock_unlock(&st->alerts.rwlock);
+ rw_spinlock_read_unlock(&st->alerts.spinlock);
}
}
dfe_start_read(dict, z)
@@ -665,7 +665,7 @@ static inline void query_target_functions(BUFFER *wb, const char *key, RRDR *r)
continue;
ria = qi->ria;
- chart_functions_to_dict(rrdinstance_acquired_functions(ria), funcs);
+ chart_functions_to_dict(rrdinstance_acquired_functions(ria), funcs, NULL, 0);
}
buffer_json_member_add_array(wb, key);
@@ -931,7 +931,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb) {
static void rrdset_rrdcalc_entries_v2(BUFFER *wb, RRDINSTANCE_ACQUIRED *ria) {
RRDSET *st = rrdinstance_acquired_rrdset(ria);
if(st) {
- netdata_rwlock_rdlock(&st->alerts.rwlock);
+ rw_spinlock_read_lock(&st->alerts.spinlock);
if(st->alerts.base) {
buffer_json_member_add_object(wb, "alerts");
for(RRDCALC *rc = st->alerts.base; rc ;rc = rc->next) {
@@ -946,7 +946,7 @@ static void rrdset_rrdcalc_entries_v2(BUFFER *wb, RRDINSTANCE_ACQUIRED *ria) {
}
buffer_json_object_close(wb);
}
- netdata_rwlock_unlock(&st->alerts.rwlock);
+ rw_spinlock_read_unlock(&st->alerts.spinlock);
}
}
@@ -1268,6 +1268,7 @@ static void query_target_detailed_objects_tree(BUFFER *wb, RRDR *r, RRDR_OPTIONS
void version_hashes_api_v2(BUFFER *wb, struct query_versions *versions) {
buffer_json_member_add_object(wb, "versions");
+ buffer_json_member_add_uint64(wb, "routing_hard_hash", 1);
buffer_json_member_add_uint64(wb, "nodes_hard_hash", dictionary_version(rrdhost_root_index));
buffer_json_member_add_uint64(wb, "contexts_hard_hash", versions->contexts_hard_hash);
buffer_json_member_add_uint64(wb, "contexts_soft_hash", versions->contexts_soft_hash);
@@ -1569,7 +1570,7 @@ void rrdr_json_wrapper_end2(RRDR *r, BUFFER *wb) {
}
buffer_json_object_close(wb); // view
- buffer_json_agents_array_v2(wb, &r->internal.qt->timings, 0);
+ buffer_json_agents_v2(wb, &r->internal.qt->timings, 0, false, true);
buffer_json_cloud_timings(wb, "timings", &r->internal.qt->timings);
buffer_json_finalize(wb);
}
diff --git a/web/api/formatters/rrdset2json.c b/web/api/formatters/rrdset2json.c
index 156f4486b..04250dd68 100644
--- a/web/api/formatters/rrdset2json.c
+++ b/web/api/formatters/rrdset2json.c
@@ -37,7 +37,7 @@ void rrdset2json(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memor
"\t\t\t\"family\": \"%s\",\n"
"\t\t\t\"context\": \"%s\",\n"
"\t\t\t\"title\": \"%s (%s)\",\n"
- "\t\t\t\"priority\": %ld,\n"
+ "\t\t\t\"priority\": %d,\n"
"\t\t\t\"plugin\": \"%s\",\n"
"\t\t\t\"module\": \"%s\",\n"
"\t\t\t\"units\": \"%s\",\n"
@@ -90,7 +90,7 @@ void rrdset2json(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memor
rrddim_foreach_read(rd, st) {
if(rrddim_option_check(rd, RRDDIM_OPTION_HIDDEN) || rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE)) continue;
- memory += sizeof(RRDDIM) + rd->memsize;
+ memory += rrddim_size() + rd->db.memsize;
if (dimensions)
buffer_strcat(wb, ",\n\t\t\t\t\"");
@@ -120,7 +120,7 @@ void rrdset2json(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memor
buffer_strcat(wb, ",\n\t\t\t\"alarms\": {\n");
size_t alarms = 0;
RRDCALC *rc;
- netdata_rwlock_rdlock(&st->alerts.rwlock);
+ rw_spinlock_read_lock(&st->alerts.spinlock);
DOUBLE_LINKED_LIST_FOREACH_FORWARD(st->alerts.base, rc, prev, next) {
buffer_sprintf(
wb,
@@ -136,7 +136,7 @@ void rrdset2json(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memor
alarms++;
}
- netdata_rwlock_unlock(&st->alerts.rwlock);
+ rw_spinlock_read_unlock(&st->alerts.spinlock);
buffer_sprintf(wb,
"\n\t\t\t}"
);
diff --git a/web/api/formatters/ssv/ssv.c b/web/api/formatters/ssv/ssv.c
index 65de0464b..2eb26b459 100644
--- a/web/api/formatters/ssv/ssv.c
+++ b/web/api/formatters/ssv/ssv.c
@@ -3,7 +3,7 @@
#include "ssv.h"
void rrdr2ssv(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, const char *prefix, const char *separator, const char *suffix) {
- //info("RRD2SSV(): %s: BEGIN", r->st->id);
+ //netdata_log_info("RRD2SSV(): %s: BEGIN", r->st->id);
long i;
buffer_strcat(wb, prefix);
@@ -41,5 +41,5 @@ void rrdr2ssv(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, const char *prefix, con
buffer_print_netdata_double(wb, v);
}
buffer_strcat(wb, suffix);
- //info("RRD2SSV(): %s: END", r->st->id);
+ //netdata_log_info("RRD2SSV(): %s: END", r->st->id);
}