<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>datacenterresource :: Chantico</title>
    <link>https://chantico-300062.ci.tno.nl/api/chantico/internal/datacenterresource/index.html</link>
    <description>package datacenterresource import &#34;chantico/internal/datacenterresource&#34; Index ConstantsVariablesfunc ClearValidationError(dataCenterResource *chantico.DataCenterResource) func CoefficientMetricName(parentName, childName string) string func DeleteRuleFile(ctx context.Context, dataCenterResource *chantico.DataCenterResource) *sm.ActionResult func EnergyMetricName(resourceName string) string func FormatResources(resources []chantico.DataCenterResource) string func GetFromMap(resourcesMap map[string]chantico.DataCenterResource, nodes []string) []chantico.DataCenterResource func SetValidationError(dataCenterResource *chantico.DataCenterResource, err error, ...) func UpdateState(dataCenterResource *chantico.DataCenterResource) func Validate(dataCenterResource *chantico.DataCenterResource, ...) ([]chantico.DataCenterResource, error, string) func WriteRuleFile(ctx context.Context, dataCenterResource *chantico.DataCenterResource) *sm.ActionResult type ErrorCycleDetected func (e ErrorCycleDetected) Error() string type ErrorMissingEnergyMetric func (e ErrorMissingEnergyMetric) Error() string type ErrorResourceNotFound func (e ErrorResourceNotFound) Error() string type ErrorUnknownType func (e ErrorUnknownType) Error() string type RecordingRule func BuildRecordingRules(dataCenterResource *chantico.DataCenterResource) []RecordingRule type RuleFile func BuildRuleFile(dataCenterResource *chantico.DataCenterResource) *RuleFile type RuleGroup Constants const ( StateInit = &#34;Init&#34; StateEntry = &#34;Entry point&#34; StateValidationFailed = &#34;Validation Failed&#34; StateDelete = &#34;Delete&#34; StateEnd = &#34;End point&#34; ) const ( DataCenterResourceTypePDU = &#34;pdu&#34; DataCenterResourceTypeBaremetal = &#34;baremetal&#34; DataCenterResourceTypeVM = &#34;vm&#34; DataCenterResourceTypeKubernetes = &#34;kubernetes&#34; DataCenterResourceTypeHeat = &#34;heat&#34; ) Variables var StateMachine = sm.Machine[*chantico.DataCenterResource]{ Actions: map[string][]sm.ActionFunction[*chantico.DataCenterResource]{ StateInit: { {Type: sm.ActionFunctionPure, Pure: sm.InitializeFinalizer[*chantico.DataCenterResource]}, }, StateEntry: { {Type: sm.ActionFunctionPure, Pure: WriteRuleFile}, }, StateDelete: { {Type: sm.ActionFunctionPure, Pure: DeleteRuleFile}, {Type: sm.ActionFunctionPure, Pure: sm.RemoveFinalizer[*chantico.DataCenterResource]}, }, StateValidationFailed: {}, StateEnd: {}, }, FailState: StateValidationFailed, } Functions func ClearValidationError func ClearValidationError( dataCenterResource *chantico.DataCenterResource, ) func CoefficientMetricName func CoefficientMetricName(parentName, childName string) string CoefficientMetricName returns the deterministic Prometheus metric name for the coefficient from parent to child. func DeleteRuleFile func DeleteRuleFile( ctx context.Context, dataCenterResource *chantico.DataCenterResource, ) *sm.ActionResult DeleteRuleFile removes the Prometheus recording rule file for this DataCenterResource. After deleting, Prometheus is sent a reload request so it stops evaluating the removed rules. func EnergyMetricName func EnergyMetricName(resourceName string) string EnergyMetricName returns the deterministic Prometheus metric name for a DataCenterResource&#39;s energy timeseries. func FormatResources func FormatResources(resources []chantico.DataCenterResource) string func GetFromMap func GetFromMap( resourcesMap map[string]chantico.DataCenterResource, nodes []string, ) []chantico.DataCenterResource func SetValidationError func SetValidationError( dataCenterResource *chantico.DataCenterResource, err error, involvedResource string, ) func UpdateState func UpdateState( dataCenterResource *chantico.DataCenterResource, ) func Validate func Validate( dataCenterResource *chantico.DataCenterResource, dataCenterResources []chantico.DataCenterResource, physicalMeasurements []chantico.PhysicalMeasurement, ) ([]chantico.DataCenterResource, error, string) func WriteRuleFile func WriteRuleFile( ctx context.Context, dataCenterResource *chantico.DataCenterResource, ) *sm.ActionResult WriteRuleFile writes a Prometheus recording rule file for this DataCenterResource. The file is written to prometheus/rules/&lt;name&gt;.yml on the shared volume. After writing, Prometheus is sent a reload request so it picks up the new rules. Types type ErrorCycleDetected type ErrorCycleDetected struct { InvolvedResource string } func (ErrorCycleDetected) Error func (e ErrorCycleDetected) Error() string type ErrorMissingEnergyMetric type ErrorMissingEnergyMetric struct { InvolvedResource string } func (ErrorMissingEnergyMetric) Error func (e ErrorMissingEnergyMetric) Error() string type ErrorResourceNotFound type ErrorResourceNotFound struct { InvolvedResource string } func (ErrorResourceNotFound) Error func (e ErrorResourceNotFound) Error() string type ErrorUnknownType type ErrorUnknownType struct { Type string } func (ErrorUnknownType) Error func (e ErrorUnknownType) Error() string type RecordingRule type RecordingRule struct { Record string `yaml:&#34;record&#34;` Expr string `yaml:&#34;expr&#34;` } RecordingRule represents a single Prometheus recording rule. func BuildRecordingRules func BuildRecordingRules( dataCenterResource *chantico.DataCenterResource, ) []RecordingRule BuildRecordingRules generates the set of Prometheus recording rules for a DataCenterResource node, following the energy accounting design: For root nodes (spec.energyMetric is set), an alias rule mapping the raw energy metric to the canonical datacenter:&lt;name&gt;:energy_watts name. One coefficient recording rule per parent that has a coefficient set (from the ParentRef entries in spec.parents). One energy recording rule for non-root nodes (sum of coefficient * parent energy for each parent). Returns nil if no rules need to be written. type RuleFile type RuleFile struct { Groups []RuleGroup `yaml:&#34;groups&#34;` } RuleFile represents a complete Prometheus rule file. func BuildRuleFile func BuildRuleFile( dataCenterResource *chantico.DataCenterResource, ) *RuleFile BuildRuleFile wraps the recording rules into a complete Prometheus rule file structure with a single group named after the resource. type RuleGroup type RuleGroup struct { Name string `yaml:&#34;name&#34;` Rules []RecordingRule `yaml:&#34;rules&#34;` } RuleGroup represents a Prometheus rule group.</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>Copyright 2025-2026 TNO. Chantico is licensed under the &lt;a href=&#34;https://www.apache.org/licenses/LICENSE-2.0&#34;&gt;Apache License, Version 2.0&lt;/a&gt;. Published documentation is available under &lt;a href=&#34;https://creativecommons.org/licenses/by-sa/4.0/deed.en&#34;&gt;CC-BY-SA 4.0&lt;/a&gt;.</copyright>
    <atom:link href="https://chantico-300062.ci.tno.nl/api/chantico/internal/datacenterresource/index.xml" rel="self" type="application/rss+xml" />
  </channel>
</rss>