#22747·netdata

Remove unused chart-scoped functions (RRD_FUNCTION_LOCAL) machinery

Author: ktsaouCreated Jun 16, 2026Updated Aug 18, 2026

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 pass NULL for st (global): sys_fs_cgroup.c, plugin_diskspace.c, proc_diskstats.c, proc_net_dev.c, and the 6 in web/api/functions/functions.c.
  • dyncfg registrations (dyncfg.c, dyncfg-tree.c) pass NULL.
  • go.d (netdataapi/api.go) only ever emits FUNCTION GLOBAL.
  • apps.plugin defines a chart-scoped macro APPS_PLUGIN_FUNCTIONS() (apps_plugin.c) that is never invoked — it calls APPS_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_view and its lifecycle.
  • The chart-scope branch in pluginsd_function() / pluginsd_function_del() (PLUGINSD_KEYWORD_CHART scope 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_LOCAL handling 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.