summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aclk/aclk.c2
-rw-r--r--aclk/aclk_otp.c8
-rw-r--r--aclk/aclk_query.c12
-rw-r--r--aclk/https_client.c4
-rw-r--r--collectors/apps.plugin/apps_plugin.c2
-rw-r--r--collectors/diskspace.plugin/plugin_diskspace.c2
-rw-r--r--collectors/plugins.d/pluginsd_parser.c2
-rw-r--r--collectors/proc.plugin/proc_self_mountinfo.c5
-rw-r--r--collectors/proc.plugin/proc_spl_kstat_zfs.c2
-rw-r--r--collectors/proc.plugin/sys_block_zram.c2
-rw-r--r--collectors/statsd.plugin/statsd.c20
-rw-r--r--collectors/tc.plugin/plugin_tc.c7
-rw-r--r--daemon/analytics.c12
-rw-r--r--daemon/commands.c2
-rw-r--r--daemon/global_statistics.c257
-rw-r--r--daemon/global_statistics.h28
-rw-r--r--daemon/main.c5
-rw-r--r--daemon/service.c6
-rw-r--r--daemon/unit_test.c30
-rw-r--r--database/engine/cache.c43
-rw-r--r--database/engine/cache.h4
-rw-r--r--database/engine/datafile.c30
-rw-r--r--database/engine/journalfile.c27
-rw-r--r--database/engine/metric.c36
-rw-r--r--database/engine/pagecache.c12
-rw-r--r--database/ram/rrddim_mem.c9
-rw-r--r--database/rrd.h44
-rw-r--r--database/rrdcalc.c2
-rw-r--r--database/rrdcalctemplate.c2
-rw-r--r--database/rrdcontext.c91
-rw-r--r--database/rrddim.c60
-rw-r--r--database/rrddimvar.c2
-rw-r--r--database/rrdfamily.c2
-rw-r--r--database/rrdfunctions.c4
-rw-r--r--database/rrdhost.c21
-rw-r--r--database/rrdlabels.c2
-rw-r--r--database/rrdset.c35
-rw-r--r--database/rrdsetvar.c2
-rw-r--r--database/rrdvar.c2
-rw-r--r--database/sqlite/sqlite_aclk.c8
-rw-r--r--database/sqlite/sqlite_aclk_alert.c18
-rw-r--r--database/sqlite/sqlite_metadata.c7
-rw-r--r--exporting/graphite/graphite.c4
-rw-r--r--exporting/init_connectors.c6
-rw-r--r--exporting/json/json.c6
-rw-r--r--exporting/mongodb/mongodb.c2
-rw-r--r--exporting/opentsdb/opentsdb.c8
-rw-r--r--exporting/process_data.c14
-rw-r--r--exporting/prometheus/prometheus.c2
-rw-r--r--exporting/prometheus/remote_write/remote_write.c2
-rw-r--r--exporting/send_data.c2
-rw-r--r--exporting/send_internal_metrics.c2
-rw-r--r--health/health.c6
-rw-r--r--health/health_log.c8
-rw-r--r--libnetdata/arrayalloc/arrayalloc.c12
-rw-r--r--libnetdata/buffer/buffer.c60
-rw-r--r--libnetdata/buffer/buffer.h3
-rw-r--r--libnetdata/circular_buffer/circular_buffer.c30
-rw-r--r--libnetdata/circular_buffer/circular_buffer.h3
-rw-r--r--libnetdata/dictionary/dictionary.c6
-rw-r--r--libnetdata/dictionary/dictionary.h2
-rw-r--r--libnetdata/eval/eval.c4
-rw-r--r--libnetdata/json/json.c2
-rw-r--r--libnetdata/libnetdata.h2
-rw-r--r--libnetdata/onewayalloc/onewayalloc.c13
-rw-r--r--libnetdata/onewayalloc/onewayalloc.h2
-rw-r--r--libnetdata/string/string.c35
-rw-r--r--libnetdata/worker_utilization/worker_utilization.c19
-rw-r--r--libnetdata/worker_utilization/worker_utilization.h1
-rw-r--r--ml/Query.h8
-rw-r--r--parser/parser.c2
-rw-r--r--streaming/receiver.c2
-rw-r--r--streaming/replication.c64
-rw-r--r--streaming/replication.h3
-rw-r--r--streaming/rrdpush.c15
-rw-r--r--streaming/rrdpush.h13
-rw-r--r--streaming/sender.c104
-rw-r--r--web/api/badges/web_buffer_svg.c2
-rw-r--r--web/api/health/health_cmdapi.c2
-rw-r--r--web/api/queries/query.c8
-rw-r--r--web/api/web_api_v1.c8
-rw-r--r--web/server/web_client_cache.c8
-rw-r--r--web/server/web_server.c2
83 files changed, 923 insertions, 445 deletions
diff --git a/aclk/aclk.c b/aclk/aclk.c
index daa4a17642..1a6ebe5509 100644
--- a/aclk/aclk.c
+++ b/aclk/aclk.c
@@ -947,7 +947,7 @@ char *aclk_state(void)
#ifndef ENABLE_ACLK
return strdupz("ACLK Available: No");
#else
- BUFFER *wb = buffer_create(1024);
+ BUFFER *wb = buffer_create(1024, &netdata_buffers_statistics.buffers_aclk);
struct tm *tmptr, tmbuf;
char *ret;
diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c
index 940d5bdbe5..391313ffe7 100644
--- a/aclk/aclk_otp.c
+++ b/aclk/aclk_otp.c
@@ -314,7 +314,7 @@ int aclk_get_otp_challenge(url_t *target, const char *agent_id, unsigned char **
https_req_t req = HTTPS_REQ_T_INITIALIZER;
https_req_response_t resp = HTTPS_REQ_RESPONSE_T_INITIALIZER;
- BUFFER *url = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20);
+ BUFFER *url = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20, &netdata_buffers_statistics.buffers_aclk);
req.host = target->host;
req.port = target->port;
@@ -394,8 +394,8 @@ int aclk_send_otp_response(const char *agent_id, const unsigned char *response,
base64_encode_helper(base64, &len, response, response_bytes);
- BUFFER *url = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20);
- BUFFER *resp_json = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20);
+ BUFFER *url = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20, &netdata_buffers_statistics.buffers_aclk);
+ BUFFER *resp_json = buffer_create(strlen(OTP_URL_PREFIX) + UUID_STR_LEN + 20, &netdata_buffers_statistics.buffers_aclk);
buffer_sprintf(url, "%s/node/%s/password", target->path, agent_id);
buffer_sprintf(resp_json, "{\"response\":\"%s\"}", base64);
@@ -814,7 +814,7 @@ exit:
}
int aclk_get_env(aclk_env_t *env, const char* aclk_hostname, int aclk_port) {
- BUFFER *buf = buffer_create(1024);
+ BUFFER *buf = buffer_create(1024, &netdata_buffers_statistics.buffers_aclk);
https_req_t req = HTTPS_REQ_T_INITIALIZER;
https_req_response_t resp = HTTPS_REQ_RESPONSE_T_INITIALIZER;
diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c
index 3abe21b090..9eced08111 100644
--- a/aclk/aclk_query.c
+++ b/aclk/aclk_query.c
@@ -62,19 +62,19 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
int retval = 0;
usec_t t;
BUFFER *local_buffer = NULL;
- BUFFER *log_buffer = buffer_create(NETDATA_WEB_REQUEST_URL_SIZE);
+ BUFFER *log_buffer = buffer_create(NETDATA_WEB_REQUEST_URL_SIZE, &netdata_buffers_statistics.buffers_aclk);
RRDHOST *query_host = localhost;
#ifdef NETDATA_WITH_ZLIB
int z_ret;
- BUFFER *z_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE);
+ BUFFER *z_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE, &netdata_buffers_statistics.buffers_aclk);
char *start, *end;
#endif
struct web_client *w = (struct web_client *)callocz(1, sizeof(struct web_client));
- w->response.data = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE);
- w->response.header = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
- w->response.header_output = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
+ w->response.data = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE, &netdata_buffers_statistics.buffers_aclk);
+ w->response.header = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE, &netdata_buffers_statistics.buffers_aclk);
+ w->response.header_output = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE, &netdata_buffers_statistics.buffers_aclk);
strcpy(w->origin, "*"); // Simulate web_client_create_on_fd()
w->cookie1[0] = 0; // Simulate web_client_create_on_fd()
w->cookie2[0] = 0; // Simulate web_client_create_on_fd()
@@ -191,7 +191,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
w->response.data->date = w->tv_ready.tv_sec;
web_client_build_http_header(w);
- local_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE);
+ local_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE, &netdata_buffers_statistics.buffers_aclk);
local_buffer->contenttype = CT_APPLICATION_JSON;
buffer_strcat(local_buffer, w->response.header_output->buffer);
diff --git a/aclk/https_client.c b/aclk/https_client.c
index 8af85f8546..e2a42eef38 100644
--- a/aclk/https_client.c
+++ b/aclk/https_client.c
@@ -8,6 +8,8 @@
#include "aclk_util.h"
+#include "daemon/global_statistics.h"
+
enum http_parse_state {
HTTP_PARSE_INITIAL = 0,
HTTP_PARSE_HEADERS,
@@ -354,7 +356,7 @@ static int read_parse_response(https_req_ctx_t *ctx) {
#define TX_BUFFER_SIZE 8192
#define RX_BUFFER_SIZE (TX_BUFFER_SIZE*2)
static int handle_http_request(https_req_ctx_t *ctx) {
- BUFFER *hdr = buffer_create(TX_BUFFER_SIZE);
+ BUFFER *hdr = buffer_create(TX_BUFFER_SIZE, &netdata_buffers_statistics.buffers_aclk);
int rc = 0;
http_parse_ctx_clear(&ctx->parse_ctx);
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c
index 8cc39c8dbe..565d99c48b 100644
--- a/collectors/apps.plugin/apps_plugin.c
+++ b/collectors/apps.plugin/apps_plugin.c
@@ -4396,7 +4396,7 @@ static void apps_plugin_function_processes(const char *transaction, char *functi
unsigned int memory_divisor = 1024;
unsigned int io_divisor = 1024 * RATES_DETAIL;
- BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX);
+ BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX, NULL);
buffer_sprintf(wb,
"{"
"\n \"status\":%d"
diff --git a/collectors/diskspace.plugin/plugin_diskspace.c b/collectors/diskspace.plugin/plugin_diskspace.c
index 915c63c4b7..394cfb93c5 100644
--- a/collectors/diskspace.plugin/plugin_diskspace.c
+++ b/collectors/diskspace.plugin/plugin_diskspace.c
@@ -319,7 +319,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
, SIMPLE_PATTERN_EXACT
);
- dict_mountpoints = dictionary_create(DICT_OPTION_NONE);
+ dict_mountpoints = dictionary_create_advanced(DICT_OPTION_NONE, &dictionary_stats_category_collectors);
}
struct mount_point_metadata *m = dictionary_get(dict_mountpoints, mi->mount_point);
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c
index 264d0eca41..50bdc0b301 100644
--- a/collectors/plugins.d/pluginsd_parser.c
+++ b/collectors/plugins.d/pluginsd_parser.c
@@ -530,7 +530,7 @@ static void inflight_functions_delete_callback(const DICTIONARY_ITEM *item __may
}
void inflight_functions_init(PARSER *parser) {
- parser->inflight.functions = dictionary_create(DICT_OPTION_DONT_OVERWRITE_VALUE);
+ parser->inflight.functions = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE, &dictionary_stats_category_functions);
dictionary_register_insert_callback(parser->inflight.functions, inflight_functions_insert_callback, parser);
dictionary_register_delete_callback(parser->inflight.functions, inflight_functions_delete_callback, parser);
dictionary_register_conflict_callback(parser->inflight.functions, inflight_functions_conflict_callback, parser);
diff --git a/collectors/proc.plugin/proc_self_mountinfo.c b/collectors/proc.plugin/proc_self_mountinfo.c
index 9310f2ffc1..71c6b02994 100644
--- a/collectors/proc.plugin/proc_self_mountinfo.c
+++ b/collectors/proc.plugin/proc_self_mountinfo.c
@@ -227,8 +227,9 @@ struct mountinfo *mountinfo_read(int do_statvfs) {
struct mountinfo *root = NULL, *last = NULL, *mi = NULL;
// create a dictionary to track uniqueness
- DICTIONARY *dict = dictionary_create(
- DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_NAME_LINK_DONT_CLONE);
+ DICTIONARY *dict = dictionary_create_advanced(
+ DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_NAME_LINK_DONT_CLONE,
+ &dictionary_stats_category_collectors);
unsigned long l, lines = procfile_lines(ff);
for(l = 0; l < lines ;l++) {
diff --git a/collectors/proc.plugin/proc_spl_kstat_zfs.c b/collectors/proc.plugin/proc_spl_kstat_zfs.c
index 58c84050a7..610379ed9d 100644
--- a/collectors/proc.plugin/proc_spl_kstat_zfs.c
+++ b/collectors/proc.plugin/proc_spl_kstat_zfs.c
@@ -322,7 +322,7 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/spl/kstat/zfs");
dirname = config_get("plugin:proc:" ZFS_PROC_POOLS, "directory to monitor", filename);
- zfs_pools = dictionary_create(DICT_OPTION_SINGLE_THREADED);
+ zfs_pools = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors);
do_zfs_pool_state = 1;
}
diff --git a/collectors/proc.plugin/sys_block_zram.c b/collectors/proc.plugin/sys_block_zram.c
index 6bae542438..4ea015569b 100644
--- a/collectors/proc.plugin/sys_block_zram.c
+++ b/collectors/proc.plugin/sys_block_zram.c
@@ -267,7 +267,7 @@ int do_sys_block_zram(int update_every, usec_t dt) {
}
procfile_close(ff);
- devices = dictionary_create(DICT_OPTION_SINGLE_THREADED);
+ devices = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors);
device_count = init_devices(devices, (unsigned int)zram_id, update_every);
}
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c
index 7a28461a99..e6efdafda2 100644
--- a/collectors/statsd.plugin/statsd.c
+++ b/collectors/statsd.plugin/statsd.c
@@ -595,7 +595,7 @@ static inline void statsd_process_set(STATSD_METRIC *m, const char *value) {
}
if (unlikely(!m->set.dict)) {
- m->set.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
+ m->set.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
dictionary_register_insert_callback(m->set.dict, dictionary_metric_set_value_insert_callback, m);
m->set.unique = 0;
}
@@ -635,7 +635,7 @@ static inline void statsd_process_dictionary(STATSD_METRIC *m, const char *value
statsd_reset_metric(m);
if (unlikely(!m->dictionary.dict)) {
- m->dictionary.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
+ m->dictionary.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
dictionary_register_insert_callback(m->dictionary.dict, dictionary_metric_dict_value_insert_callback, m);
m->dictionary.unique = 0;
}
@@ -1337,7 +1337,7 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
else if(app) {
if(!strcmp(s, "dictionary")) {
if(!app->dict)
- app->dict = dictionary_create(DICT_OPTION_SINGLE_THREADED);
+ app->dict = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors);
dict = app->dict;
}
@@ -2422,13 +2422,13 @@ void *statsd_main(void *ptr) {
netdata_thread_cleanup_push(statsd_main_cleanup, ptr);
- statsd.gauges.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.meters.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.counters.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.histograms.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.dictionaries.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.sets.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
- statsd.timers.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS);
+ statsd.gauges.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.meters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.counters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.histograms.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.dictionaries.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.sets.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
+ statsd.timers.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors);
dictionary_register_insert_callback(statsd.gauges.dict, dictionary_metric_insert_callback, &statsd.gauges);
dictionary_register_insert_callback(statsd.meters.dict, dictionary_metric_insert_callback, &statsd.meters);
diff --git a/collectors/tc.plugin/plugin_tc.c b/collectors/tc.plugin/plugin_tc.c
index 331a787f34..72d86a0ea0 100644
--- a/collectors/tc.plugin/plugin_tc.c
+++ b/collectors/tc.plugin/plugin_tc.c
@@ -98,7 +98,7 @@ static bool tc_class_conflict_callback(const DICTIONARY_ITEM *item __maybe_unuse
static void tc_class_index_init(struct tc_device *d) {
if(!d->classes) {
- d->classes = dictionary_create(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED);
+ d->classes = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors);
dictionary_register_delete_callback(d->classes, tc_class_free_callback, d);
dictionary_register_conflict_callback(d->classes, tc_class_conflict_callback, d);
@@ -144,8 +144,9 @@ static void tc_device_free_callback(const DICTIONARY_ITEM *item __maybe_unused,
static void tc_device_index_init() {
if(!tc_device_root_index) {
- tc_device_root_index = dictionary_create(
- DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED | DICT_OPTION_ADD_IN_FRONT);
+ tc_device_root_index = dictionary_create_advanced(
+ DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED | DICT_OPTION_ADD_IN_FRONT,
+ &dictionary_stats_category_collectors);
dictionary_register_insert_callback(tc_device_root_index, tc_device_add_callback, NULL);
dictionary_register_delete_callback(tc_device_root_index, tc_device_free_callback, NULL);