From ff2a76910f4b4da1741e9888f673343099784045 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 13 Feb 2023 18:15:59 +0100 Subject: Adding upstream version 1.38.1. Signed-off-by: Daniel Baumann --- CHANGELOG.md | 121 ++++++++++++---------- collectors/cgroups.plugin/sys_fs_cgroup.c | 4 +- collectors/freebsd.plugin/freebsd_sysctl.c | 61 ++++++++--- database/rrdcontext.c | 10 +- libnetdata/libnetdata.c | 13 ++- packaging/makeself/jobs/20-openssl.install.sh | 2 +- packaging/makeself/jobs/50-curl-7.82.0.install.sh | 62 ----------- packaging/makeself/jobs/50-curl-7.87.0.install.sh | 62 +++++++++++ packaging/makeself/jobs/50-ioping-1.2.install.sh | 32 ------ packaging/makeself/jobs/50-ioping-1.3.install.sh | 32 ++++++ packaging/makeself/openssl.version | 2 +- packaging/version | 2 +- system/netdata.service.v235.in | 4 +- web/api/formatters/csv/csv.c | 5 + web/api/formatters/json/json.c | 6 +- web/api/formatters/json_wrapper.c | 14 ++- web/api/formatters/value/value.c | 2 + web/api/queries/query.c | 28 +++-- web/api/queries/rrdr.h | 2 +- web/api/queries/weights.c | 3 + 20 files changed, 273 insertions(+), 194 deletions(-) delete mode 100755 packaging/makeself/jobs/50-curl-7.82.0.install.sh create mode 100755 packaging/makeself/jobs/50-curl-7.87.0.install.sh delete mode 100755 packaging/makeself/jobs/50-ioping-1.2.install.sh create mode 100755 packaging/makeself/jobs/50-ioping-1.3.install.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index acec2c713..cc875810f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,73 @@ # Changelog +## [v1.38.1](https://github.com/netdata/netdata/tree/v1.38.1) (2023-02-13) + +[Full Changelog](https://github.com/netdata/netdata/compare/v1.38.0...v1.38.1) + +**Merged pull requests:** + +- Make external plugins a category page in learn [\#14511](https://github.com/netdata/netdata/pull/14511) ([cakrit](https://github.com/cakrit)) +- Learn integrations category changes [\#14510](https://github.com/netdata/netdata/pull/14510) ([cakrit](https://github.com/cakrit)) +- Move collectors under Integrations/Monitoring [\#14509](https://github.com/netdata/netdata/pull/14509) ([cakrit](https://github.com/cakrit)) +- Guides and collectors reorg and cleanup part 1 [\#14507](https://github.com/netdata/netdata/pull/14507) ([cakrit](https://github.com/cakrit)) +- More learn reorg/reordering [\#14505](https://github.com/netdata/netdata/pull/14505) ([cakrit](https://github.com/cakrit)) +- Revert changes to platform support policy [\#14504](https://github.com/netdata/netdata/pull/14504) ([cakrit](https://github.com/cakrit)) +- Top level learn changes [\#14503](https://github.com/netdata/netdata/pull/14503) ([cakrit](https://github.com/cakrit)) +- Fix broken links in collectors/COLLECTORS.md [\#14502](https://github.com/netdata/netdata/pull/14502) ([Ancairon](https://github.com/Ancairon)) +- Update Demo-Sites.md [\#14501](https://github.com/netdata/netdata/pull/14501) ([cakrit](https://github.com/cakrit)) +- Member role on roles permissions docs [\#14500](https://github.com/netdata/netdata/pull/14500) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- Reorganize contents of Getting Started [\#14499](https://github.com/netdata/netdata/pull/14499) ([cakrit](https://github.com/cakrit)) +- Correct title of contribute to doccumentation [\#14498](https://github.com/netdata/netdata/pull/14498) ([cakrit](https://github.com/cakrit)) +- Delete getting-started-overview.md [\#14497](https://github.com/netdata/netdata/pull/14497) ([Ancairon](https://github.com/Ancairon)) +- Category overview pages [\#14495](https://github.com/netdata/netdata/pull/14495) ([Ancairon](https://github.com/Ancairon)) +- Fix crash when child connects [\#14492](https://github.com/netdata/netdata/pull/14492) ([stelfrag](https://github.com/stelfrag)) +- Plans docs [\#14491](https://github.com/netdata/netdata/pull/14491) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- Try making it landing page of getting started directly [\#14489](https://github.com/netdata/netdata/pull/14489) ([cakrit](https://github.com/cakrit)) +- Update Demo-Sites.md [\#14488](https://github.com/netdata/netdata/pull/14488) ([Ancairon](https://github.com/Ancairon)) +- Make the introduction a category link [\#14485](https://github.com/netdata/netdata/pull/14485) ([Ancairon](https://github.com/Ancairon)) +- Update AD title [\#14484](https://github.com/netdata/netdata/pull/14484) ([thiagoftsm](https://github.com/thiagoftsm)) +- Fix coverity issues [\#14480](https://github.com/netdata/netdata/pull/14480) ([stelfrag](https://github.com/stelfrag)) +- Remove obsolete or redundant docs [\#14476](https://github.com/netdata/netdata/pull/14476) ([cakrit](https://github.com/cakrit)) +- Incorporate interoperability and fix edit link [\#14475](https://github.com/netdata/netdata/pull/14475) ([cakrit](https://github.com/cakrit)) +- Upgrade demo sites to the getting started section [\#14474](https://github.com/netdata/netdata/pull/14474) ([cakrit](https://github.com/cakrit)) +- Add a file to Learn [\#14473](https://github.com/netdata/netdata/pull/14473) ([Ancairon](https://github.com/Ancairon)) +- fix a possible bug with an image in the md file [\#14472](https://github.com/netdata/netdata/pull/14472) ([Ancairon](https://github.com/Ancairon)) +- Add sbindir\_POST template for v235 service file [\#14471](https://github.com/netdata/netdata/pull/14471) ([MrZammler](https://github.com/MrZammler)) +- Fix random crash on agent shutdown [\#14470](https://github.com/netdata/netdata/pull/14470) ([stelfrag](https://github.com/stelfrag)) +- Move ansible md [\#14469](https://github.com/netdata/netdata/pull/14469) ([cakrit](https://github.com/cakrit)) +- Correct link to ansible playbook [\#14468](https://github.com/netdata/netdata/pull/14468) ([cakrit](https://github.com/cakrit)) +- Moved contents of get started to installer readme [\#14467](https://github.com/netdata/netdata/pull/14467) ([cakrit](https://github.com/cakrit)) +- Add markdown files in Learn [\#14466](https://github.com/netdata/netdata/pull/14466) ([Ancairon](https://github.com/Ancairon)) +- Virtual hosts for data collection [\#14464](https://github.com/netdata/netdata/pull/14464) ([ktsaou](https://github.com/ktsaou)) +- Add contents of packaging/installer/readme.md [\#14461](https://github.com/netdata/netdata/pull/14461) ([cakrit](https://github.com/cakrit)) +- Add mention of cloud in next steps UI etc [\#14459](https://github.com/netdata/netdata/pull/14459) ([cakrit](https://github.com/cakrit)) +- Fix links and add to learn [\#14458](https://github.com/netdata/netdata/pull/14458) ([cakrit](https://github.com/cakrit)) +- Add export for people running their own registry [\#14457](https://github.com/netdata/netdata/pull/14457) ([cakrit](https://github.com/cakrit)) +- remove deprecated python.d collectors announced in v1.38.0 [\#14454](https://github.com/netdata/netdata/pull/14454) ([ilyam8](https://github.com/ilyam8)) +- Update static build dependencies [\#14450](https://github.com/netdata/netdata/pull/14450) ([tkatsoulas](https://github.com/tkatsoulas)) +- do not report dimensions that failed to be queried [\#14447](https://github.com/netdata/netdata/pull/14447) ([ktsaou](https://github.com/ktsaou)) +- Fix agent build failure on FreeBSD 14.0 due to new tcpstat struct [\#14446](https://github.com/netdata/netdata/pull/14446) ([Dim-P](https://github.com/Dim-P)) +- minor fix in the metadata of libnetdata/ebpf AND log documents [\#14445](https://github.com/netdata/netdata/pull/14445) ([tkatsoulas](https://github.com/tkatsoulas)) +- Roles permissions docs [\#14444](https://github.com/netdata/netdata/pull/14444) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- Only load required charts for rrdvars [\#14443](https://github.com/netdata/netdata/pull/14443) ([MrZammler](https://github.com/MrZammler)) +- Typos in in notification docs [\#14440](https://github.com/netdata/netdata/pull/14440) ([iorvd](https://github.com/iorvd)) +- Streaming interpolated values [\#14431](https://github.com/netdata/netdata/pull/14431) ([ktsaou](https://github.com/ktsaou)) +- Fix compiler error when CLOSE\_RANGE\_CLOEXEC is missing [\#14430](https://github.com/netdata/netdata/pull/14430) ([Dim-P](https://github.com/Dim-P)) +- Add .NET info [\#14429](https://github.com/netdata/netdata/pull/14429) ([thiagoftsm](https://github.com/thiagoftsm)) +- Minor fix, convert metadata of the learn to hidden sections [\#14427](https://github.com/netdata/netdata/pull/14427) ([tkatsoulas](https://github.com/tkatsoulas)) +- kickstart.sh: Fix `--release-channel` as `--nightly-channel` options [\#14424](https://github.com/netdata/netdata/pull/14424) ([vobruba-martin](https://github.com/vobruba-martin)) +- add @andrewm4894 as docs/ codeowner [\#14398](https://github.com/netdata/netdata/pull/14398) ([andrewm4894](https://github.com/andrewm4894)) +- Roles permissions docs [\#14391](https://github.com/netdata/netdata/pull/14391) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- add note about not needing to have room id [\#14390](https://github.com/netdata/netdata/pull/14390) ([andrewm4894](https://github.com/andrewm4894)) +- update the "Install Netdata with Docker" doc [\#14385](https://github.com/netdata/netdata/pull/14385) ([Ancairon](https://github.com/Ancairon)) +- generates dual ksy for njfv2 + fix for padding after page blocks [\#14383](https://github.com/netdata/netdata/pull/14383) ([underhood](https://github.com/underhood)) +- Delete docs/cloud/get-started.mdx [\#14382](https://github.com/netdata/netdata/pull/14382) ([Ancairon](https://github.com/Ancairon)) +- Update the "Kubernetes visualizations" doc [\#14347](https://github.com/netdata/netdata/pull/14347) ([Ancairon](https://github.com/Ancairon)) +- Update the "Deploy Kubernetes monitoring with Netdata" doc [\#14345](https://github.com/netdata/netdata/pull/14345) ([Ancairon](https://github.com/Ancairon)) +- Events docs [\#14341](https://github.com/netdata/netdata/pull/14341) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- Update the "Install Netdata with kickstart.sh" doc [\#14338](https://github.com/netdata/netdata/pull/14338) ([Ancairon](https://github.com/Ancairon)) +- Indicate what root privileges are needed for in kickstart.sh. [\#14314](https://github.com/netdata/netdata/pull/14314) ([Ferroin](https://github.com/Ferroin)) + ## [v1.38.0](https://github.com/netdata/netdata/tree/v1.38.0) (2023-02-06) [Full Changelog](https://github.com/netdata/netdata/compare/v1.37.1...v1.38.0) @@ -311,59 +379,6 @@ - bump go.d.plugin v0.41.1 [\#13874](https://github.com/netdata/netdata/pull/13874) ([ilyam8](https://github.com/ilyam8)) - Replication of metrics \(gaps filling\) during streaming [\#13873](https://github.com/netdata/netdata/pull/13873) ([vkalintiris](https://github.com/vkalintiris)) - Don't create a REMOVED alert event after a REMOVED. [\#13871](https://github.com/netdata/netdata/pull/13871) ([MrZammler](https://github.com/MrZammler)) -- Store hidden status when creating / updating dimension metadata [\#13869](https://github.com/netdata/netdata/pull/13869) ([stelfrag](https://github.com/stelfrag)) -- Find the chart and dimension UUID from the context [\#13868](https://github.com/netdata/netdata/pull/13868) ([stelfrag](https://github.com/stelfrag)) -- fix\(cgroup.plugin\): handle qemu-1- prefix when extracting virsh domain [\#13866](https://github.com/netdata/netdata/pull/13866) ([ilyam8](https://github.com/ilyam8)) -- Update step-09 for dbmode update.md [\#13864](https://github.com/netdata/netdata/pull/13864) ([DShreve2](https://github.com/DShreve2)) -- add ACLK access to ml\_info \(fix anomalies tab in cloud\) [\#13863](https://github.com/netdata/netdata/pull/13863) ([underhood](https://github.com/underhood)) -- bump go.d.plugin to v0.41.0 [\#13861](https://github.com/netdata/netdata/pull/13861) ([ilyam8](https://github.com/ilyam8)) -- app to api netdata cloud [\#13856](https://github.com/netdata/netdata/pull/13856) ([underhood](https://github.com/underhood)) -- Use llvm's ar and ranlib when compiling with clang [\#13854](https://github.com/netdata/netdata/pull/13854) ([MrZammler](https://github.com/MrZammler)) -- fix typo [\#13853](https://github.com/netdata/netdata/pull/13853) ([andrewm4894](https://github.com/andrewm4894)) -- Retry reading carrier, duplex, and speed files periodically [\#13850](https://github.com/netdata/netdata/pull/13850) ([vlvkobal](https://github.com/vlvkobal)) -- Properly guard commands when installing services for offline service managers. [\#13848](https://github.com/netdata/netdata/pull/13848) ([Ferroin](https://github.com/Ferroin)) -- fix tiers update frequency [\#13844](https://github.com/netdata/netdata/pull/13844) ([ktsaou](https://github.com/ktsaou)) -- Fix service installation on FreeBSD. [\#13842](https://github.com/netdata/netdata/pull/13842) ([Ferroin](https://github.com/Ferroin)) -- Cassandra dashboard description [\#13835](https://github.com/netdata/netdata/pull/13835) ([thiagoftsm](https://github.com/thiagoftsm)) -- Use mmap to read an extent from a datafile [\#13834](https://github.com/netdata/netdata/pull/13834) ([stelfrag](https://github.com/stelfrag)) -- chore\(health\): rm pihole\_blocklist\_gravity\_file\_existence\_state [\#13826](https://github.com/netdata/netdata/pull/13826) ([ilyam8](https://github.com/ilyam8)) -- Improve error and warning messages in the kickstart script. [\#13825](https://github.com/netdata/netdata/pull/13825) ([Ferroin](https://github.com/Ferroin)) -- Remove option to use MQTT 3 [\#13824](https://github.com/netdata/netdata/pull/13824) ([underhood](https://github.com/underhood)) -- extended processes function info from apps.plugin [\#13822](https://github.com/netdata/netdata/pull/13822) ([ktsaou](https://github.com/ktsaou)) -- Fix crash on child reconnect and lost metrics [\#13821](https://github.com/netdata/netdata/pull/13821) ([stelfrag](https://github.com/stelfrag)) -- Remove NFS readahead histogram [\#13819](https://github.com/netdata/netdata/pull/13819) ([vlvkobal](https://github.com/vlvkobal)) -- minor - add trace alloc to buildinfo [\#13817](https://github.com/netdata/netdata/pull/13817) ([underhood](https://github.com/underhood)) -- Fix exporting unit tests [\#13816](https://github.com/netdata/netdata/pull/13816) ([vlvkobal](https://github.com/vlvkobal)) -- Inject costallocz to mqtt\_websockets library and its children [\#13813](https://github.com/netdata/netdata/pull/13813) ([underhood](https://github.com/underhood)) -- overload libc memory allocators with custom ones to trace all allocations [\#13810](https://github.com/netdata/netdata/pull/13810) ([ktsaou](https://github.com/ktsaou)) -- bump go.d.plugin v0.40.4 [\#13808](https://github.com/netdata/netdata/pull/13808) ([ilyam8](https://github.com/ilyam8)) -- fix post-processing of contexts [\#13807](https://github.com/netdata/netdata/pull/13807) ([ktsaou](https://github.com/ktsaou)) -- Merge netstat, snmp, and snmp6 modules [\#13806](https://github.com/netdata/netdata/pull/13806) ([vlvkobal](https://github.com/vlvkobal)) -- fix warning when -Wfree-nonheap-object is used [\#13805](https://github.com/netdata/netdata/pull/13805) ([underhood](https://github.com/underhood)) -- ARAL optimal alloc size [\#13804](https://github.com/netdata/netdata/pull/13804) ([ktsaou](https://github.com/ktsaou)) -- internal log error, when passing NULL dictionary [\#13803](https://github.com/netdata/netdata/pull/13803) ([ktsaou](https://github.com/ktsaou)) -- Properly propagate errors from installer/updater to kickstart script. [\#13802](https://github.com/netdata/netdata/pull/13802) ([Ferroin](https://github.com/Ferroin)) -- Add up to date info on improving performance [\#13801](https://github.com/netdata/netdata/pull/13801) ([cakrit](https://github.com/cakrit)) -- Return memory freed properly [\#13799](https://github.com/netdata/netdata/pull/13799) ([stelfrag](https://github.com/stelfrag)) -- Use string\_freez instead of freez in rrdhost\_init\_timezone [\#13798](https://github.com/netdata/netdata/pull/13798) ([MrZammler](https://github.com/MrZammler)) -- Fix runtime directory ownership when installed as non-root user. [\#13797](https://github.com/netdata/netdata/pull/13797) ([Ferroin](https://github.com/Ferroin)) -- Fix minor typo in systemdunits.conf alert [\#13796](https://github.com/netdata/netdata/pull/13796) ([tkatsoulas](https://github.com/tkatsoulas)) -- Also enable rrdvars from health [\#13795](https://github.com/netdata/netdata/pull/13795) ([MrZammler](https://github.com/MrZammler)) -- feat\(python.d\): respect NETDATA\_INTERNALS\_MONITORING [\#13793](https://github.com/netdata/netdata/pull/13793) ([ilyam8](https://github.com/ilyam8)) -- Array Allocator Memory Leak Fix [\#13792](https://github.com/netdata/netdata/pull/13792) ([ktsaou](https://github.com/ktsaou)) -- Add variants of functions allowing callers to specify the time to use. [\#13791](https://github.com/netdata/netdata/pull/13791) ([vkalintiris](https://github.com/vkalintiris)) -- Remove extern from function declared in headers. [\#13790](https://github.com/netdata/netdata/pull/13790) ([vkalintiris](https://github.com/vkalintiris)) -- full memory tracking and profiling of Netdata Agent [\#13789](https://github.com/netdata/netdata/pull/13789) ([ktsaou](https://github.com/ktsaou)) -- allow disabling netdata monitoring section of the dashboard [\#13788](https://github.com/netdata/netdata/pull/13788) ([ktsaou](https://github.com/ktsaou)) -- Stop pulling in netcat as a mandatory dependency. [\#13787](https://github.com/netdata/netdata/pull/13787) ([Ferroin](https://github.com/Ferroin)) -- Initialize st-\>rrdvars from rrdset insert callback [\#13786](https://github.com/netdata/netdata/pull/13786) ([MrZammler](https://github.com/MrZammler)) -- Add Ubuntu 22.10 to supported distros, CI, and package builds. [\#13785](https://github.com/netdata/netdata/pull/13785) ([Ferroin](https://github.com/Ferroin)) -- minor - add host labels for ephemerality and nodes with unstable connections [\#13784](https://github.com/netdata/netdata/pull/13784) ([underhood](https://github.com/underhood)) -- Add a thread to asynchronously process metadata updates [\#13783](https://github.com/netdata/netdata/pull/13783) ([stelfrag](https://github.com/stelfrag)) -- Parser cleanup [\#13782](https://github.com/netdata/netdata/pull/13782) ([stelfrag](https://github.com/stelfrag)) -- allow netdata installer to install and run netdata as any user [\#13780](https://github.com/netdata/netdata/pull/13780) ([ktsaou](https://github.com/ktsaou)) -- Update libbpf 1.0.1 [\#13778](https://github.com/netdata/netdata/pull/13778) ([thiagoftsm](https://github.com/thiagoftsm)) -- Bump websockets submodule [\#13776](https://github.com/netdata/netdata/pull/13776) ([underhood](https://github.com/underhood)) ## [v1.36.1](https://github.com/netdata/netdata/tree/v1.36.1) (2022-08-15) diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 66db0b728..e63e042d0 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -589,7 +589,8 @@ void netdata_cgroup_ebpf_initialize_shm() PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd_cgroup_ebpf, 0); - if (!shm_cgroup_ebpf.header) { + if (unlikely(MAP_FAILED == shm_cgroup_ebpf.header)) { + shm_cgroup_ebpf.header = NULL; collector_error("Cannot map shared memory used between cgroup and eBPF, integration won't happen"); goto end_init_shm; } @@ -606,6 +607,7 @@ void netdata_cgroup_ebpf_initialize_shm() collector_error("Cannot create semaphore, integration between eBPF and cgroup won't happen"); munmap(shm_cgroup_ebpf.header, length); + shm_cgroup_ebpf.header = NULL; end_init_shm: close(shm_fd_cgroup_ebpf); diff --git a/collectors/freebsd.plugin/freebsd_sysctl.c b/collectors/freebsd.plugin/freebsd_sysctl.c index 7d68bda9b..035309b73 100644 --- a/collectors/freebsd.plugin/freebsd_sysctl.c +++ b/collectors/freebsd.plugin/freebsd_sysctl.c @@ -1991,15 +1991,34 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { rrdset_done(st_listen); } - if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO && - (tcpstat.tcps_ecn_ce || + if (do_ecn == CONFIG_BOOLEAN_YES || ( do_ecn == CONFIG_BOOLEAN_AUTO && + ( netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || +#if __FreeBSD_version < 1400074 +// See https://github.com/freebsd/freebsd-src/commit/1a70101a870015304d5b2446b480d8677d8aad36 + tcpstat.tcps_ecn_ce || tcpstat.tcps_ecn_ect0 || - tcpstat.tcps_ecn_ect1 || - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) { + tcpstat.tcps_ecn_ect1 +#else + tcpstat.tcps_ecn_rcvce || + tcpstat.tcps_ecn_rcvect0 || + tcpstat.tcps_ecn_rcvect1 || + tcpstat.tcps_ecn_sndect0 || + tcpstat.tcps_ecn_sndect1 +#endif + ))) { do_ecn = CONFIG_BOOLEAN_YES; static RRDSET *st = NULL; - static RRDDIM *rd_ce = NULL, *rd_no_ect = NULL, *rd_ect0 = NULL, *rd_ect1 = NULL; + static RRDDIM *rd_rcvce = NULL, +#if __FreeBSD_version < 1400074 + *rd_ect0 = NULL, + *rd_ect1 = NULL; +#else + *rd_rcvect0 = NULL, + *rd_rcvect1 = NULL, + *rd_sndect0 = NULL, + *rd_sndect1 = NULL; +#endif if (unlikely(!st)) { st = rrdset_create_localhost( @@ -2019,20 +2038,32 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) { rrdset_flag_set(st, RRDSET_FLAG_DETAIL); - rd_ce = rrddim_add(st, "InCEPkts", "CEP", 1, 1, RRD_ALGORITHM_INCREMENTAL); - rd_no_ect = rrddim_add(st, "InNoECTPkts", "NoECTP", -1, 1, RRD_ALGORITHM_INCREMENTAL); - rd_ect0 = rrddim_add(st, "InECT0Pkts", "ECTP0", 1, 1, RRD_ALGORITHM_INCREMENTAL); - rd_ect1 = rrddim_add(st, "InECT1Pkts", "ECTP1", 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_rcvce = rrddim_add(st, "InCEPkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); +#if __FreeBSD_version < 1400074 + rd_ect0 = rrddim_add(st, "ECT0Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_ect1 = rrddim_add(st, "ECT1Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); +#else + rd_rcvect0 = rrddim_add(st, "InECT0Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_rcvect1 = rrddim_add(st, "InECT1Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_sndect0 = rrddim_add(st, "OutECT0Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_sndect1 = rrddim_add(st, "OutECT1Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); +#endif } - rrddim_set_by_pointer(st, rd_ce, tcpstat.tcps_ecn_ce); - rrddim_set_by_pointer(st, rd_no_ect, tcpstat.tcps_ecn_ce - (tcpstat.tcps_ecn_ect0 + - tcpstat.tcps_ecn_ect1)); - rrddim_set_by_pointer(st, rd_ect0, tcpstat.tcps_ecn_ect0); - rrddim_set_by_pointer(st, rd_ect1, tcpstat.tcps_ecn_ect1); + +#if __FreeBSD_version < 1400074 + rrddim_set_by_pointer(st, rd_rcvce, tcpstat.tcps_ecn_ce); + rrddim_set_by_pointer(st, rd_ect0, tcpstat.tcps_ecn_ect0); + rrddim_set_by_pointer(st, rd_ect1, tcpstat.tcps_ecn_ect1); +#else + rrddim_set_by_pointer(st, rd_rcvce, tcpstat.tcps_ecn_rcvce); + rrddim_set_by_pointer(st, rd_rcvect0, tcpstat.tcps_ecn_rcvect0); + rrddim_set_by_pointer(st, rd_rcvect1, tcpstat.tcps_ecn_rcvect1); + rrddim_set_by_pointer(st, rd_sndect0, tcpstat.tcps_ecn_sndect0); + rrddim_set_by_pointer(st, rd_sndect1, tcpstat.tcps_ecn_sndect1); +#endif rrdset_done(st); } - } } else { collector_error("DISABLED: net.inet.tcp.stats module"); diff --git a/database/rrdcontext.c b/database/rrdcontext.c index 9fc605f32..3f1ce73f8 100644 --- a/database/rrdcontext.c +++ b/database/rrdcontext.c @@ -2501,7 +2501,7 @@ static void query_target_add_metric(QUERY_TARGET_LOCALS *qtl, RRDMETRIC_ACQUIRED if (rrd_flag_check(rm, RRD_FLAG_HIDDEN) || (rm->rrddim && rrddim_option_check(rm->rrddim, RRDDIM_OPTION_HIDDEN))) { options |= RRDR_DIMENSION_HIDDEN; - options &= ~RRDR_DIMENSION_SELECTED; + options &= ~RRDR_DIMENSION_QUERIED; } if (qt->query.pattern) { @@ -2512,13 +2512,13 @@ static void query_target_add_metric(QUERY_TARGET_LOCALS *qtl, RRDMETRIC_ACQUIRED || (qtl->match_names && simple_pattern_matches(qt->query.pattern, string2str(rm->name))) ) { // it matches the pattern - options |= (RRDR_DIMENSION_SELECTED | RRDR_DIMENSION_NONZERO); + options |= (RRDR_DIMENSION_QUERIED | RRDR_DIMENSION_NONZERO); options &= ~RRDR_DIMENSION_HIDDEN; } else { // it does not match the pattern options |= RRDR_DIMENSION_HIDDEN; - options &= ~RRDR_DIMENSION_SELECTED; + options &= ~RRDR_DIMENSION_QUERIED; } } else { @@ -2526,10 +2526,10 @@ static void query_target_add_metric(QUERY_TARGET_LOCALS *qtl, RRDMETRIC_ACQUIRED // so this is a selected dimension // if it is not hidden if(!(options & RRDR_DIMENSION_HIDDEN)) - options |= RRDR_DIMENSION_SELECTED; + options |= RRDR_DIMENSION_QUERIED; } - if((options & RRDR_DIMENSION_HIDDEN) && (options & RRDR_DIMENSION_SELECTED)) + if((options & RRDR_DIMENSION_HIDDEN) && (options & RRDR_DIMENSION_QUERIED)) options &= ~RRDR_DIMENSION_HIDDEN; if(!(options & RRDR_DIMENSION_HIDDEN) || (qt->request.options & RRDR_OPTION_PERCENTAGE)) { diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index f6b6b026a..666344a96 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -2011,21 +2011,24 @@ void for_each_open_fd(OPEN_FD_ACTION action, OPEN_FD_EXCLUDE excluded_fds){ if(!(excluded_fds & OPEN_FD_EXCLUDE_STDIN)) (void)close(STDIN_FILENO); if(!(excluded_fds & OPEN_FD_EXCLUDE_STDOUT)) (void)close(STDOUT_FILENO); if(!(excluded_fds & OPEN_FD_EXCLUDE_STDERR)) (void)close(STDERR_FILENO); +#if defined(HAVE_CLOSE_RANGE) + if(close_range(STDERR_FILENO + 1, ~0U, 0) == 0) return; + error("close_range() failed, will try to close fds one by one"); +#endif break; case OPEN_FD_ACTION_FD_CLOEXEC: if(!(excluded_fds & OPEN_FD_EXCLUDE_STDIN)) (void)fcntl(STDIN_FILENO, F_SETFD, FD_CLOEXEC); if(!(excluded_fds & OPEN_FD_EXCLUDE_STDOUT)) (void)fcntl(STDOUT_FILENO, F_SETFD, FD_CLOEXEC); if(!(excluded_fds & OPEN_FD_EXCLUDE_STDERR)) (void)fcntl(STDERR_FILENO, F_SETFD, FD_CLOEXEC); +#if defined(HAVE_CLOSE_RANGE) && defined(CLOSE_RANGE_CLOEXEC) // Linux >= 5.11, FreeBSD >= 13.1 + if(close_range(STDERR_FILENO + 1, ~0U, CLOSE_RANGE_CLOEXEC) == 0) return; + error("close_range() failed, will try to mark fds for closing one by one"); +#endif break; default: break; // do nothing } -#if defined(HAVE_CLOSE_RANGE) - if(close_range(STDERR_FILENO + 1, ~0U, (action == OPEN_FD_ACTION_FD_CLOEXEC ? CLOSE_RANGE_CLOEXEC : 0)) == 0) return; - error("close_range() failed, will try to close fds manually"); -#endif - DIR *dir = opendir("/proc/self/fd"); if (dir == NULL) { struct rlimit rl; diff --git a/packaging/makeself/jobs/20-openssl.install.sh b/packaging/makeself/jobs/20-openssl.install.sh index 5d9aa068e..35667a51f 100755 --- a/packaging/makeself/jobs/20-openssl.install.sh +++ b/packaging/makeself/jobs/20-openssl.install.sh @@ -29,7 +29,7 @@ if [ -d "${cache}" ]; then CACHE_HIT=1 else echo "No cached copy of build directory for openssl found, fetching sources instead." - run git clone --branch "${version}" --single-branch --depth 1 git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl" + run git clone --branch "${version}" --single-branch --depth 1 https://github.com/openssl/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl" CACHE_HIT=0 fi diff --git a/packaging/makeself/jobs/50-curl-7.82.0.install.sh b/packaging/makeself/jobs/50-curl-7.82.0.install.sh deleted file mode 100755 index 251d35095..000000000 --- a/packaging/makeself/jobs/50-curl-7.82.0.install.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-or-later - -# shellcheck source=packaging/makeself/functions.sh -. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 - -version="7.82.0" - -# shellcheck disable=SC2015 -[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building cURL" || true - -fetch "curl-${version}" "https://curl.haxx.se/download/curl-${version}.tar.gz" \ - 910cc5fe279dc36e2cca534172c94364cf3fcf7d6494ba56e6c61a390881ddce curl - -export CFLAGS="-I/openssl-static/include -pipe" -export LDFLAGS="-static -L/openssl-static/lib" -export PKG_CONFIG="pkg-config --static" -export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" - -if [ "${CACHE_HIT:-0}" -eq 0 ]; then - run autoreconf -fi - - run ./configure \ - --prefix="${NETDATA_INSTALL_PATH}" \ - --enable-optimize \ - --disable-shared \ - --enable-static \ - --enable-http \ - --disable-ldap \ - --disable-ldaps \ - --enable-proxy \ - --disable-dict \ - --disable-telnet \ - --disable-tftp \ - --disable-pop3 \ - --disable-imap \ - --disable-smb \ - --disable-smtp \ - --disable-gopher \ - --enable-ipv6 \ - --enable-cookies \ - --with-ca-fallback \ - --with-openssl \ - --disable-dependency-tracking - - # Curl autoconf does not honour the curl_LDFLAGS environment variable - run sed -i -e "s/LDFLAGS =/LDFLAGS = -all-static/" src/Makefile - - run make clean - run make -j "$(nproc)" -fi - -run make install - -store_cache curl "${NETDATA_MAKESELF_PATH}/tmp/curl-${version}" - -if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then - run strip "${NETDATA_INSTALL_PATH}"/bin/curl -fi - -# shellcheck disable=SC2015 -[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true diff --git a/packaging/makeself/jobs/50-curl-7.87.0.install.sh b/packaging/makeself/jobs/50-curl-7.87.0.install.sh new file mode 100755 index 000000000..84210e958 --- /dev/null +++ b/packaging/makeself/jobs/50-curl-7.87.0.install.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +version="7.87.0" + +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building cURL" || true + +fetch "curl-${version}" "https://curl.haxx.se/download/curl-${version}.tar.gz" \ + 8a063d664d1c23d35526b87a2bf15514962ffdd8ef7fd40519191b3c23e39548 curl + +export CFLAGS="-I/openssl-static/include -pipe" +export LDFLAGS="-static -L/openssl-static/lib" +export PKG_CONFIG="pkg-config --static" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +if [ "${CACHE_HIT:-0}" -eq 0 ]; then + run autoreconf -fi + + run ./configure \ + --prefix="${NETDATA_INSTALL_PATH}" \ + --enable-optimize \ + --disable-shared \ + --enable-static \ + --enable-http \ + --disable-ldap \ + --disable-ldaps \ + --enable-proxy \ + --disable-dict \ + --disable-telnet \ + --disable-tftp \ + --disable-pop3 \ + --disable-imap \ + --disable-smb \ + --disable-smtp \ + --disable-gopher \ + --enable-ipv6 \ + --enable-cookies \ + --with-ca-fallback \ + --with-openssl \ + --disable-dependency-tracking + + # Curl autoconf does not honour the curl_LDFLAGS environment variable + run sed -i -e "s/LDFLAGS =/LDFLAGS = -all-static/" src/Makefile + + run make clean + run make -j "$(nproc)" +fi + +run make install + +store_cache curl "${NETDATA_MAKESELF_PATH}/tmp/curl-${version}" + +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/bin/curl +fi + +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Preparing build environment" || true diff --git a/packaging/makeself/jobs/50-ioping-1.2.install.sh b/packaging/makeself/jobs/50-ioping-1.2.install.sh deleted file mode 100755 index 160f45b98..000000000 --- a/packaging/makeself/jobs/50-ioping-1.2.install.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-or-later - -# shellcheck source=packaging/makeself/functions.sh -. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 - -version='1.2' - -# shellcheck disable=SC2015 -[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building ioping" || true - -fetch "ioping-${version}" "https://github.com/koct9i/ioping/archive/v${version}.tar.gz" \ - d3e4497c653a1e96df67c72ce2b70da18e9f5e3b93179a5bb57a6e30ceacfa75 ioping - -export CFLAGS="-static -pipe" - -if [ "${CACHE_HIT:-0}" -eq 0 ]; then - run make clean - run make -j "$(nproc)" -fi - -run mkdir -p "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ -run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ - -store_cache ioping "${NETDATA_MAKESELF_PATH}/tmp/ioping-${version}" - -if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then - run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping -fi - -# shellcheck disable=SC2015 -[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true diff --git a/packaging/makeself/jobs/50-ioping-1.3.install.sh b/packaging/makeself/jobs/50-ioping-1.3.install.sh new file mode 100755 index 000000000..88309c3eb --- /dev/null +++ b/packaging/makeself/jobs/50-ioping-1.3.install.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=packaging/makeself/functions.sh +. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1 + +version='1.3' + +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building ioping" || true + +fetch "ioping-${version}" "https://github.com/koct9i/ioping/archive/v${version}.tar.gz" \ + 7aa48e70aaa766bc112dea57ebbe56700626871052380709df3a26f46766e8c8 ioping + +export CFLAGS="-static -pipe" + +if [ "${CACHE_HIT:-0}" -eq 0 ]; then + run make clean + run make -j "$(nproc)" +fi + +run mkdir -p "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ +run install -o root -g root -m 4750 ioping "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ + +store_cache ioping "${NETDATA_MAKESELF_PATH}/tmp/ioping-${version}" + +if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then + run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/ioping +fi + +# shellcheck disable=SC2015 +[ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true diff --git a/packaging/makeself/openssl.version b/packaging/makeself/openssl.version index ad1bcee8f..374b3773c 100644 --- a/packaging/makeself/openssl.version +++ b/packaging/makeself/openssl.version @@ -1 +1 @@ -OpenSSL_1_1_1n +OpenSSL_1_1_1t diff --git a/packaging/version b/packaging/version index 553ed7204..cbec0de06 100644 --- a/packaging/version +++ b/packaging/version @@ -1 +1 @@ -v1.38.0 +v1.38.1 diff --git a/system/netdata.service.v235.in b/system/netdata.service.v235.in index dfdf88b69..e3232056f 100644 --- a/system/netdata.service.v235.in +++ b/system/netdata.service.v235.in @@ -7,7 +7,7 @@ After=network.target httpd.service squid.service nfs-server.service mysqld.servi [Service] Type=simple -User=netdata +User=@netdata_user_POST@ Group=netdata RuntimeDirectory=netdata CacheDirectory=netdata @@ -18,7 +18,7 @@ StateDirectoryMode=0755 CacheDirectoryMode=0755 LogsDirectoryMode=2750 EnvironmentFile=-/etc/default/netdata -ExecStart=/usr/sbin/netdata -D $EXTRA_OPTS +ExecStart=@sbindir_POST@/netdata -D $EXTRA_OPTS # saving a big db on slow disks may need some time TimeoutStopSec=150 diff --git a/web/api/formatters/csv/csv.c b/web/api/formatters/csv/csv.c index 603a17169..18009f146 100644 --- a/web/api/formatters/csv/csv.c +++ b/web/api/formatters/csv/csv.c @@ -12,6 +12,7 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const // print the csv header for(c = 0, i = 0; c < used ; c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; if(!i) { @@ -32,6 +33,7 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const // print the --- line after header for(c = 0, i = 0; c < used ;c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; if(!i) { @@ -89,6 +91,8 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const if(unlikely(options & RRDR_OPTION_PERCENTAGE)) { total = 0; for(c = 0; c < used ;c++) { + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; + NETDATA_DOUBLE n = cn[c]; if(likely((options & RRDR_OPTION_ABSOLUTE) && n < 0)) @@ -104,6 +108,7 @@ void rrdr2csv(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS options, const // for each dimension for(c = 0; c < used ;c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; buffer_strcat(wb, separator); diff --git a/web/api/formatters/json/json.c b/web/api/formatters/json/json.c index 608150cba..3cad3e914 100644 --- a/web/api/formatters/json/json.c +++ b/web/api/formatters/json/json.c @@ -111,6 +111,7 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) { // print the header lines for(c = 0, i = 0; c < used ; c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; buffer_fast_strcat(wb, pre_label, pre_label_len); @@ -180,7 +181,7 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) { // google supports one annotation per row int annotation_found = 0; for(c = 0; c < used ; c++) { - if(unlikely(!(r->od[c] & RRDR_DIMENSION_SELECTED))) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely(co[c] & RRDR_VALUE_RESET)) { buffer_fast_strcat(wb, overflow_annotation, overflow_annotation_len); @@ -215,6 +216,8 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) { if(unlikely(options & RRDR_OPTION_PERCENTAGE)) { total = 0; for(c = 0; c < used ;c++) { + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; + NETDATA_DOUBLE n; if(unlikely(options & RRDR_OPTION_INTERNAL_AR)) n = ar[c]; @@ -234,6 +237,7 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) { // for each dimension for(c = 0; c < used ;c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; NETDATA_DOUBLE n; diff --git a/web/api/formatters/json_wrapper.c b/web/api/formatters/json_wrapper.c index beb74912e..aa663495a 100644 --- a/web/api/formatters/json_wrapper.c +++ b/web/api/formatters/json_wrapper.c @@ -131,6 +131,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS for(c = 0, i = 0; c < query_used ; c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; if(i) buffer_strcat(wb, ", "); @@ -155,6 +156,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS for(c = 0, i = 0; c < query_used ; c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; if(i) buffer_strcat(wb, ", "); @@ -260,9 +262,8 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS for (c = 0, i = 0; c < query_used; c++) { QUERY_METRIC *qm = &qt->query.array[c]; - if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) - continue; - + if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if (unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if (unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; @@ -295,8 +296,8 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS for (c = 0, i = 0; c < query_used; c++) { QUERY_METRIC *qm = &qt->query.array[c]; - if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) - continue; + if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if (unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if (unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; @@ -351,6 +352,8 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS if(unlikely(options & RRDR_OPTION_PERCENTAGE)) { total = 0; for(c = 0; c < query_used ;c++) { + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; + NETDATA_DOUBLE *cn = &r->v[ (rrdr_rows(r) - 1) * r->d ]; NETDATA_DOUBLE n = cn[c]; @@ -365,6 +368,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, RRDR_OPTIONS for(c = 0, i = 0; c < query_used ;c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; if(i) buffer_strcat(wb, ", "); diff --git a/web/api/formatters/value/value.c b/web/api/formatters/value/value.c index 915d58ac9..fd9188057 100644 --- a/web/api/formatters/value/value.c +++ b/web/api/formatters/value/value.c @@ -22,6 +22,7 @@ inline NETDATA_DOUBLE rrdr2value(RRDR *r, long i, RRDR_OPTIONS options, int *all if(unlikely(options & RRDR_OPTION_PERCENTAGE)) { total = 0; for (c = 0; c < used; c++) { + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; NETDATA_DOUBLE n = cn[c]; if(likely((options & RRDR_OPTION_ABSOLUTE) && n < 0)) @@ -37,6 +38,7 @@ inline NETDATA_DOUBLE rrdr2value(RRDR *r, long i, RRDR_OPTIONS options, int *all // for each dimension for (c = 0; c < used; c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if(unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_DIMENSION_NONZERO))) continue; NETDATA_DOUBLE n = cn[c]; diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 1f10c5137..df7e09799 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -2273,9 +2273,11 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) { r->internal.grouping_reset(r); if(ops[c]) { - r->od[c] |= RRDR_DIMENSION_SELECTED; + r->od[c] |= RRDR_DIMENSION_QUERIED; rrd2rrdr_query_execute(r, c, ops[c]); } + else + continue; global_statistics_rrdr_query_completed( 1, @@ -2385,15 +2387,23 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) { // free all resources used by the grouping method r->internal.grouping_free(r); - // when all the dimensions are zero, we should return all of them - if(unlikely((qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero && !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { - // all the dimensions are zero - // mark them as NONZERO to send them all - for(size_t c = 0, max = qt->query.used; c < max ; c++) { - if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; - r->od[c] |= RRDR_DIMENSION_NONZERO; + if(likely(dimensions_used)) { + // when all the dimensions are zero, we should return all of them + if (unlikely((qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero && + !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { + // all the dimensions are zero + // mark them as NONZERO to send them all + for (size_t c = 0, max = qt->query.used; c < max; c++) { + if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if (unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; + r->od[c] |= RRDR_DIMENSION_NONZERO; + } } + + return r; } - return r; + // we couldn't query any dimension + rrdr_free(owa, r); + return NULL; } diff --git a/web/api/queries/rrdr.h b/web/api/queries/rrdr.h index e31a98099..2d982b136 100644 --- a/web/api/queries/rrdr.h +++ b/web/api/queries/rrdr.h @@ -58,7 +58,7 @@ typedef enum rrdr_dimension_flag { RRDR_DIMENSION_DEFAULT = 0x00, RRDR_DIMENSION_HIDDEN = 0x04, // the dimension is hidden (not to be presented to callers) RRDR_DIMENSION_NONZERO = 0x08, // the dimension is non zero (contains non-zero values) - RRDR_DIMENSION_SELECTED = 0x10, // the dimension is selected for evaluation in this RRDR + RRDR_DIMENSION_QUERIED = 0x10, // the dimension is selected for evaluation in this RRDR } RRDR_DIMENSION_FLAGS; // RRDR result options diff --git a/web/api/queries/weights.c b/web/api/queries/weights.c index dc98aeedf..485aaca26 100644 --- a/web/api/queries/weights.c +++ b/web/api/queries/weights.c @@ -541,6 +541,9 @@ NETDATA_DOUBLE *rrd2rrdr_ks2( if(unlikely(r->od[0] & RRDR_DIMENSION_HIDDEN)) goto cleanup; + if(unlikely(!(r->od[0] & RRDR_DIMENSION_QUERIED))) + goto cleanup; + if(unlikely(!(r->od[0] & RRDR_DIMENSION_NONZERO))) goto cleanup; -- cgit v1.2.3