summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am13
-rw-r--r--collectors/apps.plugin/apps_plugin.c2
-rw-r--r--collectors/cgroups.plugin/sys_fs_cgroup.c178
-rw-r--r--collectors/diskspace.plugin/plugin_diskspace.c12
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.c2
-rw-r--r--collectors/proc.plugin/proc_diskstats.c12
-rw-r--r--collectors/proc.plugin/proc_net_dev.c4
-rw-r--r--collectors/proc.plugin/proc_pagetypeinfo.c6
-rw-r--r--collectors/proc.plugin/sys_class_infiniband.c5
-rw-r--r--collectors/statsd.plugin/statsd.c8
-rw-r--r--configure.ac1
-rw-r--r--daemon/main.c34
-rw-r--r--database/Makefile.am1
-rw-r--r--database/contexts/Makefile.am11
-rw-r--r--database/contexts/README.md0
-rw-r--r--database/contexts/api_v1.c439
-rw-r--r--database/contexts/api_v2.c414
-rw-r--r--database/contexts/context.c286
-rw-r--r--database/contexts/instance.c519
-rw-r--r--database/contexts/internal.h389
-rw-r--r--database/contexts/metric.c314
-rw-r--r--database/contexts/query_scope.c84
-rw-r--r--database/contexts/query_target.c1026
-rw-r--r--database/contexts/rrdcontext.c379
-rw-r--r--database/contexts/rrdcontext.h (renamed from database/rrdcontext.h)104
-rw-r--r--database/contexts/worker.c1090
-rw-r--r--database/engine/cache.c2
-rw-r--r--database/engine/rrdengine.c21
-rw-r--r--database/rrd.h13
-rw-r--r--database/rrdcalc.c16
-rw-r--r--database/rrdcalc.h2
-rw-r--r--database/rrdcalctemplate.c15
-rw-r--r--database/rrdcontext.c4249
-rw-r--r--database/rrdhost.c10
-rw-r--r--database/rrdlabels.c17
-rw-r--r--exporting/check_filters.c2
-rw-r--r--exporting/prometheus/prometheus.c6
-rw-r--r--exporting/read_config.c14
-rw-r--r--health/health.c40
-rw-r--r--health/health_config.c32
-rw-r--r--libnetdata/buffer/buffer.c14
-rw-r--r--libnetdata/buffer/buffer.h50
-rw-r--r--libnetdata/dictionary/dictionary.c9
-rw-r--r--libnetdata/health/health.c10
-rw-r--r--libnetdata/simple_pattern/simple_pattern.c140
-rw-r--r--libnetdata/simple_pattern/simple_pattern.h16
-rw-r--r--ml/Config.cc4
-rw-r--r--ml/ad_charts.cc2
-rw-r--r--ml/nml.cc9
-rw-r--r--streaming/replication.c40
-rw-r--r--streaming/rrdpush.c8
-rw-r--r--web/api/exporters/shell/allmetrics_shell.c8
-rw-r--r--web/api/formatters/json_wrapper.c472
-rw-r--r--web/api/formatters/json_wrapper.h13
-rw-r--r--web/api/formatters/rrd2json.c237
-rw-r--r--web/api/formatters/rrd2json.h3
-rw-r--r--web/api/formatters/value/value.c10
-rw-r--r--web/api/queries/query.c87
-rw-r--r--web/api/queries/rrdr.h65
-rw-r--r--web/api/queries/weights.c4
-rw-r--r--web/api/web_api.c32
-rw-r--r--web/api/web_api_v1.c64
-rw-r--r--web/api/web_api_v2.c69
63 files changed, 6190 insertions, 4948 deletions
diff --git a/Makefile.am b/Makefile.am
index a592c1a321..27432b3923 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -410,12 +410,21 @@ PLUGINSD_PLUGIN_FILES = \
$(NULL)
RRD_PLUGIN_FILES = \
+ database/contexts/rrdcontext.c \
+ database/contexts/rrdcontext.h \
+ database/contexts/metric.c \
+ database/contexts/instance.c \
+ database/contexts/context.c \
+ database/contexts/worker.c \
+ database/contexts/query_target.c \
+ database/contexts/query_scope.c \
+ database/contexts/api_v1.c \
+ database/contexts/api_v2.c \
+ database/contexts/internal.h \
database/rrdcalc.c \
database/rrdcalc.h \
database/rrdcalctemplate.c \
database/rrdcalctemplate.h \
- database/rrdcontext.c \
- database/rrdcontext.h \
database/rrddim.c \
database/rrddimvar.c \
database/rrddimvar.h \
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c
index 7e939053e0..e29e9aeaec 100644
--- a/collectors/apps.plugin/apps_plugin.c
+++ b/collectors/apps.plugin/apps_plugin.c
@@ -4400,7 +4400,7 @@ static void apps_plugin_function_processes(const char *transaction, char *functi
unsigned int io_divisor = 1024 * RATES_DETAIL;
BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX, NULL);
- buffer_json_initialize(wb, "\"", "\"", 0, true);
+ buffer_json_initialize(wb, "\"", "\"", 0, true, false);
buffer_json_member_add_uint64(wb, "status", HTTP_RESP_OK);
buffer_json_member_add_string(wb, "type", "table");
buffer_json_member_add_time_t(wb, "update_every", update_every);
diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c
index cca611f442..e8b6b603e8 100644
--- a/collectors/cgroups.plugin/sys_fs_cgroup.c
+++ b/collectors/cgroups.plugin/sys_fs_cgroup.c
@@ -449,70 +449,70 @@ void read_cgroup_plugin_configuration() {
config_get("plugin:cgroups", "enable by default cgroups matching",
// ----------------------------------------------------------------
- " !*/init.scope " // ignore init.scope
- " !/system.slice/run-*.scope " // ignore system.slice/run-XXXX.scope
- " *.scope " // we need all other *.scope for sure
-
- // ----------------------------------------------------------------
-
- " /machine.slice/*.service " // #3367 systemd-nspawn
-
- // ----------------------------------------------------------------
-
- " */kubepods/pod*/* " // k8s containers
- " */kubepods/*/pod*/* " // k8s containers
- " */*-kubepods-pod*/* " // k8s containers
- " */*-kubepods-*-pod*/* " // k8s containers
- " !*kubepods* !*kubelet* " // all other k8s cgroups
-
- // ----------------------------------------------------------------
-
- " !*/vcpu* " // libvirtd adds these sub-cgroups
- " !*/emulator " // libvirtd adds these sub-cgroups
- " !*.mount "
- " !*.partition "
- " !*.service "
- " !*.socket "
- " !*.slice "
- " !*.swap "
- " !*.user "
- " !/ "
- " !/docker "
- " !*/libvirt "
- " !/lxc "
- " !/lxc/*/* " // #1397 #2649
- " !/lxc.monitor* "
- " !/lxc.pivot "
- " !/lxc.payload "
- " !/machine "
- " !/qemu "
- " !/system "
- " !/systemd "
- " !/user "
- " * " // enable anything else
- ), NULL, SIMPLE_PATTERN_EXACT);
+ " !*/init.scope " // ignore init.scope
+ " !/system.slice/run-*.scope " // ignore system.slice/run-XXXX.scope
+ " *.scope " // we need all other *.scope for sure
+
+ // ----------------------------------------------------------------
+
+ " /machine.slice/*.service " // #3367 systemd-nspawn
+
+ // ----------------------------------------------------------------
+
+ " */kubepods/pod*/* " // k8s containers
+ " */kubepods/*/pod*/* " // k8s containers
+ " */*-kubepods-pod*/* " // k8s containers
+ " */*-kubepods-*-pod*/* " // k8s containers
+ " !*kubepods* !*kubelet* " // all other k8s cgroups
+
+ // ----------------------------------------------------------------
+
+ " !*/vcpu* " // libvirtd adds these sub-cgroups
+ " !*/emulator " // libvirtd adds these sub-cgroups
+ " !*.mount "
+ " !*.partition "
+ " !*.service "
+ " !*.socket "
+ " !*.slice "
+ " !*.swap "
+ " !*.user "
+ " !/ "
+ " !/docker "
+ " !*/libvirt "
+ " !/lxc "
+ " !/lxc/*/* " // #1397 #2649
+ " !/lxc.monitor* "
+ " !/lxc.pivot "
+ " !/lxc.payload "
+ " !/machine "
+ " !/qemu "
+ " !/system "
+ " !/systemd "
+ " !/user "
+ " * " // enable anything else
+ ), NULL, SIMPLE_PATTERN_EXACT, true);
enabled_cgroup_names = simple_pattern_create(
config_get("plugin:cgroups", "enable by default cgroups names matching",
- " * "
- ), NULL, SIMPLE_PATTERN_EXACT);
+ " * "
+ ), NULL, SIMPLE_PATTERN_EXACT, true);
search_cgroup_paths = simple_pattern_create(
config_get("plugin:cgroups", "search for cgroups in subpaths matching",
- " !*/init.scope " // ignore init.scope
- " !*-qemu " // #345
- " !*.libvirt-qemu " // #3010
- " !/init.scope "
- " !/system "
- " !/systemd "
- " !/user "
- " !/user.slice "
- " !/lxc/*/* " // #2161 #2649
- " !/lxc.monitor "
- " !/lxc.payload/*/* "
- " !/lxc.payload.* "
- " * "
- ), NULL, SIMPLE_PATTERN_EXACT);
+ " !*/init.scope " // ignore init.scope
+ " !*-qemu " // #345
+ " !*.libvirt-qemu " // #3010
+ " !/init.scope "
+ " !/system "
+ " !/systemd "
+ " !/user "
+ " !/user.slice "
+ " !/lxc/*/* " // #2161 #2649
+ " !/lxc.monitor "
+ " !/lxc.payload/*/* "
+ " !/lxc.payload.* "
+ " * "
+ ), NULL, SIMPLE_PATTERN_EXACT, true);
snprintfz(filename, FILENAME_MAX, "%s/cgroup-name.sh", netdata_configured_primary_plugins_dir);
cgroups_rename_script = config_get("plugin:cgroups", "script to get cgroup names", filename);
@@ -522,37 +522,37 @@ void read_cgroup_plugin_configuration() {
enabled_cgroup_renames = simple_pattern_create(
config_get("plugin:cgroups", "run script to rename cgroups matching",
- " !/ "
- " !*.mount "
- " !*.socket "
- " !*.partition "
- " /machine.slice/*.service " // #3367 systemd-nspawn
- " !*.service "
- " !*.slice "
- " !*.swap "
- " !*.user "
- " !init.scope "
- " !*.scope/vcpu* " // libvirtd adds these sub-cgroups
- " !*.scope/emulator " // libvirtd adds these sub-cgroups
- " *.scope "
- " *docker* "
- " *lxc* "
- " *qemu* "
- " */kubepods/pod*/* " // k8s containers
- " */kubepods/*/pod*/* " // k8s containers
- " */*-kubepods-pod*/* " // k8s containers
- " */*-kubepods-*-pod*/* " // k8s containers
- " !*kubepods* !*kubelet* " // all other k8s cgroups
- " *.libvirt-qemu " // #3010
- " * "
- ), NULL, SIMPLE_PATTERN_EXACT);
+ " !/ "
+ " !*.mount "
+ " !*.socket "
+ " !*.partition "
+ " /machine.slice/*.service " // #3367 systemd-nspawn
+ " !*.service "
+ " !*.slice "
+ " !*.swap "
+ " !*.user "
+ " !init.scope "
+ " !*.scope/vcpu* " // libvirtd adds these sub-cgroups
+ " !*.scope/emulator " // libvirtd adds these sub-cgroups
+ " *.scope "
+ " *docker* "
+ " *lxc* "
+ " *qemu* "
+ " */kubepods/pod*/* " // k8s containers
+ " */kubepods/*/pod*/* " // k8s containers
+ " */*-kubepods-pod*/* " // k8s containers
+ " */*-kubepods-*-pod*/* " // k8s containers
+ " !*kubepods* !*kubelet* " // all other k8s cgroups
+ " *.libvirt-qemu " // #3010
+ " * "
+ ), NULL, SIMPLE_PATTERN_EXACT, true);
if(cgroup_enable_systemd_services) {
systemd_services_cgroups = simple_pattern_create(
config_get("plugin:cgroups", "cgroups to match as systemd services",
- " !/system.slice/*/*.service "
- " /system.slice/*.service "
- ), NULL, SIMPLE_PATTERN_EXACT);
+ " !/system.slice/*/*.service "
+ " /system.slice/*.service "
+ ), NULL, SIMPLE_PATTERN_EXACT, true);
}
mountinfo_free_all(root);
@@ -2784,10 +2784,10 @@ void cgroup_discovery_worker(void *ptr)
worker_register_job_name(WORKER_DISCOVERY_LOCK, "lock");
entrypoint_parent_process_comm = simple_pattern_create(
- " runc:[* " // http://terenceli.github.io/%E6%8A%80%E6%9C%AF/2021/12/28/runc-internals-3)
- " exe ", // https://github.com/falcosecurity/falco/blob/9d41b0a151b83693929d3a9c84f7c5c85d070d3a/rules/falco_rules.yaml#L1961
- NULL,
- SIMPLE_PATTERN_EXACT);
+ " runc:[* " // http://terenceli.github.io/%E6%8A%80%E6%9C%AF/2021/12/28/runc-internals-3)
+ " exe ", // https://github.com/falcosecurity/falco/blob/9d41b0a151b83693929d3a9c84f7c5c85d070d3a/rules/falco_rules.yaml#L1961
+ NULL,
+ SIMPLE_PATTERN_EXACT, true);
while (service_running(SERVICE_COLLECTORS)) {
worker_is_idle();
diff --git a/collectors/diskspace.plugin/plugin_diskspace.c b/collectors/diskspace.plugin/plugin_diskspace.c
index 743612ffb1..48e4288d61 100644
--- a/collectors/diskspace.plugin/plugin_diskspace.c
+++ b/collectors/diskspace.plugin/plugin_diskspace.c
@@ -308,16 +308,12 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
}
excluded_mountpoints = simple_pattern_create(
- config_get(CONFIG_SECTION_DISKSPACE, "exclude space metrics on paths", DEFAULT_EXCLUDED_PATHS)
- , NULL
- , mode
- );
+ config_get(CONFIG_SECTION_DISKSPACE, "exclude space metrics on paths", DEFAULT_EXCLUDED_PATHS), NULL,
+ mode, true);
excluded_filesystems = simple_pattern_create(
- config_get(CONFIG_SECTION_DISKSPACE, "exclude space metrics on filesystems", DEFAULT_EXCLUDED_FILESYSTEMS)
- , NULL
- , SIMPLE_PATTERN_EXACT
- );
+ config_get(CONFIG_SECTION_DISKSPACE, "exclude space metrics on filesystems",
+ DEFAULT_EXCLUDED_FILESYSTEMS), NULL, SIMPLE_PATTERN_EXACT, true);
dict_mountpoints = dictionary_create_advanced(DICT_OPTION_NONE, &dictionary_stats_category_collectors, 0);
}
diff --git a/collectors/ebpf.plugin/ebpf_socket.c b/collectors/ebpf.plugin/ebpf_socket.c
index 450f8cf383..02c6849c1e 100644
--- a/collectors/ebpf.plugin/ebpf_socket.c
+++ b/collectors/ebpf.plugin/ebpf_socket.c
@@ -3767,7 +3767,7 @@ static void link_hostnames(char *parse)
ebpf_network_viewer_hostname_list_t *hostname = callocz(1 , sizeof(ebpf_network_viewer_hostname_list_t));
hostname->value = strdupz(parse);
hostname->hash = simple_hash(parse);
- hostname->value_pattern = simple_pattern_create(parse, NULL, SIMPLE_PATTERN_EXACT);
+ hostname->value_pattern = simple_pattern_create(parse, NULL, SIMPLE_PATTERN_EXACT, true);
link_hostname((!neg)?&network_viewer_opt.included_hostnames:&network_viewer_opt.excluded_hostnames,
hostname);
diff --git a/collectors/proc.plugin/proc_diskstats.c b/collectors/proc.plugin/proc_diskstats.c
index f66d20b44b..2a4fe4f8c2 100644
--- a/collectors/proc.plugin/proc_diskstats.c
+++ b/collectors/proc.plugin/proc_diskstats.c
@@ -934,16 +934,12 @@ int do_proc_diskstats(int update_every, usec_t dt) {
name_disks_by_id = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "name disks by id", name_disks_by_id);
preferred_ids = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "preferred disk ids", DEFAULT_PREFERRED_IDS)
- , NULL
- , SIMPLE_PATTERN_EXACT
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "preferred disk ids", DEFAULT_PREFERRED_IDS), NULL,
+ SIMPLE_PATTERN_EXACT, true);
excluded_disks = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS)
- , NULL
- , SIMPLE_PATTERN_EXACT
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS), NULL,
+ SIMPLE_PATTERN_EXACT, true);
}
// --------------------------------------------------------------------------
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index 3ec8783bd2..9e8127cb67 100644
--- a/collectors/proc.plugin/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -725,7 +725,9 @@ int do_proc_net_dev(int update_every, usec_t dt) {
do_carrier = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "carrier for all interfaces", CONFIG_BOOLEAN_AUTO);
do_mtu = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "mtu for all interfaces", CONFIG_BOOLEAN_AUTO);
- disabled_list = simple_pattern_create(config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "disable by default interfaces matching", "lo fireqos* *-ifb fwpr* fwbr* fwln*"), NULL, SIMPLE_PATTERN_EXACT);
+ disabled_list = simple_pattern_create(
+ config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "disable by default interfaces matching",
+ "lo fireqos* *-ifb fwpr* fwbr* fwln*"), NULL, SIMPLE_PATTERN_EXACT, true);
}
if(unlikely(!ff)) {
diff --git a/collectors/proc.plugin/proc_pagetypeinfo.c b/collectors/proc.plugin/proc_pagetypeinfo.c
index 8b8ecec29c..e5318ce8fb 100644
--- a/collectors/proc.plugin/proc_pagetypeinfo.c
+++ b/collectors/proc.plugin/proc_pagetypeinfo.c
@@ -120,10 +120,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
do_global = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "enable system summary", CONFIG_BOOLEAN_YES);
do_detail = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "enable detail per-type", CONFIG_BOOLEAN_AUTO);
filter_types = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "hide charts id matching", "")
- , NULL
- , SIMPLE_PATTERN_SUFFIX
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "hide charts id matching", ""), NULL,
+ SIMPLE_PATTERN_SUFFIX, true);
pagelines_cnt = 0;
diff --git a/collectors/proc.plugin/sys_class_infiniband.c b/collectors/proc.plugin/sys_class_infiniband.c
index 29b805ba62..f0b7f9a52f 100644
--- a/collectors/proc.plugin/sys_class_infiniband.c
+++ b/collectors/proc.plugin/sys_class_infiniband.c
@@ -327,8 +327,9 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
enable_only_active = config_get_boolean_ondemand(
CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "monitor only active ports", CONFIG_BOOLEAN_AUTO);
disabled_list = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "disable by default interfaces matching", ""), NULL,
- SIMPLE_PATTERN_EXACT);
+ config_get(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "disable by default interfaces matching", ""),
+ NULL,
+ SIMPLE_PATTERN_EXACT, true);
dt_to_refresh_ports =
config_get_number(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "refresh ports state every seconds", 30) *
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c
index 343ec42520..838207c982 100644