Remove unused chart-scoped functions (RRD_FUNCTION_LOCAL) machinery
Summary
Chart-scoped functions (RRD_FUNCTION_LOCAL, registered via rrd_function_add() with a non-NULL RRDSET *st) are a fully-wired but currently unused feature. No shipped collector or plugin registers one, yet the machinery exists end-to-end and adds complexity to the functions subsystem.
This was surfaced while reviewing #21685 (FUNCTION_DEL): FUNCTION_DEL is intentionally implemented for global functions only, because chart-scoped functions are never produced. Rather than extend FUNCTION_DEL to a dead path, we should remove the dead path.
Evidence: nothing registers a chart-scoped function
- All
rrd_function_add_inline()callers passNULLforst(global):sys_fs_cgroup.c,plugin_diskspace.c,proc_diskstats.c,proc_net_dev.c, and the 6 inweb/api/functions/functions.c. - dyncfg registrations (
dyncfg.c,dyncfg-tree.c) passNULL. - go.d (
netdataapi/api.go) only ever emitsFUNCTION GLOBAL. - apps.plugin defines a chart-scoped macro
APPS_PLUGIN_FUNCTIONS()(apps_plugin.c) that is never invoked — it callsAPPS_PLUGIN_GLOBAL_FUNCTIONS()instead. - The only chart-scoped emitter is a parent re-streaming a child's chart functions during CHART definition (
stream_sender_send_rrdset_functions), which has nothing to re-stream because no child registers them.
Proposed cleanup (separate PR)
Remove the unused chart-scoped function machinery:
RRDSET->functions_viewand its lifecycle.- The chart-scope branch in
pluginsd_function()/pluginsd_function_del()(PLUGINSD_KEYWORD_CHARTscope handling for FUNCTION). chart_functions2json(),chart_functions_to_dict(),stream_sender_send_rrdset_functions()and their call sites (jsonwrap.c,command-chart-definition.c).RRD_FUNCTION_LOCALhandling once no producer remains.
This is a focused refactor of the functions subsystem; it touches the RRDSET struct, the streaming chart-definition path, and the web-API formatters, so it is deliberately kept out of #21685.
Notes
- Confirm no out-of-tree/external plugin relies on chart-scoped
FUNCTION(non-GLOBAL) before removal.
Source: netdata/netdata