summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2024-01-11 16:56:45 +0200
committerGitHub <noreply@github.com>2024-01-11 16:56:45 +0200
commitf2b250a1f53af00241522db35f8c85f19ed282e1 (patch)
treee813ca47880e3e2adf09583658efef59633ec6bd
parentbead543ea52e51cf73f7e5b27de53197801399a7 (diff)
dyncfg v2 (#16702)
* split rrdfunctions streaming and progress * simplified internal inline functions API * split rrdfunctions inflight management * split rrd functions exporters * renames * base dyncfg structure * config pluginsd * intercept dyncfg function calls * loading and saving of dyncfg metadata and data * save metadata and payload to a single file; added code to update the plugins with jobs and saved configs * basic working unit test * added payload to functions execution * removed old dyncfg code that is not needed any more * more cleanup * cleanup sender for functions with payload * dyncfg functions are not exposed as functions * remaining work to avoid indexing the \0 terminating character in dictionary keys * added back old dyncfg plugins.d commands as noop, to allow plugins continue working * working api; working streaming; * updated plugins.d documentation * aclk and http api requests share the same header parsing logic * added source type internal * fixed crashes * added god mode for tests * fixes * fixed messages * save host machine guids to configs * cleaner manipulation of supported commands * the functions event loop for external plugins can now process dyncfg requests * unified internal and external plugins dyncfg API * Netdata serves schema requests from /etc/netdata/schema.d and /var/lib/netdata/conf.d/schema.d * cleanup and various fixes; fixed bug in previous dyncfg implementation on streaming that was sending the paylod in a way that allowed other streaming commands to be multiplexed * internals go to a separate header file * fix duplicate ACLK requests sent by aclk queue mechanism * use fstat instead of stat * working api * plugin actions renamed to create and delete; dyncfg files are removed only from user actions * prevent deadlock by using the react callback * fix for string_strndupz() * better dyncfg unittests * more tests at the unittests * properly detect dyncfg functions * hide config functions from the UI * tree response improvements * send the initial update with payload * determine tty using stdout, not stderr * changes to statuses, cleanup and the code to bring all business logic into interception * do not crash when the status is empty * functions now propagate the source of the requests to plugins * avoid warning about unused functions * in the count at items for attention, do not count the orphan entries * save source into dyncfg * make the list null terminated * fixed invalid comparison * prevent memory leak on duplicated headers; log x-forwarded-for * more unit tests * added dyncfg unittests into the default unittests * more unit tests and fixes * more unit tests and fixes * fix dictionary unittests * config functions require admin access
-rw-r--r--.codacy.yml1
-rw-r--r--CMakeLists.txt34
-rw-r--r--aclk/aclk_query.c61
-rw-r--r--aclk/aclk_query_queue.c16
-rw-r--r--aclk/aclk_query_queue.h2
-rw-r--r--aclk/aclk_rx_msgs.c4
-rw-r--r--collectors/apps.plugin/apps_plugin.c12
-rw-r--r--collectors/cgroups.plugin/cgroup-internals.h19
-rw-r--r--collectors/cgroups.plugin/cgroup-top.c46
-rw-r--r--collectors/cgroups.plugin/sys_fs_cgroup.c13
-rw-r--r--collectors/diskspace.plugin/plugin_diskspace.c30
-rw-r--r--collectors/ebpf.plugin/ebpf_functions.c9
-rw-r--r--collectors/freeipmi.plugin/freeipmi_plugin.c10
-rw-r--r--collectors/plugins.d/README.md216
-rw-r--r--collectors/plugins.d/gperf-config.txt36
-rw-r--r--collectors/plugins.d/gperf-hashtable.h184
-rw-r--r--collectors/plugins.d/plugins_d.h11
-rw-r--r--collectors/plugins.d/pluginsd_dyncfg.c620
-rw-r--r--collectors/plugins.d/pluginsd_dyncfg.h10
-rw-r--r--collectors/plugins.d/pluginsd_functions.c231
-rw-r--r--collectors/plugins.d/pluginsd_functions.h14
-rw-r--r--collectors/plugins.d/pluginsd_internals.c1
-rw-r--r--collectors/plugins.d/pluginsd_parser.c26
-rw-r--r--collectors/plugins.d/pluginsd_parser.h2
-rw-r--r--collectors/proc.plugin/proc_diskstats.c35
-rw-r--r--collectors/proc.plugin/proc_net_dev.c24
-rw-r--r--collectors/systemd-journal.plugin/systemd-internals.h15
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal-dyncfg.c98
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal-files.c10
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal-watcher.c14
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal.c3
-rw-r--r--collectors/systemd-journal.plugin/systemd-main.c24
-rw-r--r--collectors/systemd-journal.plugin/systemd-units.c4
-rw-r--r--daemon/common.h2
-rw-r--r--daemon/config/dyncfg-echo.c83
-rw-r--r--daemon/config/dyncfg-files.c223
-rw-r--r--daemon/config/dyncfg-inline.c61
-rw-r--r--daemon/config/dyncfg-intercept.c351
-rw-r--r--daemon/config/dyncfg-internals.h65
-rw-r--r--daemon/config/dyncfg-tree.c202
-rw-r--r--daemon/config/dyncfg-unittest.c792
-rw-r--r--daemon/config/dyncfg.c405
-rw-r--r--daemon/config/dyncfg.h31
-rw-r--r--daemon/main.c83
-rw-r--r--daemon/static_threads.c9
-rw-r--r--database/contexts/api_v2.c13
-rw-r--r--database/rrd.h2
-rw-r--r--database/rrdcalc.c10
-rw-r--r--database/rrdcalctemplate.c2
-rw-r--r--database/rrdcollector-internals.h17
-rw-r--r--database/rrdcollector.c2
-rw-r--r--database/rrdcollector.h16
-rw-r--r--database/rrddimvar.c2
-rw-r--r--database/rrdfunctions-exporters.c164
-rw-r--r--database/rrdfunctions-exporters.h16
-rw-r--r--database/rrdfunctions-inflight.c641
-rw-r--r--database/rrdfunctions-inflight.h16
-rw-r--r--database/rrdfunctions-inline.c42
-rw-r--r--database/rrdfunctions-inline.h14
-rw-r--r--database/rrdfunctions-internals.h36
-rw-r--r--database/rrdfunctions-progress.c8
-rw-r--r--database/rrdfunctions-progress.h10
-rw-r--r--database/rrdfunctions-streaming.c626
-rw-r--r--database/rrdfunctions-streaming.h12
-rw-r--r--database/rrdfunctions.c1450
-rw-r--r--database/rrdfunctions.h101
-rw-r--r--database/rrdhost.c30
-rw-r--r--database/rrdlabels.c8
-rw-r--r--database/rrdlabels.h2
-rw-r--r--database/rrdsetvar.c2
-rw-r--r--database/rrdvar.c8
-rw-r--r--libnetdata/buffer/buffer.h56
-rw-r--r--libnetdata/config/dyncfg.c297
-rw-r--r--libnetdata/config/dyncfg.h85
-rw-r--r--libnetdata/dictionary/dictionary.c56
-rw-r--r--libnetdata/dyn_conf/README.md188
-rw-r--r--libnetdata/dyn_conf/dyn_conf.c1140
-rw-r--r--libnetdata/dyn_conf/dyn_conf.h237
-rw-r--r--libnetdata/dyn_conf/tests/sample_test_config.json22
-rw-r--r--libnetdata/dyn_conf/tests/sub_tests/test_parent_child.rb192
-rwxr-xr-xlibnetdata/dyn_conf/tests/test_dyncfg.rb266
-rwxr-xr-xlibnetdata/dyn_conf/tests/test_plugin/test.plugin250
-rw-r--r--libnetdata/functions_evloop/functions_evloop.c303
-rw-r--r--libnetdata/functions_evloop/functions_evloop.h22
-rw-r--r--libnetdata/http/content_type.c96
-rw-r--r--libnetdata/http/content_type.h45
-rw-r--r--libnetdata/http/http_access.c37
-rw-r--r--libnetdata/http/http_access.h4
-rw-r--r--libnetdata/http/http_defs.c2
-rw-r--r--libnetdata/http/http_defs.h2
-rw-r--r--libnetdata/inlined.h36
-rw-r--r--libnetdata/json/json.h9
-rw-r--r--libnetdata/libnetdata.c42
-rw-r--r--libnetdata/libnetdata.h22
-rw-r--r--libnetdata/log/log.c72
-rw-r--r--libnetdata/log/log.h5
-rw-r--r--libnetdata/query_progress/progress.c8
-rw-r--r--libnetdata/query_progress/progress.h2
-rw-r--r--libnetdata/string/string.c19
-rw-r--r--libnetdata/string/string.h3
-rw-r--r--libnetdata/url/url.c34
-rw-r--r--libnetdata/url/url.h2
-rw-r--r--logsmanagement/flb_plugin.c4
-rw-r--r--logsmanagement/functions.c8
-rw-r--r--streaming/rrdpush.c126
-rw-r--r--streaming/rrdpush.h51
-rw-r--r--streaming/sender.c181
-rw-r--r--web/api/http_auth.c91
-rw-r--r--web/api/http_auth.h21
-rw-r--r--web/api/http_header.c241
-rw-r--r--web/api/http_header.h11
-rw-r--r--web/api/queries/weights.c2
-rw-r--r--web/api/web_api.c75
-rw-r--r--web/api/web_api.h18
-rw-r--r--web/api/web_api_v1.c136
-rw-r--r--web/api/web_api_v1.h2
-rw-r--r--web/api/web_api_v2.c283
-rw-r--r--web/rtc/webrtc.c1
-rw-r--r--web/server/static/static-threaded.c9
-rw-r--r--web/server/web_client.c357
-rw-r--r--web/server/web_client.h98
121 files changed, 6597 insertions, 6064 deletions
diff --git a/.codacy.yml b/.codacy.yml
index cebc95f819..bcbd297c31 100644
--- a/.codacy.yml
+++ b/.codacy.yml
@@ -21,5 +21,4 @@ exclude_paths:
- web/server/h2o/libh2o/**
- build/**
- build_external/**
- - libnetdata/dyn_conf/tests/**
- packaging/**
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6f8c6bd91..640940bc83 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -144,7 +144,7 @@ if(NOT ${DISABLE_HARDENING})
endif()
if(NOT ${CMAKE_C_FLAGS} MATCHES "stack-clash-protection")
- check_c_compiler_flag("-fstack-clash-protection", HAVE_STACK_CLASH_FLAG)
+ check_c_compiler_flag("-fstack-clash-protection" HAVE_STACK_CLASH_FLAG)
if(HAVE_STACK_CLASH_FLAG)
set(EXTRA_HARDENING_FLAGS "${EXTRA_HARDENING_FLAGS} -fstack-clash-protection")
endif()
@@ -641,8 +641,10 @@ set(LIBNETDATA_FILES
libnetdata/http/http_access.h
libnetdata/http/http_defs.c
libnetdata/http/http_defs.h
- libnetdata/dyn_conf/dyn_conf.c
- libnetdata/dyn_conf/dyn_conf.h
+ libnetdata/http/content_type.c
+ libnetdata/http/content_type.h
+ libnetdata/config/dyncfg.c
+ libnetdata/config/dyncfg.h