runtimechartemit
This package is the runtime/internal metrics bridge between component-owned
metrix.RuntimeStore writers and Netdata chart protocol output.
Registration flow
- Component code creates/owns a
metrix.RuntimeStore(writer side). - Component registers itself via
runtimecomp.Service.RegisterComponent(...)with:- stable
Name Store- optional
TemplateYAML(orAutogen.Enabled=truefor fallback template) - cadence metadata (
UpdateEvery) and emit env metadata (TypeID,Plugin,Module,JobName,JobLabels).
- stable
- Service normalizes config and upserts it into the internal component registry.
- Runtime metrics job snapshots registry entries on each tick.
- For each component due on this tick:
- read component store via
Read(metrix.ReadRaw(), metrix.ReadFlatten()) - build plan with chartengine
- emit plan through
chartemit.ApplyPlan(...).
- read component store via
- When component is unregistered, runtime job emits obsolete/remove actions for previously known charts.
Lifecycle ownership
Service.Start(pluginName, out)starts runtime metrics job and cadence ticker.Service.Stop()stops ticker and runtime job.- Components should register on start and unregister on stop to avoid stale runtime charts.
Producers vs components
- Components: register a runtime store to be charted.
- Producers: register a
tickFncallback viaRegisterProducerwhen a runtime source has no independent owner loop and must be advanced by runtime service cadence.
Operational notes
- Runtime metrics job is intentionally single-flight; overlapping ticks are skipped and logged.
- Observer chartengine runs with
WithRuntimeStore(nil)(no self-instrumentation loop). Nameis the registry identity; re-registering the same name replaces generation and reinitializes runtime chart state.