feat(go.d/chartengine): support named active chart template sets - #23971
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Code Review by Qodo
1. Startup claim omits its enforcer
|
Code Review by Qodo
1. Old-host charts remain after a move
|
There was a problem hiding this comment.
All reported issues were addressed across 39 files
You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Architecture diagram
sequenceDiagram
participant C as Collector (V2)
participant CTS as ChartTemplateSource
participant TS as TemplateSet (Immutable)
participant CTE as ChartTemplateEngine
participant SM as ScopeManager
participant HS as HostScope State
participant OE as Output Emitter
Note over C,OE: NEW: Named Active Template Set Publication Flow
C->>CTS: ChartTemplateSet() (new/changed set)
activate CTS
CTS->>CTS: Validate provider + no fixed policy change
CTS->>TS: PrepareTemplateSet (apply job overrides)
CTS-->>C: Prepared TemplateSet (stable pointer)
deactivate CTS
Note over C,SM: Captured per scope after successful collect
C->>SM: Prepare emission per scope
SM->>HS: Capture previous committed state
HS-->>SM: Retained charts/dimensions
SM->>CTE: PreparePlanWithOptions(reader, TemplateSet, ResetMaterialized)
activate CTE
CTE->>CTE: compare entries (preserved vs changed)
alt unchanged entries
CTE->>HS: preserve lifecycle state
else changed/replaced entries
CTE->>CTE: release old reservations
CTE->>HS: recreate/retire affected charts
else new host reset
CTE->>CTE: stage fresh materialized state
end
CTE-->>SM: PlanAttempt (staged, not committed)
deactivate CTE
SM->>OE: Commit output (per scope)
alt output accepted
OE-->>SM: Commit success
SM->>CTE: Commit (install program + route cache)
CTE-->>HS: Update committed state + lifecycle
else output rejected
OE-->>SM: Abort
Note over SM,HS: Scope keeps previous presentation
end
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Summary
Allow V2 collectors to add, remove, and replace named native chart templates at runtime while preserving unchanged entries’ lifecycle state. Adds transactional publication per host scope and native chart-coverage support as a prerequisite for Go StatsD. Existing YAML collectors remain supported through a separate static-provider interface.
Validated with framework tests, race checks, existing collector builds, Prometheus tooling and benchmarks.
Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Adds named active chart template sets to the chart engine, letting V2 collectors add, remove, and replace native chart entries at runtime without disturbing lifecycle state for unchanged entries. Changes are prepared as immutable snapshots and published transactionally per host scope, with static YAML collectors still supported through a separate provider; this is groundwork for Go StatsD collection.
New Features
ChartTemplateSetProviderto expose a complete native template set; the getter is captured after Check and once after each successful Collect, and invalid candidates abort the staged metric cycle.collecttest.AssertChartCoveragenow validates native template sets alongside static YAML, aligning coverage with instance eligibility and excluding collision losers; pin intended winners withRequiredContexts.Migration
CollectorV2no longer declaresChartTemplateYAML(); metric jobs must implement exactly one ofStaticChartTemplateProviderorChartTemplateSetProvider.type=intexplicitly, so golden output and protocol assertions need updating.Written for commit ad14df3. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation