MCPcopy Index your code
hub / github.com/netdata/netdata / ApplyPlan

Function ApplyPlan

src/go/plugin/framework/chartemit/apply.go:40–64  ·  view source on GitHub ↗

ApplyPlan emits chartengine actions to the Netdata wire API.

(api *netdataapi.API, plan Plan, env EmitEnv)

Source from the content-addressed store, hash-verified

38
39// ApplyPlan emits chartengine actions to the Netdata wire API.
40func ApplyPlan(api *netdataapi.API, plan Plan, env EmitEnv) error {
41 if api == nil {
42 return fmt.Errorf("chartemit: nil netdata api")
43 }
44 if strings.TrimSpace(env.TypeID) == "" {
45 return fmt.Errorf("chartemit: emit env type_id is required")
46 }
47 if env.UpdateEvery <= 0 {
48 env.UpdateEvery = 1
49 }
50 normalized := normalizeActions(plan.Actions)
51 if err := validateTypeIDBudget(env.TypeID, normalized); err != nil {
52 return err
53 }
54 if !hasEmissions(normalized) {
55 return nil
56 }
57 if err := emitHostSelection(api, env); err != nil {
58 return err
59 }
60 emitCreatePhase(api, env, normalized)
61 emitUpdatePhase(api, env, normalized.updateCharts)
62 emitRemovePhase(api, env, normalized)
63 return nil
64}
65
66func hasEmissions(actions normalizedActions) bool {
67 return len(actions.createCharts) > 0 ||

Calls 8

normalizeActionsFunction · 0.85
validateTypeIDBudgetFunction · 0.85
hasEmissionsFunction · 0.85
emitHostSelectionFunction · 0.85
emitCreatePhaseFunction · 0.85
emitUpdatePhaseFunction · 0.85
emitRemovePhaseFunction · 0.85
ErrorfMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…