src/go/plugin/framework/docs/changing-framework-code.md
Requirement language follows the root AGENTS.md definitions.
This guide applies to shared Go framework code, not one collector's private implementation. Framework changes have high blast radius and MUST be designed before implementation.
This guide applies when changing or extending any of these areas:
src/go/plugin/framework/collectorapisrc/go/plugin/framework/jobruntimesrc/go/plugin/framework/charttplsrc/go/plugin/framework/chartenginesrc/go/plugin/framework/chartemitsrc/go/plugin/framework/functionssrc/go/plugin/framework/vnodessrc/go/plugin/framework/vnoderegistrysrc/go/plugin/framework/dyncfgsrc/go/plugin/framework/confgroupsrc/go/plugin/framework/runtimecompsrc/go/plugin/go.d/pkg/collecttestsrc/go/pkg/netdataapisrc/go/pkg/metrixsrc/go/pkg/funcapisrc/go/pkg/topology/v1src/go/pkg/matchersrc/go/pkg/stmsrc/go/pkg/ when their semantics are
used by go.d collectors or framework runtime code, such as web,
prometheus, tlscfg, netdataapi, and netipcsrc/go/plugin/go.d/pkg/, such as
collecttest, ndexec, logs, sqlquery, cloudauth, pinger,
snmputils, k8sclient, and dockerhostIt also applies when a collector change requires a new shared framework capability instead of collector-local code.
Framework changes MUST optimize for the clean end state, not the smallest local diff. If a collector exposes a general framework gap, the implementation MUST consider a framework change before adding collector-local glue, package-level globals, duplicate helpers, or private coupling.
Framework changes MUST NOT begin until the applicable approval tier below is satisfied.
Use this split before designing:
When uncertain, pause and ask for a design decision with evidence.
Use the smallest tier that honestly fits the change. If the risk is unclear, use the full design gate.
The full design gate is REQUIRED for framework changes that affect contracts, runtime behavior, compatibility, lifecycle, chart output, metric storage, Function protocol, topology payloads, host scopes/vnodes, dyncfg behavior, or multiple collectors.
The full design gate requires the design note below and explicit user approval before implementation.
The short decision gate is allowed only for additive, backward-compatible framework changes that do not alter existing behavior or public contracts. This includes narrow cases such as exposing an existing helper, adding an extension interface that existing implementations do not need to satisfy, or adding a test helper that preserves all existing caller semantics.
The short decision gate MUST NOT be used to disguise a collector-local workaround, avoid a full design discussion, or reduce the apparent blast radius of a change that really belongs under the full design gate. Before using this tier, verify that the change still serves the clean end state. If the change is a hack, it MUST NOT be implemented under this tier.
Before implementation, record the short decision in the active TODO or SOW. The record MUST include:
Ask for explicit user approval when the request does not already cover the decision, when compatibility is uncertain, or when another package or collector needs changes to consume the new framework capability. If the task began as collector work, the short gate still requires explicit user approval before implementation.
For full-gate changes, prepare a design note, record it in the active TODO or SOW, and get user approval. The design note MUST cover:
metrix read/write semantics, Function protocol, host scopes/vnodes,
topology payloads, generated docs, tests, and collector compatibility.At every coherent batch boundary, you MUST re-check scope:
Use this checklist when the changed package is involved.
Init, Check, Collect, Cleanup,
commit, abort, cancellation, retry, and runtime metrics.BeginCycle, CommitCycleSuccess, and AbortCycle contract MUST be
preserved and tested when changed.See .agents/skills/project-writing-go-modules-framework-v2/go-v2-host-scope.md.
_vnode_type labels. The
framework does not synthesize this label for collectors.src/plugins.d/FUNCTION_UI_SCHEMA.json unless a breaking change is approved.See .agents/skills/project-create-topology/SKILL.md and
.agents/skills/project-create-topology/topology-function-schema.md.
src/go/pkg/topology/v1.src/plugins.d/FUNCTION_TOPOLOGY_SCHEMA.json.When a framework change affects collectors, choose representative collectors from the affected surface. Broad tests MUST NOT be used blindly as a substitute for choosing the right representatives.
Common representatives:
cato_networks, azure_monitor, powerstore,
powervault, ping.mysql, cato_networks.azure_monitor, cato_networks.cato_networks, snmp_topology when the legacy topology
path is affected.apache when changing shared V1/V2 runtime code.The exact list SHOULD be justified in the design note.
Validation MUST match the changed contract.
Examples:
go test -count=1 ./plugin/framework/...go test -count=1 ./pkg/metrix/...go test -count=1 ./pkg/matcher/...go test -count=1 ./pkg/topology/...go test -count=1 ./plugin/go.d/pkg/collecttestgo test -count=1 ./plugin/go.d/pkg/... when shared go.d helper semantics
change.go test -count=1 ./plugin/go.d/collector/<name>/...go test -race -count=1 ./plugin/go.d/collector/<name>/... when
concurrency, Functions, host scopes, or topology are involved.collecttest changes: include several representative V2 collectors that use
chart coverage, config serialization, and host scopes where relevant.go test -count=1 ./plugin/framework/jobruntime ./plugin/framework/runtimecompgo test -race -count=1 ./plugin/agent/jobmgr/...collectorapi, jobruntime, dyncfg,
confgroup, vnoderegistry, or runtime wiring behavior.manager_v2_test.go, job_factory_test.go,
sim_test.go, dyncfg_collector_test.go, and dyncfg_vnode_test.go.Record exactly what ran. Full validation MUST NOT be claimed from a narrow command.
Framework changes often require durable artifact updates. Check each class:
AGENTS.md and src/go/AGENTS.md.agents/skills/.agents/sow/specs/src/go/plugin/go.d/docs/If no artifact update is needed, record why in the active TODO/SOW.
If the framework work was discovered while writing a collector, return to
src/go/plugin/go.d/docs/how-to-write-a-collector.md after the framework
decision or change is complete.